changeset 7943:72ebc68d77bf

Various fixes.
author Bruno Haible <bruno@clisp.org>
date Fri, 26 Jan 2007 02:59:46 +0000
parents 9b53e406b401
children a1d177cd9523
files 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
diffstat 12 files changed, 38 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- 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
--- a/lib/striconveh.c
+++ b/lib/striconveh.c
@@ -201,7 +201,7 @@
   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;
--- a/lib/unistr/u16-to-u8.c
+++ b/lib/unistr/u16-to-u8.c
@@ -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 @@
       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 @@
 	    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 ();
 	}
--- a/lib/unistr/u32-to-u16.c
+++ b/lib/unistr/u32-to-u16.c
@@ -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 @@
 	 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 @@
 	    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 ();
 	}
--- a/lib/unistr/u32-to-u8.c
+++ b/lib/unistr/u32-to-u8.c
@@ -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 @@
 	 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 @@
 	    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 ();
 	}
--- a/lib/unistr/u8-to-u16.c
+++ b/lib/unistr/u8-to-u16.c
@@ -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 @@
       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 @@
 	    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 ();
 	}
--- a/modules/unistr/u16-to-u32
+++ b/modules/unistr/u16-to-u32
@@ -6,6 +6,7 @@
 
 Depends-on:
 unistr/base
+unistr/u16-mbtouc-safe
 
 configure.ac:
 
--- a/modules/unistr/u16-to-u8
+++ b/modules/unistr/u16-to-u8
@@ -6,6 +6,8 @@
 
 Depends-on:
 unistr/base
+unistr/u16-mbtouc-safe
+unistr/u8-uctomb
 
 configure.ac:
 
--- a/modules/unistr/u32-to-u16
+++ b/modules/unistr/u32-to-u16
@@ -6,6 +6,7 @@
 
 Depends-on:
 unistr/base
+unistr/u16-uctomb
 
 configure.ac:
 
--- a/modules/unistr/u32-to-u8
+++ b/modules/unistr/u32-to-u8
@@ -6,6 +6,7 @@
 
 Depends-on:
 unistr/base
+unistr/u8-uctomb
 
 configure.ac:
 
--- a/modules/unistr/u8-to-u16
+++ b/modules/unistr/u8-to-u16
@@ -6,6 +6,8 @@
 
 Depends-on:
 unistr/base
+unistr/u8-mbtouc-safe
+unistr/u16-uctomb
 
 configure.ac:
 
--- a/modules/unistr/u8-to-u32
+++ b/modules/unistr/u8-to-u32
@@ -6,6 +6,7 @@
 
 Depends-on:
 unistr/base
+unistr/u8-mbtouc-safe
 
 configure.ac: