Initialize some gnc_numerics that could be returned uninitialized.

Found by clang static analyzer.
This commit is contained in:
John Ralls
2018-11-28 22:24:41 +09:00
parent 8ed9a9c43a
commit 185787d7be
4 changed files with 4 additions and 4 deletions

View File

@@ -66,7 +66,7 @@ GncNumeric parse_amount_price (const std::string &str, int currency_format)
std::string str_no_symbols = boost::u32regex_replace(str, expr, ""); std::string str_no_symbols = boost::u32regex_replace(str, expr, "");
/* Convert based on user chosen currency format */ /* Convert based on user chosen currency format */
gnc_numeric val; gnc_numeric val = gnc_numeric_zero();
char *endptr; char *endptr;
switch (currency_format) switch (currency_format)
{ {

View File

@@ -114,7 +114,7 @@ GncNumeric parse_amount (const std::string &str, int currency_format)
std::string str_no_symbols = boost::u32regex_replace(str, expr, ""); std::string str_no_symbols = boost::u32regex_replace(str, expr, "");
/* Convert based on user chosen currency format */ /* Convert based on user chosen currency format */
gnc_numeric val; gnc_numeric val = gnc_numeric_zero();
char *endptr; char *endptr;
switch (currency_format) switch (currency_format)
{ {

View File

@@ -721,7 +721,7 @@ void
gnc_entry_ledger_compute_value (GncEntryLedger *ledger, gnc_entry_ledger_compute_value (GncEntryLedger *ledger,
gnc_numeric *value, gnc_numeric *tax_value) gnc_numeric *value, gnc_numeric *tax_value)
{ {
gnc_numeric qty, price, discount; gnc_numeric qty, price = gnc_numeric_zero(), discount = gnc_numeric_zero();
gint disc_type, disc_how; gint disc_type, disc_how;
gboolean taxable, taxincluded; gboolean taxable, taxincluded;
GncTaxTable *table; GncTaxTable *table;

View File

@@ -597,7 +597,7 @@ gnc_split_register_use_negative_color (VirtualLocation virt_loc,
SplitRegister *reg) SplitRegister *reg)
{ {
const char * cell_name; const char * cell_name;
gnc_numeric value; gnc_numeric value = gnc_numeric_zero();
Split *split; Split *split;
if (!use_red_for_negative) if (!use_red_for_negative)