mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16:17 +01:00
g_key_file_parse_value_as_integer: Integers can have trailing whitespaces or tabs
Now it can parse integer values with trailing whitespaces or tabs before CR. Using g_ascii_isspace() as suggested. https://bugzilla.gnome.org/show_bug.cgi?id=653987
This commit is contained in:
parent
4a1d79842a
commit
7a45dde4fe
@ -3857,14 +3857,14 @@ g_key_file_parse_value_as_integer (GKeyFile *key_file,
|
||||
const gchar *value,
|
||||
GError **error)
|
||||
{
|
||||
gchar *end_of_valid_int;
|
||||
glong long_value;
|
||||
gchar *eof_int;
|
||||
glong long_value;
|
||||
gint int_value;
|
||||
|
||||
errno = 0;
|
||||
long_value = strtol (value, &end_of_valid_int, 10);
|
||||
long_value = strtol (value, &eof_int, 10);
|
||||
|
||||
if (*value == '\0' || *end_of_valid_int != '\0')
|
||||
if (*value == '\0' || (*eof_int != '\0' && !g_ascii_isspace(*eof_int)))
|
||||
{
|
||||
gchar *value_utf8 = _g_utf8_make_valid (value);
|
||||
g_set_error (error, G_KEY_FILE_ERROR,
|
||||
|
Loading…
Reference in New Issue
Block a user