summaryrefslogtreecommitdiff
path: root/glib
diff options
context:
space:
mode:
authorTim Janik <timj@gtk.org>2000-07-15 07:18:19 +0000
committerTim Janik <timj@src.gnome.org>2000-07-15 07:18:19 +0000
commita9a09f147f725357ba321933cf2106b57ab52fc8 (patch)
tree6df3e5788959fd0bc4650fe14c119c688983e7c3 /glib
parent45adcf12c156ee7c8074d57c30262e809a05a1e1 (diff)
downloadglib-a9a09f147f725357ba321933cf2106b57ab52fc8.tar.gz
fixed an off by 0 error (yeah, the function went off when the while (n--)
Sat Jul 15 09:11:46 2000 Tim Janik <timj@gtk.org> * gstrfuncs.c (g_strncasecmp): fixed an off by 0 error (yeah, the function went off when the while (n--) loop failed due to n==0 ;), reported by Jean-Louis HAMEL <jlhamel@club-internet.fr>.
Diffstat (limited to 'glib')
-rw-r--r--glib/gstrfuncs.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/glib/gstrfuncs.c b/glib/gstrfuncs.c
index e4f633e71..0bec54367 100644
--- a/glib/gstrfuncs.c
+++ b/glib/gstrfuncs.c
@@ -908,8 +908,9 @@ g_strncasecmp (const gchar *s1,
g_return_val_if_fail (s1 != NULL, 0);
g_return_val_if_fail (s2 != NULL, 0);
- while (n-- && *s1 && *s2)
+ while (n && *s1 && *s2)
{
+ n -= 1;
/* According to A. Cox, some platforms have islower's that
* don't work right on non-uppercase
*/
@@ -921,7 +922,7 @@ g_strncasecmp (const gchar *s1,
}
if (n)
- return (((gint)(guchar) *s1) - ((gint)(guchar) *s2));
+ return (((gint) (guchar) *s1) - ((gint) (guchar) *s2));
else
return 0;
#endif