GNOME Bugzilla – Bug 768504
keyfile: g_key_file_get_double behavior doesn't follow documentation
Last modified: 2016-07-17 00:51:37 UTC
Documentation of g_key_file_get_double said that it returns 0.0 when the value can't be interpreted as a double and the error is set to G_KEY_FILE_ERROR_INVALID_VALUE. However, when the value can be partially parsed, for instance '1.0.0' or '1.0foo', the returned double value is not 0.0 but 1.0.
Created attachment 330983 [details] [review] [1/2] glib/tests/keyfile: check return value of g_key_file_get_double is 0 for invalid values Update keyfile test to chech returned values of g_key_file_get_double for invalid keys.
Created attachment 330985 [details] [review] [2/2] keyfile: return 0 when the parsed double value is invalid Set return value to 0 when we set the INVALID_VALUE error.
Review of attachment 330983 [details] [review]: Looks correct
Review of attachment 330985 [details] [review]: yes