fixed an off by 0 error (yeah, the function went off when the while (n--)
authorTim Janik <timj@gtk.org>
Sat, 15 Jul 2000 07:18:19 +0000 (07:18 +0000)
committerTim Janik <timj@src.gnome.org>
Sat, 15 Jul 2000 07:18:19 +0000 (07:18 +0000)
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>.

ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-12
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
glib/gstrfuncs.c
gstrfuncs.c

index 6a4ad43..4b45062 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+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>.
+
 2000-07-15  Tor Lillqvist  <tml@iki.fi>
 
        * Makefile.am (SUBDIRS): Include the "build" module in GLib, too,
index 6a4ad43..4b45062 100644 (file)
@@ -1,3 +1,9 @@
+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>.
+
 2000-07-15  Tor Lillqvist  <tml@iki.fi>
 
        * Makefile.am (SUBDIRS): Include the "build" module in GLib, too,
index 6a4ad43..4b45062 100644 (file)
@@ -1,3 +1,9 @@
+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>.
+
 2000-07-15  Tor Lillqvist  <tml@iki.fi>
 
        * Makefile.am (SUBDIRS): Include the "build" module in GLib, too,
index 6a4ad43..4b45062 100644 (file)
@@ -1,3 +1,9 @@
+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>.
+
 2000-07-15  Tor Lillqvist  <tml@iki.fi>
 
        * Makefile.am (SUBDIRS): Include the "build" module in GLib, too,
index 6a4ad43..4b45062 100644 (file)
@@ -1,3 +1,9 @@
+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>.
+
 2000-07-15  Tor Lillqvist  <tml@iki.fi>
 
        * Makefile.am (SUBDIRS): Include the "build" module in GLib, too,
index 6a4ad43..4b45062 100644 (file)
@@ -1,3 +1,9 @@
+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>.
+
 2000-07-15  Tor Lillqvist  <tml@iki.fi>
 
        * Makefile.am (SUBDIRS): Include the "build" module in GLib, too,
index 6a4ad43..4b45062 100644 (file)
@@ -1,3 +1,9 @@
+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>.
+
 2000-07-15  Tor Lillqvist  <tml@iki.fi>
 
        * Makefile.am (SUBDIRS): Include the "build" module in GLib, too,
index 6a4ad43..4b45062 100644 (file)
@@ -1,3 +1,9 @@
+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>.
+
 2000-07-15  Tor Lillqvist  <tml@iki.fi>
 
        * Makefile.am (SUBDIRS): Include the "build" module in GLib, too,
index e4f633e..0bec543 100644 (file)
@@ -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
index e4f633e..0bec543 100644 (file)
@@ -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