]> sourceware.org Git - glibc.git/commitdiff
Update.
authorUlrich Drepper <drepper@redhat.com>
Wed, 20 Nov 2002 23:42:04 +0000 (23:42 +0000)
committerUlrich Drepper <drepper@redhat.com>
Wed, 20 Nov 2002 23:42:04 +0000 (23:42 +0000)
* iconv/gconv_simple.c (internal_ucs4le_loop_unaligned): Return
__GCONV_EMPTY_INPUT only if input is really empty.  Otherwise
__GCONV_INCOMPLETE_INPUT.
(ucs4le_internal_loop): Likewise.
(ucs4le_internal_loop_unaligned): Likewise.
* iconvdata/unicode.c (PREPARE_LOOP): Likewise.
* iconvdata/utf-16.c (PREPARE_LOOP): Likewise.
* iconvdata/utf-32.c (PREPARE_LOOP): Likewise.

* iconv/loop.c (LOOPFCT): First test for empty input then for full
output buffer.

ChangeLog
iconv/gconv_simple.c
iconv/loop.c
iconvdata/unicode.c
iconvdata/utf-16.c
iconvdata/utf-32.c
sysdeps/posix/getaddrinfo.c

index 185ce2201e0c736d662d293d8632a5a13c19910d..176144b6fb8ee486cb8a82c603e5dd00b7a2cfca 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
 2002-11-20  Ulrich Drepper  <drepper@redhat.com>
 
+       * iconv/gconv_simple.c (internal_ucs4le_loop_unaligned): Return
+       __GCONV_EMPTY_INPUT only if input is really empty.  Otherwise
+       __GCONV_INCOMPLETE_INPUT.
+       (ucs4le_internal_loop): Likewise.
+       (ucs4le_internal_loop_unaligned): Likewise.
+       * iconvdata/unicode.c (PREPARE_LOOP): Likewise.
+       * iconvdata/utf-16.c (PREPARE_LOOP): Likewise.
+       * iconvdata/utf-32.c (PREPARE_LOOP): Likewise.
+
+       * iconv/loop.c (LOOPFCT): First test for empty input then for full
+       output buffer.
+
        * inet/getnameinfo.c: Use extend_alloca where appropriate.
        * sysdeps/posix/getaddrinfo.c: Likewise.
 
index fbdac832e081813e96307e4d7ed12112a589efbd..35346aa4987efbc742d47ea7abea1c2cde2f1b56 100644 (file)
@@ -489,12 +489,15 @@ internal_ucs4le_loop_unaligned (struct __gconv_step *step,
 # endif
 
   /* Determine the status.  */
-  if (*inptrp + 4 > inend)
+  if (*inptrp == inend)
     result = __GCONV_EMPTY_INPUT;
-  else if (*outptrp + 4 > outend)
-    result = __GCONV_FULL_OUTPUT;
-  else
+  else if (*inptrp + 4 > inend)
     result = __GCONV_INCOMPLETE_INPUT;
+  else
+    {
+      assert (*outptrp + 4 > outend);
+      result = __GCONV_FULL_OUTPUT;
+    }
 
   return result;
 }
@@ -609,10 +612,13 @@ ucs4le_internal_loop (struct __gconv_step *step,
   /* Determine the status.  */
   if (*inptrp == inend)
     result = __GCONV_EMPTY_INPUT;
-  else if (*outptrp + 4 > outend)
-    result = __GCONV_FULL_OUTPUT;
-  else
+  else if (*inptrp + 4 > inend)
     result = __GCONV_INCOMPLETE_INPUT;
+  else
+    {
+      assert (*outptrp + 4 > outend);
+      result = __GCONV_FULL_OUTPUT;
+    }
 
   return result;
 }
@@ -678,10 +684,13 @@ ucs4le_internal_loop_unaligned (struct __gconv_step *step,
   /* Determine the status.  */
   if (*inptrp == inend)
     result = __GCONV_EMPTY_INPUT;
-  else if (*outptrp + 4 > outend)
-    result = __GCONV_FULL_OUTPUT;
-  else
+  else if (*inptrp + 4 > inend)
     result = __GCONV_INCOMPLETE_INPUT;
+  else
+    {
+      assert (*outptrp + 4 > outend);
+      result = __GCONV_FULL_OUTPUT;
+    }
 
   return result;
 }
index 2fb73da7ea43b8833a10bdd8b2e41ea59dd1eff7..deb01739300eb0263bda5df78fe6f86182bb6631 100644 (file)
@@ -282,6 +282,14 @@ FCTNAME (LOOPFCT) (struct __gconv_step *step,
       /* `if' cases for MIN_NEEDED_OUTPUT ==/!= 1 is made to help the
         compiler generating better code.  They will be optimized away
         since MIN_NEEDED_OUTPUT is always a constant.  */
+      if (MIN_NEEDED_INPUT > 1
+         && __builtin_expect (inptr + MIN_NEEDED_INPUT > inend, 0))
+       {
+         /* We don't have enough input for another complete input
+            character.  */
+         result = __GCONV_INCOMPLETE_INPUT;
+         break;
+       }
       if ((MIN_NEEDED_OUTPUT != 1
           && __builtin_expect (outptr + MIN_NEEDED_OUTPUT > outend, 0))
          || (MIN_NEEDED_OUTPUT == 1
@@ -291,14 +299,6 @@ FCTNAME (LOOPFCT) (struct __gconv_step *step,
          result = __GCONV_FULL_OUTPUT;
          break;
        }
-      if (MIN_NEEDED_INPUT > 1
-         && __builtin_expect (inptr + MIN_NEEDED_INPUT > inend, 0))
-       {
-         /* We don't have enough input for another complete input
-            character.  */
-         result = __GCONV_INCOMPLETE_INPUT;
-         break;
-       }
 
       /* Here comes the body the user provides.  It can stop with
         RESULT set to GCONV_INCOMPLETE_INPUT (if the size of the
index c88f75dd857be62b928b489220c010bbf9bd91a7..df452d2a1d27b18da061b484a154e6a3abcdc13a 100644 (file)
@@ -49,7 +49,8 @@
        {                                                                     \
          /* We have to find out which byte order the file is encoded in.  */ \
          if (inptr + 2 > inend)                                              \
-           return __GCONV_EMPTY_INPUT;                                       \
+           return (inptr == inend                                            \
+                   ? __GCONV_EMPTY_INPUT : __GCONV_INCOMPLETE_INPUT);        \
                                                                              \
          if (get16u (inptr) == BOM)                                          \
            /* Simply ignore the BOM character.  */                           \
index 642340611d287e6c9f01e707bb62ed6d215b3b1f..b8165088e137e6f70cf548e3a4a3f916e7cff93e 100644 (file)
@@ -51,7 +51,8 @@
        {                                                                     \
          /* We have to find out which byte order the file is encoded in.  */ \
          if (inptr + 2 > inend)                                              \
-           return __GCONV_EMPTY_INPUT;                                       \
+           return (inptr == inend                                            \
+                   ? __GCONV_EMPTY_INPUT : __GCONV_INCOMPLETE_INPUT);        \
                                                                              \
          if (get16u (inptr) == BOM)                                          \
            /* Simply ignore the BOM character.  */                           \
index 01f4b881dc2213f1df08748af1b725b2002cdbca..cc02651374bd04bd76586e02c0ce1dd47f26e8d8 100644 (file)
@@ -49,7 +49,8 @@
        {                                                                     \
          /* We have to find out which byte order the file is encoded in.  */ \
          if (inptr + 4 > inend)                                              \
-           return __GCONV_EMPTY_INPUT;                                       \
+           return (inptr == inend                                            \
+                   ? __GCONV_EMPTY_INPUT : __GCONV_INCOMPLETE_INPUT);        \
                                                                              \
          if (get32u (inptr) == BOM)                                          \
            /* Simply ignore the BOM character.  */                           \
index 3ba4bde25e282bf2a070e5cb8a1882822a0f14cd..4af40f92ad9af681dece29c283806da14b187c92 100644 (file)
@@ -270,7 +270,7 @@ gaih_inet_serv (const char *servicename, const struct gaih_typeproto *tp,
   int i, herrno;                                               \
   size_t tmpbuflen;                                            \
   struct hostent th;                                           \
-  char *tmpbuf = NULL;                                                 \
+  char *tmpbuf = NULL;                                         \
   tmpbuflen = 512;                                             \
   no_data = 0;                                                 \
   do {                                                         \
This page took 0.051234 seconds and 5 git commands to generate.