OSDN Git Service

Fix a bug in multibyte_strchr().
authorHiroshi Inoue <inoue@tpf.co.jp>
Thu, 4 Apr 2002 01:36:17 +0000 (01:36 +0000)
committerHiroshi Inoue <inoue@tpf.co.jp>
Thu, 4 Apr 2002 01:36:17 +0000 (01:36 +0000)
src/interfaces/odbc/multibyte.c

index 3cc3efe..476f3c4 100644 (file)
@@ -253,18 +253,18 @@ unsigned char *
 pg_mbschr(int csc, const unsigned char *string, unsigned int character)
 {
        int                     mb_st = 0;
-       unsigned char *s;
-       s = (unsigned char *) string;
+       const unsigned char *s, *rs = NULL;
 
-       for(;;
+       for(s = string; *s ; s++
        {
                mb_st = pg_CS_stat(mb_st, (unsigned char) *s, csc);
-               if (mb_st == 0 && (*s == character || *s == 0))
+               if (mb_st == 0 && (*s == character))
+               {
+                       rs = s;
                        break;
-               else
-                       s++;
+               }
        }
-       return (s);
+       return (rs);
 }
 
 int