r21541 - gnucash/trunk/src - Fix erroneous return value of gnc_gconf_get_float()

Christian Stimming cstim at code.gnucash.org
Wed Nov 9 08:07:06 EST 2011


Author: cstim
Date: 2011-11-09 08:07:05 -0500 (Wed, 09 Nov 2011)
New Revision: 21541
Trac: http://svn.gnucash.org/trac/changeset/21541

Modified:
   gnucash/trunk/src/app-utils/gnc-ui-util.c
   gnucash/trunk/src/core-utils/gnc-gconf-utils.c
   gnucash/trunk/src/core-utils/gnc-gconf-utils.h
   gnucash/trunk/src/import-export/import-settings.c
Log:
Fix erroneous return value of gnc_gconf_get_float()

Discovered in bug#663433 - the return value was cached in an int variable
instead of a gdouble one.

Modified: gnucash/trunk/src/app-utils/gnc-ui-util.c
===================================================================
--- gnucash/trunk/src/app-utils/gnc-ui-util.c	2011-11-09 03:49:41 UTC (rev 21540)
+++ gnucash/trunk/src/app-utils/gnc-ui-util.c	2011-11-09 13:07:05 UTC (rev 21541)
@@ -2233,7 +2233,7 @@
     auto_decimal_enabled =
         gnc_gconf_get_bool(GCONF_GENERAL, "auto_decimal_point", NULL);
     auto_decimal_places =
-        gnc_gconf_get_float(GCONF_GENERAL, "auto_decimal_places", NULL);
+        (int)gnc_gconf_get_float(GCONF_GENERAL, "auto_decimal_places", NULL);
 }
 
 void

Modified: gnucash/trunk/src/core-utils/gnc-gconf-utils.c
===================================================================
--- gnucash/trunk/src/core-utils/gnc-gconf-utils.c	2011-11-09 03:49:41 UTC (rev 21540)
+++ gnucash/trunk/src/core-utils/gnc-gconf-utils.c	2011-11-09 13:07:05 UTC (rev 21541)
@@ -528,7 +528,7 @@
                      GError **caller_error)
 {
     GError *error = NULL;
-    gint value;
+    gdouble value;
     gchar *key;
 
     if (our_client == NULL)

Modified: gnucash/trunk/src/core-utils/gnc-gconf-utils.h
===================================================================
--- gnucash/trunk/src/core-utils/gnc-gconf-utils.h	2011-11-09 03:49:41 UTC (rev 21540)
+++ gnucash/trunk/src/core-utils/gnc-gconf-utils.h	2011-11-09 13:07:05 UTC (rev 21541)
@@ -336,7 +336,7 @@
  *  display an error message via stdout.  If present, this function
  *  will pass any error back to the calling function for it to handle.
  *
- *  @return This function returns the float value stored at the
+ *  @return This function returns the integer value stored at the
  *  requested key in the gconf database.  If the key has never been
  *  set, this function passes on the default value returned by GConf
  *  as specified in the schema for this key.  If there is an error in
@@ -372,7 +372,7 @@
  *  display an error message via stdout.  If present, this function
  *  will pass any error back to the calling function for it to handle.
  *
- *  @return This function returns the integer value stored at the
+ *  @return This function returns the float value stored at the
  *  requested key in the gconf database.  If the key has never been
  *  set, this function passes on the default value returned by GConf
  *  as specified in the schema for this key.  If there is an error in

Modified: gnucash/trunk/src/import-export/import-settings.c
===================================================================
--- gnucash/trunk/src/import-export/import-settings.c	2011-11-09 03:49:41 UTC (rev 21540)
+++ gnucash/trunk/src/import-export/import-settings.c	2011-11-09 13:07:05 UTC (rev 21541)
@@ -89,11 +89,11 @@
     settings->action_add_enabled = DEFAULT_ACTION_ADD_ENABLED;
     settings->action_clear_enabled = DEFAULT_ACTION_CLEAR_ENABLED;
     settings->clear_threshold =
-        gnc_gconf_get_float(GCONF_IMPORT_SECTION, "auto_clear_threshold", NULL);
+        (int)gnc_gconf_get_float(GCONF_IMPORT_SECTION, "auto_clear_threshold", NULL);
     settings->add_threshold =
-        gnc_gconf_get_float(GCONF_IMPORT_SECTION, "auto_add_threshold", NULL);
+        (int)gnc_gconf_get_float(GCONF_IMPORT_SECTION, "auto_add_threshold", NULL);
     settings->display_threshold =
-        gnc_gconf_get_float(GCONF_IMPORT_SECTION, "match_threshold", NULL);
+        (int)gnc_gconf_get_float(GCONF_IMPORT_SECTION, "match_threshold", NULL);
 
     settings->fuzzy_amount =
         gnc_gconf_get_float(GCONF_IMPORT_SECTION, "atm_fee_threshold", NULL);



More information about the gnucash-changes mailing list