+2009-04-26 Bruno Haible <bruno@clisp.org>
+
+ Simplify calling convention of u*_conv_from_encoding.
+ * lib/uniconv.h (u8_conv_from_encoding, u16_conv_from_encoding,
+ u32_conv_from_encoding): Expect a resultbuf argument and return the
+ result directly as a pointer.
+ * lib/uniconv/u8-conv-from-enc.c (u8_conv_from_encoding): Likewise.
+ * lib/uniconv/u-conv-from-enc.h (FUNC): Likewise.
+ * lib/uniconv/u-strconv-from-enc.h (FUNC): Update.
+ * lib/unicase/ulc-casecmp.c (ulc_u8_casefold): Update.
+ * lib/unicase/ulc-casexfrm.c (ulc_casexfrm): Update.
+ * lib/unilbrk/ulc-possible-linebreaks.c (ulc_possible_linebreaks):
+ Update.
+ * lib/unilbrk/ulc-width-linebreaks.c (ulc_width_linebreaks): Update.
+ * lib/uniwbrk/ulc-wordbreaks.c (ulc_wordbreaks): Update.
+ * lib/vasnprintf.c (VASNPRINTF): Update.
+ * tests/uniconv/test-u8-conv-from-enc.c (main): Update.
+ * tests/uniconv/test-u16-conv-from-enc.c (main): Update.
+ * tests/uniconv/test-u32-conv-from-enc.c (main): Update.
+ * NEWS: Mention the change.
+
2009-04-26 Bruno Haible <bruno@clisp.org>
Simplify calling convention of u*_conv_to_encoding.
Date Modules Changes
+2009-04-26 modules/uniconv/u8-conv-from-enc
+ modules/uniconv/u16-conv-from-enc
+ modules/uniconv/u32-conv-from-enc
+ The calling convention of the functions
+ u*_conv_from_encoding is changed.
+
2009-04-26 modules/uniconv/u8-conv-to-enc
modules/uniconv/u16-conv-to-enc
modules/uniconv/u32-conv-to-enc
uint8_t *result;
/* Convert the string to UTF-8. */
- conv = convbuf;
conv_length = sizeof (convbuf) / sizeof (uint8_t);
- if (u8_conv_from_encoding (locale_charset (), iconveh_error, s, n, NULL,
- &conv, &conv_length) < 0)
+ conv =
+ u8_conv_from_encoding (locale_charset (), iconveh_error, s, n, NULL,
+ convbuf, &conv_length);
+ if (conv == NULL)
/* errno is set here. */
return NULL;
char *result;
/* Convert the string to UTF-8. */
- conv = convbuf;
conv_length = sizeof (convbuf) / sizeof (uint8_t);
- if (u8_conv_from_encoding (locale_charset (), iconveh_error, s, n, NULL,
- &conv, &conv_length) < 0)
+ conv =
+ u8_conv_from_encoding (locale_charset (), iconveh_error, s, n, NULL,
+ convbuf, &conv_length);
+ if (conv == NULL)
/* errno is set here. */
return NULL;
or *RESULTP can initially be NULL.
May erase the contents of the memory at *RESULTP.
Return value: 0 if successful, otherwise -1 and errno set.
- If successful: The resulting string is stored in *RESULTP and its length
- in *LENGTHP. *RESULTP is set to a freshly allocated memory block, or is
- unchanged if no dynamic memory allocation was necessary.
- Particular errno values: EINVAL, EILSEQ, ENOMEM. */
-extern int
+ If successful: The resulting Unicode string (non-NULL) is returned and its
+ length stored in *LENGTHP. The resulting string is RESULTBUF if no dynamic
+ memory allocation was necessary, or a freshly allocated memory block
+ otherwise.
+ In case of error: NULL is returned and errno is set. Particular errno
+ values: EINVAL, EILSEQ, ENOMEM. */
+extern uint8_t *
u8_conv_from_encoding (const char *fromcode,
enum iconv_ilseq_handler handler,
const char *src, size_t srclen,
size_t *offsets,
- uint8_t **resultp, size_t *lengthp);
-extern int
+ uint8_t *resultbuf, size_t *lengthp);
+extern uint16_t *
u16_conv_from_encoding (const char *fromcode,
enum iconv_ilseq_handler handler,
const char *src, size_t srclen,
size_t *offsets,
- uint16_t **resultp, size_t *lengthp);
-extern int
+ uint16_t *resultbuf, size_t *lengthp);
+extern uint32_t *
u32_conv_from_encoding (const char *fromcode,
enum iconv_ilseq_handler handler,
const char *src, size_t srclen,
size_t *offsets,
- uint32_t **resultp, size_t *lengthp);
+ uint32_t *resultbuf, size_t *lengthp);
/* Converts an entire Unicode string, possibly including NUL units, from a
Unicode encoding to a given encoding.
/* Conversion to UTF-16/UTF-32 from legacy encodings.
- Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006-2007, 2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-int
+UNIT *
FUNC (const char *fromcode,
enum iconv_ilseq_handler handler,
const char *src, size_t srclen,
size_t *offsets,
- UNIT **resultp, size_t *lengthp)
+ UNIT *resultbuf, size_t *lengthp)
{
#if HAVE_UTF_NAME
- size_t length;
+ char *result = (char *) resultbuf;
+ size_t length = *lengthp * sizeof (UNIT);
if (mem_iconveha (src, srclen, fromcode, UTF_NAME, true, handler,
- offsets, (char **) resultp, &length) < 0)
- return -1;
+ offsets, &result, &length) < 0)
+ return NULL;
if (offsets != NULL)
{
/* Convert 'char *' offsets to 'UNIT *' offsets. */
if ((length % sizeof (UNIT)) != 0)
abort ();
*lengthp = length / sizeof (UNIT);
- return 0;
+ return (UNIT *) result;
#else
- uint8_t *utf8_string = NULL;
- size_t utf8_length = 0;
+ uint8_t *utf8_string;
+ size_t utf8_length;
UNIT *result;
- if (u8_conv_from_encoding (fromcode, handler, src, srclen, offsets,
- &utf8_string, &utf8_length) < 0)
- return -1;
+ utf8_string =
+ u8_conv_from_encoding (fromcode, handler, src, srclen, offsets,
+ NULL, &utf8_length);
if (utf8_string == NULL)
- {
- *lengthp = 0;
- return 0;
- }
- result = U8_TO_U (utf8_string, utf8_length, *resultp, lengthp);
+ return NULL;
+ result = U8_TO_U (utf8_string, utf8_length, resultbuf, lengthp);
if (result == NULL)
{
int saved_errno = errno;
free (utf8_string);
errno = saved_errno;
- return -1;
+ return NULL;
}
if (offsets != NULL)
{
}
}
free (utf8_string);
- *resultp = result;
- return 0;
+ return result;
#endif
}
/* Conversion to UTF-8/UTF-16/UTF-32 from legacy encodings.
- Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006-2007, 2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
const char *fromcode,
enum iconv_ilseq_handler handler)
{
- UNIT *result = NULL;
- size_t length = 0;
+ UNIT *result;
+ size_t length;
- if (U_CONV_FROM_ENCODING (fromcode, handler,
- string, strlen (string) + 1, NULL,
- &result, &length) < 0)
+ result =
+ U_CONV_FROM_ENCODING (fromcode, handler,
+ string, strlen (string) + 1, NULL,
+ NULL, &length);
+ if (result == NULL)
return NULL;
/* Verify the result has exactly one NUL unit, at the end. */
if (!(length > 0 && result[length-1] == 0
#include "striconveha.h"
#include "unistr.h"
-int
+uint8_t *
u8_conv_from_encoding (const char *fromcode,
enum iconv_ilseq_handler handler,
const char *src, size_t srclen,
size_t *offsets,
- uint8_t **resultp, size_t *lengthp)
+ uint8_t *resultbuf, size_t *lengthp)
{
if (STRCASEEQ (fromcode, "UTF-8", 'U','T','F','-','8',0,0,0,0))
{
if (u8_check ((const uint8_t *) src, srclen))
{
errno = EILSEQ;
- return -1;
+ return NULL;
}
if (offsets != NULL)
}
/* Memory allocation. */
- if ((*resultp != NULL && *lengthp >= srclen) || srclen == 0)
- result = *resultp;
+ if (resultbuf != NULL && *lengthp >= srclen)
+ result = resultbuf;
else
{
- result = (uint8_t *) malloc (srclen);
+ result = (uint8_t *) malloc (srclen > 0 ? srclen : 1);
if (result == NULL)
{
errno = ENOMEM;
- return -1;
+ return NULL;
}
}
memcpy ((char *) result, src, srclen);
- *resultp = result;
*lengthp = srclen;
- return 0;
+ return result;
}
else
- return mem_iconveha (src, srclen, fromcode, "UTF-8", true, handler,
- offsets, (char **) resultp, lengthp);
+ {
+ char *result = (char *) resultbuf;
+ size_t length = *lengthp;
+
+ if (mem_iconveha (src, srclen, fromcode, "UTF-8", true, handler,
+ offsets, &result, &length) < 0)
+ return NULL;
+
+ if (result == NULL) /* when (resultbuf == NULL && length == 0) */
+ {
+ result = (char *) malloc (1);
+ if (result == NULL)
+ {
+ errno = ENOMEM;
+ return NULL;
+ }
+ }
+ *lengthp = length;
+ return (uint8_t *) result;
+ }
}
if (offsets != NULL)
{
- uint8_t *t = NULL;
+ uint8_t *t;
size_t m;
- if (u8_conv_from_encoding (encoding, iconveh_question_mark,
- s, n, offsets, &t, &m)
- == 0)
+
+ t = u8_conv_from_encoding (encoding, iconveh_question_mark,
+ s, n, offsets, NULL, &m);
+ if (t != NULL)
{
char *q = (char *) (m > 0 ? malloc (m) : NULL);
if (offsets != NULL)
{
- uint8_t *t = NULL;
+ uint8_t *t;
size_t m;
- if (u8_conv_from_encoding (encoding, iconveh_question_mark,
- s, n, offsets, &t, &m)
- == 0)
+
+ t = u8_conv_from_encoding (encoding, iconveh_question_mark,
+ s, n, offsets, NULL, &m);
+ if (t != NULL)
{
char *memory =
(char *) (m > 0 ? malloc (m + (o != NULL ? m : 0)) : NULL);
if (offsets != NULL)
{
- uint8_t *t = NULL;
+ uint8_t *t;
size_t m;
- if (u8_conv_from_encoding (encoding, iconveh_question_mark,
- s, n, offsets, &t, &m)
- == 0)
+
+ t = u8_conv_from_encoding (encoding, iconveh_question_mark,
+ s, n, offsets, NULL, &m);
+ if (t != NULL)
{
char *q = (char *) (m > 0 ? malloc (m) : NULL);
}
/* Convert from TCHAR_T[] to DCHAR_T[]. */
- tmpdst = NULL;
- tmpdst_len = 0;
- if (DCHAR_CONV_FROM_ENCODING (locale_charset (),
- iconveh_question_mark,
- tmpsrc, characters,
- NULL,
- &tmpdst, &tmpdst_len)
- < 0)
+ tmpdst =
+ DCHAR_CONV_FROM_ENCODING (locale_charset (),
+ iconveh_question_mark,
+ tmpsrc, characters,
+ NULL,
+ NULL, &tmpdst_len);
+ if (tmpdst == NULL)
{
int saved_errno = errno;
free (tmpsrc);
# else
tmpsrc = tmp;
# endif
- tmpdst = NULL;
- tmpdst_len = 0;
- if (DCHAR_CONV_FROM_ENCODING (locale_charset (),
- iconveh_question_mark,
- tmpsrc, count,
- NULL,
- &tmpdst, &tmpdst_len)
- < 0)
+ tmpdst =
+ DCHAR_CONV_FROM_ENCODING (locale_charset (),
+ iconveh_question_mark,
+ tmpsrc, count,
+ NULL,
+ NULL, &tmpdst_len);
+ if (tmpdst == NULL)
{
int saved_errno = errno;
if (!(result == resultbuf || result == NULL))
/* Test of conversion to UTF-16 from legacy encodings.
- Copyright (C) 2007-2008 Free Software Foundation, Inc.
+ Copyright (C) 2007-2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
for (o = 0; o < 2; o++)
{
size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
- uint16_t *result = NULL;
- size_t length = 0;
- int retval = u16_conv_from_encoding ("ISO-8859-1", handler,
- input, strlen (input),
- offsets,
- &result, &length);
- ASSERT (retval == 0);
+ size_t length;
+ uint16_t *result = u16_conv_from_encoding ("ISO-8859-1", handler,
+ input, strlen (input),
+ offsets,
+ NULL, &length);
+ ASSERT (result != NULL);
ASSERT (length == SIZEOF (expected));
- ASSERT (result != NULL && u16_cmp (result, expected, SIZEOF (expected)) == 0);
+ ASSERT (u16_cmp (result, expected, SIZEOF (expected)) == 0);
if (o)
{
for (i = 0; i < 37; i++)
for (o = 0; o < 2; o++)
{
size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
- uint16_t *result = NULL;
- size_t length = 0;
- int retval = u16_conv_from_encoding ("ISO-8859-2", handler,
- input, strlen (input),
- offsets,
- &result, &length);
- ASSERT (retval == 0);
+ size_t length;
+ uint16_t *result = u16_conv_from_encoding ("ISO-8859-2", handler,
+ input, strlen (input),
+ offsets,
+ NULL, &length);
+ ASSERT (result != NULL);
ASSERT (length == SIZEOF (expected));
- ASSERT (result != NULL && u16_cmp (result, expected, SIZEOF (expected)) == 0);
+ ASSERT (u16_cmp (result, expected, SIZEOF (expected)) == 0);
if (o)
{
for (i = 0; i < 16; i++)
for (o = 0; o < 2; o++)
{
size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
- uint16_t *result = NULL;
- size_t length = 0;
- int retval = u16_conv_from_encoding ("autodetect_jp", handler,
- input, strlen (input),
- offsets,
- &result, &length);
- ASSERT (retval == 0);
+ size_t length;
+ uint16_t *result = u16_conv_from_encoding ("autodetect_jp", handler,
+ input, strlen (input),
+ offsets,
+ NULL, &length);
+ ASSERT (result != NULL);
ASSERT (length == SIZEOF (expected));
- ASSERT (result != NULL && u16_cmp (result, expected, SIZEOF (expected)) == 0);
+ ASSERT (u16_cmp (result, expected, SIZEOF (expected)) == 0);
if (o)
{
for (i = 0; i < 10; i++)
for (o = 0; o < 2; o++)
{
size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
- uint16_t *result = NULL;
- size_t length = 0;
- int retval = u16_conv_from_encoding ("autodetect_jp", handler,
- input, strlen (input),
- offsets,
- &result, &length);
- ASSERT (retval == 0);
+ size_t length;
+ uint16_t *result = u16_conv_from_encoding ("autodetect_jp", handler,
+ input, strlen (input),
+ offsets,
+ NULL, &length);
+ ASSERT (result != NULL);
ASSERT (length == SIZEOF (expected));
- ASSERT (result != NULL && u16_cmp (result, expected, SIZEOF (expected)) == 0);
+ ASSERT (u16_cmp (result, expected, SIZEOF (expected)) == 0);
if (o)
{
for (i = 0; i < 10; i++)
for (o = 0; o < 2; o++)
{
size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
- uint16_t *result = NULL;
- size_t length = 0;
- int retval = u16_conv_from_encoding ("autodetect_jp", handler,
- input, strlen (input),
- offsets,
- &result, &length);
- ASSERT (retval == 0);
+ size_t length;
+ uint16_t *result = u16_conv_from_encoding ("autodetect_jp", handler,
+ input, strlen (input),
+ offsets,
+ NULL, &length);
+ ASSERT (result != NULL);
ASSERT (length == SIZEOF (expected));
- ASSERT (result != NULL && u16_cmp (result, expected, SIZEOF (expected)) == 0);
+ ASSERT (u16_cmp (result, expected, SIZEOF (expected)) == 0);
if (o)
{
for (i = 0; i < 16; i++)
/* Test of conversion to UTF-32 from legacy encodings.
- Copyright (C) 2007-2008 Free Software Foundation, Inc.
+ Copyright (C) 2007-2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
for (o = 0; o < 2; o++)
{
size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
- uint32_t *result = NULL;
- size_t length = 0;
- int retval = u32_conv_from_encoding ("ISO-8859-1", handler,
- input, strlen (input),
- offsets,
- &result, &length);
- ASSERT (retval == 0);
+ size_t length;
+ uint32_t *result = u32_conv_from_encoding ("ISO-8859-1", handler,
+ input, strlen (input),
+ offsets,
+ NULL, &length);
+ ASSERT (result != NULL);
ASSERT (length == SIZEOF (expected));
- ASSERT (result != NULL && u32_cmp (result, expected, SIZEOF (expected)) == 0);
+ ASSERT (u32_cmp (result, expected, SIZEOF (expected)) == 0);
if (o)
{
for (i = 0; i < 37; i++)
for (o = 0; o < 2; o++)
{
size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
- uint32_t *result = NULL;
- size_t length = 0;
- int retval = u32_conv_from_encoding ("ISO-8859-2", handler,
- input, strlen (input),
- offsets,
- &result, &length);
- ASSERT (retval == 0);
+ size_t length;
+ uint32_t *result = u32_conv_from_encoding ("ISO-8859-2", handler,
+ input, strlen (input),
+ offsets,
+ NULL, &length);
+ ASSERT (result != NULL);
ASSERT (length == SIZEOF (expected));
- ASSERT (result != NULL && u32_cmp (result, expected, SIZEOF (expected)) == 0);
+ ASSERT (u32_cmp (result, expected, SIZEOF (expected)) == 0);
if (o)
{
for (i = 0; i < 16; i++)
for (o = 0; o < 2; o++)
{
size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
- uint32_t *result = NULL;
- size_t length = 0;
- int retval = u32_conv_from_encoding ("autodetect_jp", handler,
- input, strlen (input),
- offsets,
- &result, &length);
- ASSERT (retval == 0);
+ size_t length;
+ uint32_t *result = u32_conv_from_encoding ("autodetect_jp", handler,
+ input, strlen (input),
+ offsets,
+ NULL, &length);
+ ASSERT (result != NULL);
ASSERT (length == SIZEOF (expected));
- ASSERT (result != NULL && u32_cmp (result, expected, SIZEOF (expected)) == 0);
+ ASSERT (u32_cmp (result, expected, SIZEOF (expected)) == 0);
if (o)
{
for (i = 0; i < 10; i++)
for (o = 0; o < 2; o++)
{
size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
- uint32_t *result = NULL;
- size_t length = 0;
- int retval = u32_conv_from_encoding ("autodetect_jp", handler,
- input, strlen (input),
- offsets,
- &result, &length);
- ASSERT (retval == 0);
+ size_t length;
+ uint32_t *result = u32_conv_from_encoding ("autodetect_jp", handler,
+ input, strlen (input),
+ offsets,
+ NULL, &length);
+ ASSERT (result != NULL);
ASSERT (length == SIZEOF (expected));
- ASSERT (result != NULL && u32_cmp (result, expected, SIZEOF (expected)) == 0);
+ ASSERT (u32_cmp (result, expected, SIZEOF (expected)) == 0);
if (o)
{
for (i = 0; i < 10; i++)
for (o = 0; o < 2; o++)
{
size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
- uint32_t *result = NULL;
- size_t length = 0;
- int retval = u32_conv_from_encoding ("autodetect_jp", handler,
- input, strlen (input),
- offsets,
- &result, &length);
- ASSERT (retval == 0);
+ size_t length;
+ uint32_t *result = u32_conv_from_encoding ("autodetect_jp", handler,
+ input, strlen (input),
+ offsets,
+ NULL, &length);
+ ASSERT (result != NULL);
ASSERT (length == SIZEOF (expected));
- ASSERT (result != NULL && u32_cmp (result, expected, SIZEOF (expected)) == 0);
+ ASSERT (u32_cmp (result, expected, SIZEOF (expected)) == 0);
if (o)
{
for (i = 0; i < 16; i++)
/* Test of conversion to UTF-8 from legacy encodings.
- Copyright (C) 2007-2008 Free Software Foundation, Inc.
+ Copyright (C) 2007-2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
for (o = 0; o < 2; o++)
{
size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
- uint8_t *result = NULL;
- size_t length = 0;
- int retval = u8_conv_from_encoding ("ISO-8859-1", handler,
- input, strlen (input),
- offsets,
- &result, &length);
- ASSERT (retval == 0);
+ size_t length;
+ uint8_t *result = u8_conv_from_encoding ("ISO-8859-1", handler,
+ input, strlen (input),
+ offsets,
+ NULL, &length);
+ ASSERT (result != NULL);
ASSERT (length == u8_strlen (expected));
- ASSERT (result != NULL && u8_cmp (result, expected, u8_strlen (expected)) == 0);
+ ASSERT (u8_cmp (result, expected, u8_strlen (expected)) == 0);
if (o)
{
for (i = 0; i < 37; i++)
for (o = 0; o < 2; o++)
{
size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
- uint8_t *result = NULL;
- size_t length = 0;
- int retval = u8_conv_from_encoding ("ISO-8859-2", handler,
- input, strlen (input),
- offsets,
- &result, &length);
- ASSERT (retval == 0);
+ size_t length;
+ uint8_t *result = u8_conv_from_encoding ("ISO-8859-2", handler,
+ input, strlen (input),
+ offsets,
+ NULL, &length);
+ ASSERT (result != NULL);
ASSERT (length == u8_strlen (expected));
- ASSERT (result != NULL && u8_cmp (result, expected, u8_strlen (expected)) == 0);
+ ASSERT (u8_cmp (result, expected, u8_strlen (expected)) == 0);
if (o)
{
for (i = 0; i < 16; i++)
for (o = 0; o < 2; o++)
{
size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
- uint8_t *result = NULL;
- size_t length = 0;
- int retval = u8_conv_from_encoding ("autodetect_jp", handler,
- input, strlen (input),
- offsets,
- &result, &length);
- ASSERT (retval == 0);
+ size_t length;
+ uint8_t *result = u8_conv_from_encoding ("autodetect_jp", handler,
+ input, strlen (input),
+ offsets,
+ NULL, &length);
+ ASSERT (result != NULL);
ASSERT (length == u8_strlen (expected));
- ASSERT (result != NULL && u8_cmp (result, expected, u8_strlen (expected)) == 0);
+ ASSERT (u8_cmp (result, expected, u8_strlen (expected)) == 0);
if (o)
{
for (i = 0; i < 10; i++)
for (o = 0; o < 2; o++)
{
size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
- uint8_t *result = NULL;
- size_t length = 0;
- int retval = u8_conv_from_encoding ("autodetect_jp", handler,
- input, strlen (input),
- offsets,
- &result, &length);
- ASSERT (retval == 0);
+ size_t length;
+ uint8_t *result = u8_conv_from_encoding ("autodetect_jp", handler,
+ input, strlen (input),
+ offsets,
+ NULL, &length);
+ ASSERT (result != NULL);
ASSERT (length == u8_strlen (expected));
- ASSERT (result != NULL && u8_cmp (result, expected, u8_strlen (expected)) == 0);
+ ASSERT (u8_cmp (result, expected, u8_strlen (expected)) == 0);
if (o)
{
for (i = 0; i < 10; i++)
for (o = 0; o < 2; o++)
{
size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
- uint8_t *result = NULL;
- size_t length = 0;
- int retval = u8_conv_from_encoding ("autodetect_jp", handler,
- input, strlen (input),
- offsets,
- &result, &length);
- ASSERT (retval == 0);
+ size_t length;
+ uint8_t *result = u8_conv_from_encoding ("autodetect_jp", handler,
+ input, strlen (input),
+ offsets,
+ NULL, &length);
+ ASSERT (result != NULL);
ASSERT (length == u8_strlen (expected));
- ASSERT (result != NULL && u8_cmp (result, expected, u8_strlen (expected)) == 0);
+ ASSERT (u8_cmp (result, expected, u8_strlen (expected)) == 0);
if (o)
{
for (i = 0; i < 16; i++)