From 00da503f0eb41eae7b4bcfd2c539faf50d946695 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Fri, 26 Jan 2007 02:59:46 +0000 Subject: [PATCH] Various fixes. --- ChangeLog | 17 +++++++++++++++++ lib/striconveh.c | 2 +- lib/unistr/u16-to-u8.c | 6 +++--- lib/unistr/u32-to-u16.c | 6 +++--- lib/unistr/u32-to-u8.c | 6 +++--- lib/unistr/u8-to-u16.c | 6 +++--- modules/unistr/u16-to-u32 | 1 + modules/unistr/u16-to-u8 | 2 ++ modules/unistr/u32-to-u16 | 1 + modules/unistr/u32-to-u8 | 1 + modules/unistr/u8-to-u16 | 2 ++ modules/unistr/u8-to-u32 | 1 + 12 files changed, 38 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 33b079b2b1..5e1e74a96c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2007-01-25 Bruno Haible + + * 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 Don't AC_REQUIRE autoconf macros that invoke AC_LIBOBJ. See diff --git a/lib/striconveh.c b/lib/striconveh.c index c1ef0b1fd1..191598b84e 100644 --- a/lib/striconveh.c +++ b/lib/striconveh.c @@ -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; diff --git a/lib/unistr/u16-to-u8.c b/lib/unistr/u16-to-u8.c index c88db79607..484af1ac3f 100644 --- 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 , 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 (); } diff --git a/lib/unistr/u32-to-u16.c b/lib/unistr/u32-to-u16.c index fe2a96aabd..285c9bfbc1 100644 --- 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 , 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 (); } diff --git a/lib/unistr/u32-to-u8.c b/lib/unistr/u32-to-u8.c index c714a50ac0..df75b44dcd 100644 --- 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 , 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 (); } diff --git a/lib/unistr/u8-to-u16.c b/lib/unistr/u8-to-u16.c index 941db5472f..ac4211b280 100644 --- 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 , 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 (); } diff --git a/modules/unistr/u16-to-u32 b/modules/unistr/u16-to-u32 index 0ba190e543..a77325cad2 100644 --- a/modules/unistr/u16-to-u32 +++ b/modules/unistr/u16-to-u32 @@ -6,6 +6,7 @@ lib/unistr/u16-to-u32.c Depends-on: unistr/base +unistr/u16-mbtouc-safe configure.ac: diff --git a/modules/unistr/u16-to-u8 b/modules/unistr/u16-to-u8 index 554dc569db..3de0a8b440 100644 --- a/modules/unistr/u16-to-u8 +++ b/modules/unistr/u16-to-u8 @@ -6,6 +6,8 @@ lib/unistr/u16-to-u8.c Depends-on: unistr/base +unistr/u16-mbtouc-safe +unistr/u8-uctomb configure.ac: diff --git a/modules/unistr/u32-to-u16 b/modules/unistr/u32-to-u16 index aaa90f20a9..6840041cde 100644 --- a/modules/unistr/u32-to-u16 +++ b/modules/unistr/u32-to-u16 @@ -6,6 +6,7 @@ lib/unistr/u32-to-u16.c Depends-on: unistr/base +unistr/u16-uctomb configure.ac: diff --git a/modules/unistr/u32-to-u8 b/modules/unistr/u32-to-u8 index 0e56371a45..a5ace26098 100644 --- a/modules/unistr/u32-to-u8 +++ b/modules/unistr/u32-to-u8 @@ -6,6 +6,7 @@ lib/unistr/u32-to-u8.c Depends-on: unistr/base +unistr/u8-uctomb configure.ac: diff --git a/modules/unistr/u8-to-u16 b/modules/unistr/u8-to-u16 index 8dcd99804f..b50d91975b 100644 --- a/modules/unistr/u8-to-u16 +++ b/modules/unistr/u8-to-u16 @@ -6,6 +6,8 @@ lib/unistr/u8-to-u16.c Depends-on: unistr/base +unistr/u8-mbtouc-safe +unistr/u16-uctomb configure.ac: diff --git a/modules/unistr/u8-to-u32 b/modules/unistr/u8-to-u32 index 97ff27c2ef..be2e05aabe 100644 --- a/modules/unistr/u8-to-u32 +++ b/modules/unistr/u8-to-u32 @@ -6,6 +6,7 @@ lib/unistr/u8-to-u32.c Depends-on: unistr/base +unistr/u8-mbtouc-safe configure.ac: -- 2.30.2