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=/branches/glib-2-12/; revision=5391
This commit is contained in:
Matthias Clasen 2007-03-09 03:43:30 +00:00 committed by Matthias Clasen
parent 39996df303
commit 438143ad94
3 changed files with 15 additions and 0 deletions

View File

@ -1,3 +1,12 @@
2007-03-08 Matthias Clasen <mclasen@redhat.com>
Merge from trunk:
* glib/gstrfuncs.c (g_strtoll): Return negative values.
(#416062)
* tests/strtoll-test.c: Add more testcases.
2007-03-08 Matthias Clasen <mclasen@redhat.com>
* glib/gthreadpool.c: Remove leftover debug spew.

View File

@ -813,6 +813,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;
}