diff options
author | Tim Janik <timj@gtk.org> | 2000-07-15 07:18:19 +0000 |
---|---|---|
committer | Tim Janik <timj@src.gnome.org> | 2000-07-15 07:18:19 +0000 |
commit | a9a09f147f725357ba321933cf2106b57ab52fc8 (patch) | |
tree | 6df3e5788959fd0bc4650fe14c119c688983e7c3 /gstrfuncs.c | |
parent | 45adcf12c156ee7c8074d57c30262e809a05a1e1 (diff) | |
download | glib-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 'gstrfuncs.c')
-rw-r--r-- | gstrfuncs.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/gstrfuncs.c b/gstrfuncs.c index e4f633e71..0bec54367 100644 --- a/gstrfuncs.c +++ b/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 |