Commit 00da503f authored by Bruno Haible's avatar Bruno Haible

Various fixes.

parent f67b37c4
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
......
......@@ -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;
......
/* 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 ();
}
......
/* 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 ();
}
......
/* 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 ();
}
......
/* 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 ();
}
......
......@@ -6,6 +6,7 @@ lib/unistr/u16-to-u32.c
Depends-on:
unistr/base
unistr/u16-mbtouc-safe
configure.ac:
......
......@@ -6,6 +6,8 @@ lib/unistr/u16-to-u8.c
Depends-on:
unistr/base
unistr/u16-mbtouc-safe
unistr/u8-uctomb
configure.ac:
......
......@@ -6,6 +6,7 @@ lib/unistr/u32-to-u16.c
Depends-on:
unistr/base
unistr/u16-uctomb
configure.ac:
......
......@@ -6,6 +6,7 @@ lib/unistr/u32-to-u8.c
Depends-on:
unistr/base
unistr/u8-uctomb
configure.ac:
......
......@@ -6,6 +6,8 @@ lib/unistr/u8-to-u16.c
Depends-on:
unistr/base
unistr/u8-mbtouc-safe
unistr/u16-uctomb
configure.ac:
......
......@@ -6,6 +6,7 @@ lib/unistr/u8-to-u32.c
Depends-on:
unistr/base
unistr/u8-mbtouc-safe
configure.ac:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment