Various fixes.
authorBruno Haible <bruno@clisp.org>
Fri, 26 Jan 2007 02:59:46 +0000 (02:59 +0000)
committerBruno Haible <bruno@clisp.org>
Fri, 26 Jan 2007 02:59:46 +0000 (02:59 +0000)
12 files changed:
ChangeLog
lib/striconveh.c
lib/unistr/u16-to-u8.c
lib/unistr/u32-to-u16.c
lib/unistr/u32-to-u8.c
lib/unistr/u8-to-u16.c
modules/unistr/u16-to-u32
modules/unistr/u16-to-u8
modules/unistr/u32-to-u16
modules/unistr/u32-to-u8
modules/unistr/u8-to-u16
modules/unistr/u8-to-u32

index 33b079b..5e1e74a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2007-01-25  Bruno Haible  <bruno@clisp.org>
+
+       * lib/striconveh.c (mem_cd_iconveh_internal): Ignore *lengthp if
+       *resultp is 0.
+
+       * lib/unistr/u16-to-u8.c (u16_to_u8): Fix u8_uctomb invocation.
+       * lib/unistr/u32-to-u8.c (u32_to_u8): Likewise.
+       * lib/unistr/u8-to-u16.c (u8_to_u16): Fix u16_uctomb invocation.
+       * lib/unistr/u32-to-u16.c (u32_to_u16): Likewise.
+
+       * modules/unistr/u8-to-u16 (Depends-on): Add missing modules.
+       * modules/unistr/u8-to-u32 (Depends-on): Add missing modules.
+       * modules/unistr/u16-to-u8 (Depends-on): Add missing modules.
+       * modules/unistr/u16-to-u32 (Depends-on): Add missing modules.
+       * modules/unistr/u32-to-u8 (Depends-on): Add missing modules.
+       * modules/unistr/u32-to-u16 (Depends-on): Add missing modules.
+
 2007-01-24  Bruno Haible  <bruno@clisp.org>
 
        Don't AC_REQUIRE autoconf macros that invoke AC_LIBOBJ. See
index c1ef0b1..191598b 100644 (file)
@@ -201,7 +201,7 @@ mem_cd_iconveh_internal (const char *src, size_t srclen,
   size_t length;
   size_t last_length = (size_t)(-1); /* only needed if offsets != NULL */
 
-  if (*lengthp >= sizeof (tmpbuf))
+  if (*resultp != NULL && *lengthp >= sizeof (tmpbuf))
     {
       initial_result = *resultp;
       allocated = *lengthp;
index c88db79..484af1a 100644 (file)
@@ -1,5 +1,5 @@
 /* Convert UTF-16 string to UTF-8 string.
-   Copyright (C) 2002, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2002.
 
    This program is free software; you can redistribute it and/or modify it
@@ -71,7 +71,7 @@ FUNC (const SRC_UNIT *s, size_t n, DST_UNIT *resultbuf, size_t *lengthp)
       s += count;
 
       /* Store it in the output string.  */
-      count = u8_uctomb (result, uc, allocated - length);
+      count = u8_uctomb (result + length, uc, allocated - length);
       if (count == -1)
        {
          if (!(result == resultbuf || result == NULL))
@@ -103,7 +103,7 @@ FUNC (const SRC_UNIT *s, size_t n, DST_UNIT *resultbuf, size_t *lengthp)
            memcpy ((char *) memory, (char *) result,
                    length * sizeof (DST_UNIT));
          result = memory;
-         count = u8_uctomb (result, uc, allocated - length);
+         count = u8_uctomb (result + length, uc, allocated - length);
          if (count < 0)
            abort ();
        }
index fe2a96a..285c9bf 100644 (file)
@@ -1,5 +1,5 @@
 /* Convert UTF-32 string to UTF-16 string.
-   Copyright (C) 2002, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2002.
 
    This program is free software; you can redistribute it and/or modify it
@@ -65,7 +65,7 @@ FUNC (const SRC_UNIT *s, size_t n, DST_UNIT *resultbuf, size_t *lengthp)
         u16_uctomb will verify uc anyway.  */
 
       /* Store it in the output string.  */
-      count = u16_uctomb (result, uc, allocated - length);
+      count = u16_uctomb (result + length, uc, allocated - length);
       if (count == -1)
        {
          if (!(result == resultbuf || result == NULL))
@@ -97,7 +97,7 @@ FUNC (const SRC_UNIT *s, size_t n, DST_UNIT *resultbuf, size_t *lengthp)
            memcpy ((char *) memory, (char *) result,
                    length * sizeof (DST_UNIT));
          result = memory;
-         count = u16_uctomb (result, uc, allocated - length);
+         count = u16_uctomb (result + length, uc, allocated - length);
          if (count < 0)
            abort ();
        }
index c714a50..df75b44 100644 (file)
@@ -1,5 +1,5 @@
 /* Convert UTF-32 string to UTF-8 string.
-   Copyright (C) 2002, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2002.
 
    This program is free software; you can redistribute it and/or modify it
@@ -65,7 +65,7 @@ FUNC (const SRC_UNIT *s, size_t n, DST_UNIT *resultbuf, size_t *lengthp)
         u8_uctomb will verify uc anyway.  */
 
       /* Store it in the output string.  */
-      count = u8_uctomb (result, uc, allocated - length);
+      count = u8_uctomb (result + length, uc, allocated - length);
       if (count == -1)
        {
          if (!(result == resultbuf || result == NULL))
@@ -97,7 +97,7 @@ FUNC (const SRC_UNIT *s, size_t n, DST_UNIT *resultbuf, size_t *lengthp)
            memcpy ((char *) memory, (char *) result,
                    length * sizeof (DST_UNIT));
          result = memory;
-         count = u8_uctomb (result, uc, allocated - length);
+         count = u8_uctomb (result + length, uc, allocated - length);
          if (count < 0)
            abort ();
        }
index 941db54..ac4211b 100644 (file)
@@ -1,5 +1,5 @@
 /* Convert UTF-8 string to UTF-16 string.
-   Copyright (C) 2002, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2002.
 
    This program is free software; you can redistribute it and/or modify it
@@ -71,7 +71,7 @@ FUNC (const SRC_UNIT *s, size_t n, DST_UNIT *resultbuf, size_t *lengthp)
       s += count;
 
       /* Store it in the output string.  */
-      count = u16_uctomb (result, uc, allocated - length);
+      count = u16_uctomb (result + length, uc, allocated - length);
       if (count == -1)
        {
          if (!(result == resultbuf || result == NULL))
@@ -103,7 +103,7 @@ FUNC (const SRC_UNIT *s, size_t n, DST_UNIT *resultbuf, size_t *lengthp)
            memcpy ((char *) memory, (char *) result,
                    length * sizeof (DST_UNIT));
          result = memory;
-         count = u16_uctomb (result, uc, allocated - length);
+         count = u16_uctomb (result + length, uc, allocated - length);
          if (count < 0)
            abort ();
        }
index 0ba190e..a77325c 100644 (file)
@@ -6,6 +6,7 @@ lib/unistr/u16-to-u32.c
 
 Depends-on:
 unistr/base
+unistr/u16-mbtouc-safe
 
 configure.ac:
 
index 554dc56..3de0a8b 100644 (file)
@@ -6,6 +6,8 @@ lib/unistr/u16-to-u8.c
 
 Depends-on:
 unistr/base
+unistr/u16-mbtouc-safe
+unistr/u8-uctomb
 
 configure.ac:
 
index aaa90f2..6840041 100644 (file)
@@ -6,6 +6,7 @@ lib/unistr/u32-to-u16.c
 
 Depends-on:
 unistr/base
+unistr/u16-uctomb
 
 configure.ac:
 
index 0e56371..a5ace26 100644 (file)
@@ -6,6 +6,7 @@ lib/unistr/u32-to-u8.c
 
 Depends-on:
 unistr/base
+unistr/u8-uctomb
 
 configure.ac:
 
index 8dcd998..b50d919 100644 (file)
@@ -6,6 +6,8 @@ lib/unistr/u8-to-u16.c
 
 Depends-on:
 unistr/base
+unistr/u8-mbtouc-safe
+unistr/u16-uctomb
 
 configure.ac:
 
index 97ff27c..be2e05a 100644 (file)
@@ -6,6 +6,7 @@ lib/unistr/u8-to-u32.c
 
 Depends-on:
 unistr/base
+unistr/u8-mbtouc-safe
 
 configure.ac: