From 6b69bf8866f91dfa16567f39cb538be66baa0ec8 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 26 Nov 2004 04:40:41 +0000 Subject: [PATCH] Add a testcase for the previous fix. 2004-11-25 Matthias Clasen * tests/strtod-test.c (main): Add a testcase for the previous fix. * glib/gstrfuncs.c (g_ascii_strtod): Make it work again for floats starting with a decimal point, like .75 (#156421, Hans Breuer) --- ChangeLog | 7 +++++++ ChangeLog.pre-2-10 | 7 +++++++ ChangeLog.pre-2-12 | 7 +++++++ ChangeLog.pre-2-6 | 7 +++++++ ChangeLog.pre-2-8 | 7 +++++++ glib/gstrfuncs.c | 2 +- tests/strtod-test.c | 1 + 7 files changed, 37 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 106f5fb3f..81aea56e7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2004-11-25 Matthias Clasen + + * tests/strtod-test.c (main): Add a testcase for the previous fix. + + * glib/gstrfuncs.c (g_ascii_strtod): Make it work again for floats + starting with a decimal point, like .75 (#156421, Hans Breuer) + Thu Nov 25 14:02:43 2004 Manish Singh * glib/abicheck.sh: filter out G_GNUC stuff when doing the compare. diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 106f5fb3f..81aea56e7 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,10 @@ +2004-11-25 Matthias Clasen + + * tests/strtod-test.c (main): Add a testcase for the previous fix. + + * glib/gstrfuncs.c (g_ascii_strtod): Make it work again for floats + starting with a decimal point, like .75 (#156421, Hans Breuer) + Thu Nov 25 14:02:43 2004 Manish Singh * glib/abicheck.sh: filter out G_GNUC stuff when doing the compare. diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index 106f5fb3f..81aea56e7 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,10 @@ +2004-11-25 Matthias Clasen + + * tests/strtod-test.c (main): Add a testcase for the previous fix. + + * glib/gstrfuncs.c (g_ascii_strtod): Make it work again for floats + starting with a decimal point, like .75 (#156421, Hans Breuer) + Thu Nov 25 14:02:43 2004 Manish Singh * glib/abicheck.sh: filter out G_GNUC stuff when doing the compare. diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 106f5fb3f..81aea56e7 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,10 @@ +2004-11-25 Matthias Clasen + + * tests/strtod-test.c (main): Add a testcase for the previous fix. + + * glib/gstrfuncs.c (g_ascii_strtod): Make it work again for floats + starting with a decimal point, like .75 (#156421, Hans Breuer) + Thu Nov 25 14:02:43 2004 Manish Singh * glib/abicheck.sh: filter out G_GNUC stuff when doing the compare. diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 106f5fb3f..81aea56e7 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,10 @@ +2004-11-25 Matthias Clasen + + * tests/strtod-test.c (main): Add a testcase for the previous fix. + + * glib/gstrfuncs.c (g_ascii_strtod): Make it work again for floats + starting with a decimal point, like .75 (#156421, Hans Breuer) + Thu Nov 25 14:02:43 2004 Manish Singh * glib/abicheck.sh: filter out G_GNUC stuff when doing the compare. diff --git a/glib/gstrfuncs.c b/glib/gstrfuncs.c index afb0223a8..89a500834 100644 --- a/glib/gstrfuncs.c +++ b/glib/gstrfuncs.c @@ -386,7 +386,7 @@ g_ascii_strtod (const gchar *nptr, end = p; } - else if (g_ascii_isdigit (*p)) + else if (g_ascii_isdigit (*p) || *p == '.') { while (g_ascii_isdigit (*p)) p++; diff --git a/tests/strtod-test.c b/tests/strtod-test.c index 3eab6ea2b..a5a4a2376 100644 --- a/tests/strtod-test.c +++ b/tests/strtod-test.c @@ -95,6 +95,7 @@ main () test_string ("-nan", -our_nan, FALSE, 0); test_string ("INF", our_inf, FALSE, 0); test_string ("-infinity", -our_inf, FALSE, 0); + test_string ("-.75,0", -0.75, TRUE, 4); d = 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0; g_assert (d == g_ascii_strtod (g_ascii_dtostr (buffer, sizeof (buffer), d), NULL));