#if HAVE_ICONV
# include <iconv.h>
-# include "utf8-ucs4-safe.h"
+# include "utf8-ucs4.h"
# include "ucs4-utf8.h"
# include "unistr.h"
#endif
-#include "strdup.h"
#include "c-strcase.h"
+#include "c-strcaseeq.h"
#ifndef SIZE_MAX
# define SIZE_MAX ((size_t) -1)
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;
int n;
int m;
- n = u8_mbtouc_safe (&uc, (const uint8_t *) in1ptr, in1size);
+ n = u8_mbtouc (&uc, (const uint8_t *) in1ptr, in1size);
if (uc == 0xfffd
&& !(n >= 3
&& (uint8_t)in1ptr[0] == 0xEF
int n;
if (in2size == 0)
abort ();
- n = u8_mbtouc (&uc, (const uint8_t *) in2ptr,
- in2size);
+ n = u8_mbtouc_unsafe (&uc, (const uint8_t *) in2ptr,
+ in2size);
in2ptr += n;
in2size -= n;
}
if (cd == (iconv_t)(-1))
return -1;
- if (c_strcasecmp (from_codeset, "UTF-8") == 0)
+ if (STRCASEEQ (from_codeset, "UTF-8", 'U','T','F','-','8',0,0,0,0))
cd1 = (iconv_t)(-1);
else
{
}
}
- if (c_strcasecmp (to_codeset, "UTF-8") == 0)
+ if (STRCASEEQ (to_codeset, "UTF-8", 'U','T','F','-','8',0,0,0,0))
cd2 = (iconv_t)(-1);
else
{
if (cd == (iconv_t)(-1))
return NULL;
- if (c_strcasecmp (from_codeset, "UTF-8") == 0)
+ if (STRCASEEQ (from_codeset, "UTF-8", 'U','T','F','-','8',0,0,0,0))
cd1 = (iconv_t)(-1);
else
{
}
}
- if (c_strcasecmp (to_codeset, "UTF-8") == 0)
+ if (STRCASEEQ (to_codeset, "UTF-8", 'U','T','F','-','8',0,0,0,0))
cd2 = (iconv_t)(-1);
else
{