Return negative values. (#416062)

2007-03-08  Matthias Clasen  <mclasen@redhat.com>

        * glib/gstrfuncs.c (g_strtoll): Return negative values.
        (#416062)

        * tests/strtoll-test.c: Add more testcases.



svn path=/trunk/; revision=5390
This commit is contained in:
Matthias Clasen 2007-03-09 03:40:43 +00:00 committed by Matthias Clasen
parent b059f8d218
commit 2a867b1fca
3 changed files with 13 additions and 0 deletions

View File

@ -1,3 +1,10 @@
2007-03-08 Matthias Clasen <mclasen@redhat.com>
* glib/gstrfuncs.c (g_strtoll): Return negative values.
(#416062)
* tests/strtoll-test.c: Add more testcases.
2007-03-06 Matthias Clasen <mclasen@redhat.com>
* glib/gstring.c (g_str_equal): Clarify docs. (#364026,

View File

@ -842,6 +842,8 @@ g_ascii_strtoll (const gchar *nptr,
errno = ERANGE;
return G_MAXINT64;
}
else if (negative)
return - (gint64) result;
else
return (gint64) result;
}

View File

@ -62,6 +62,10 @@ main (int argc, char *argv[])
test_int64 ("9223372036854775808", "", 10, G_MAXINT64, ERANGE);
test_int64 ("-9223372036854775808", "", 10, G_MININT64, 0);
test_int64 ("-9223372036854775809", "", 10, G_MININT64, ERANGE);
test_int64 ("32768", "", 10, 32768, 0);
test_int64 ("-32768", "", 10, -32768, 0);
test_int64 ("001", "", 10, 1, 0);
test_int64 ("-001", "", 10, -1, 0);
return 0;
}