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 33b079b2b1c1bcf7d997a173d7c3afdefa226a0d..5e1e74a96c2ec66af4aa5ed6ff5e29694eea8f75 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 c1ef0b1fd121c52f6bc7a6fba4483ab7c31ffd3f..191598b84e2d97aac76297bbd1b70a70ebd8e375 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 c88db796072ba0855dd9d9c05de747fb5cfe05e5..484af1ac3fcd9420b0fd23dd13c9d217ff33c2be 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 fe2a96aabd872938cf6f697ef123ceeef1fa4bb9..285c9bfbc1f78d22524252b1a20ded37a9a50e0f 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 c714a50ac05d2a698d94d40f196953561d1d3a5a..df75b44dcdf4da3dfb29647117ca011e6e93afb0 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 941db5472fa57e44a705f7fdcf1631102ed3114c..ac4211b28007cd278e0e71ab4f37899bbee67b81 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 0ba190e543de9ee3f848807815c398bf31fb090f..a77325cad22d8e472abe1aa33e6f0860bf320dd9 100644 (file)
@@ -6,6 +6,7 @@ lib/unistr/u16-to-u32.c
 
 Depends-on:
 unistr/base
+unistr/u16-mbtouc-safe
 
 configure.ac:
 
index 554dc569dbf67aebd598720c97369a16328c605c..3de0a8b440abf0cce89d6658761c8ab4a4e85040 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 aaa90f20a9e626e34bd52a2a0801e88f456c7796..6840041cde7c1a56eabfa1a3bd5fd243fdb2b408 100644 (file)
@@ -6,6 +6,7 @@ lib/unistr/u32-to-u16.c
 
 Depends-on:
 unistr/base
+unistr/u16-uctomb
 
 configure.ac:
 
index 0e56371a45a099b8c47d9312da31ef01900d2a44..a5ace2609889af2e25db0c5bb5b12e6d00fcc5ba 100644 (file)
@@ -6,6 +6,7 @@ lib/unistr/u32-to-u8.c
 
 Depends-on:
 unistr/base
+unistr/u8-uctomb
 
 configure.ac:
 
index 8dcd99804f1ee24f89355c030b1d4daa1583b297..b50d91975bf44533b389e3c65ae750038567a39a 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 97ff27c2efeced289ee0d362685a93c856cac4f4..be2e05aabe51cded71ddda09c3899c20647187e9 100644 (file)
@@ -6,6 +6,7 @@ lib/unistr/u8-to-u32.c
 
 Depends-on:
 unistr/base
+unistr/u8-mbtouc-safe
 
 configure.ac: