]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Added assertion.
authorBruno Haible <bruno@clisp.org>
Mon, 13 Jan 2003 15:10:15 +0000 (15:10 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:08:55 +0000 (12:08 +0200)
lib/ChangeLog
lib/linebreak.c
src/ChangeLog
src/write-po.c

index 940df1a6e3e3c9b5bb42e53bb7d3d47641884979..5480d193a427cbff2c0675fd0d61ed430d887c9d 100644 (file)
@@ -1,3 +1,8 @@
+2003-01-12  Bruno Haible  <bruno@clisp.org>
+
+       * linebreak.c (iconv_string_keeping_offsets): Add an assertion, to
+       protect against Solaris 2.9 iconv() bug.
+
 2003-01-10  Bruno Haible  <bruno@clisp.org>
 
        * linebreak.c (mbs_possible_linebreaks, mbs_width_linebreaks):
index 42d0ea10b7ec0d8093c834895efa7311e476db80..8385ed6713aa6fbde8c545aaa18b920ee40bda6c 100644 (file)
@@ -1394,7 +1394,7 @@ iconv_string_length (iconv_t cd, const char *s, size_t n)
     }
   /* Avoid glibc-2.1 bug and Solaris 2.7-2.9 bug.  */
 #if defined _LIBICONV_VERSION \
-   || !((__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) || defined __sun)
+    || !((__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) || defined __sun)
   {
     char *outptr = tmpbuf;
     size_t outsize = TMPBUFSIZE;
@@ -1435,17 +1435,22 @@ iconv_string_keeping_offsets (iconv_t cd, const char *s, size_t n,
   outsize = m + extra;
   while (inptr < s_end)
     {
+      const char *saved_inptr;
       size_t insize;
       size_t res;
 
       offtable[inptr - s] = outptr - t;
 
+      saved_inptr = inptr;
       res = (size_t)(-1);
       for (insize = 1; inptr + insize <= s_end; insize++)
         {
           res = iconv (cd, (ICONV_CONST char **) &inptr, &insize, &outptr, &outsize);
           if (!(res == (size_t)(-1) && errno == EINVAL))
             break;
+          /* We expect that no input bytes have been consumed so far.  */
+          if (inptr != saved_inptr)
+            abort ();
         }
       /* After we verified the convertibility and computed the translation's
          size m, there shouldn't be any conversion error here. */
@@ -1454,7 +1459,7 @@ iconv_string_keeping_offsets (iconv_t cd, const char *s, size_t n,
     }
   /* Avoid glibc-2.1 bug and Solaris 2.7 bug.  */
 #if defined _LIBICONV_VERSION \
-   || !((__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) || defined __sun)
+    || !((__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) || defined __sun)
   if (iconv (cd, NULL, NULL, &outptr, &outsize) == (size_t)(-1))
     abort ();
 #endif
index 7f0c0750ddcb57277cc2b3b58fb09ae9a00b1d18..7d06e23499bff190bc87210ec3ccce873b4cfa11 100644 (file)
@@ -1,3 +1,8 @@
+2003-01-12  Bruno Haible  <bruno@clisp.org>
+
+       * write-po.c (wrap): Add an assertion, to protect against Solaris 2.9
+       iconv() bug.
+
 2003-01-10  Bruno Haible  <bruno@clisp.org>
 
        * po-charset.c (po_lex_charset_set): Work around Solaris 2.9 iconv()
index 11386a6d283a684563f2594a1db3cc7b206c9130..59ad5777a331919678e6d15974e1d58756bcb8fe 100644 (file)
@@ -327,6 +327,10 @@ wrap (FILE *fp, const char *line_prefix, const char *name, const char *value,
                                   &outptr, &outsize);
                      if (!(res == (size_t)(-1) && errno == EINVAL))
                        break;
+                     /* We expect that no input bytes have been consumed
+                        so far.  */
+                     if (inptr != ep)
+                       abort ();
                    }
                  if (res == (size_t)(-1))
                    {
@@ -429,6 +433,10 @@ internationalized messages should not contain the `\\%c' escape sequence"),
                                   &outptr, &outsize);
                      if (!(res == (size_t)(-1) && errno == EINVAL))
                        break;
+                     /* We expect that no input bytes have been consumed
+                        so far.  */
+                     if (inptr != ep)
+                       abort ();
                    }
                  if (res == (size_t)(-1))
                    {