#include <sys/types.h>
#ifdef UNDER_CE
# include <tchar.h>
+#elif defined(WIN32)
+# include <io.h>
#endif
#include <errno.h>
#include <wctype.h>
#ifdef ASSUME_UTF8
return (char *)locale;
#else
- return locale ? FromCharset ("", locale) : NULL;
+ return locale ? FromCharset ("", locale, strlen(locale)) : NULL;
#endif
}
#ifdef ASSUME_UTF8
return strdup (locale);
#else
- return FromCharset ("", locale);
+ return FromCharset ("", locale, strlen(locale));
#endif
}
#ifdef ASSUME_UTF8
return (char *)utf8;
#else
- return utf8 ? ToCharset ("", utf8) : NULL;
+ size_t outsize;
+ return utf8 ? ToCharset ("", utf8, &outsize) : NULL;
#endif
}
#ifdef ASSUME_UTF8
return strdup (utf8);
#else
- return ToCharset ("", utf8);
+ size_t outsize;
+ return ToCharset ("", utf8, &outsize);
#endif
}
char *ansi = ToLocaleDup (str);
free (str);
+ if (ansi == NULL)
+ return -1;
fputs (ansi, stream);
free (ansi);
return res;
const char *inp = in;
char *outp = res;
- size_t inb = inlen + 1;
+ size_t inb = inlen;
size_t outb = outlen;
if (vlc_iconv (hd, &inp, &inb, &outp, &outb) != (size_t)(-1))
}
free (res);
+ res = NULL;
if (errno != E2BIG) /* conversion failure */
- {
- res = NULL;
break;
- }
}
vlc_iconv_close (hd);
return res;