Commit 78277aed authored by Rémi Duraffort's avatar Rémi Duraffort

Remove duplication and do the NULL text before dereferencing (CID 232)

parent 47be9baa
...@@ -99,6 +99,9 @@ static int find_charset (void) ...@@ -99,6 +99,9 @@ static int find_charset (void)
static char *locale_fast (const char *string, bool from) static char *locale_fast (const char *string, bool from)
{ {
if( string == NULL )
return NULL;
#if defined (USE_ICONV) #if defined (USE_ICONV)
if (find_charset ()) if (find_charset ())
return (char *)string; return (char *)string;
...@@ -113,9 +116,6 @@ static char *locale_fast (const char *string, bool from) ...@@ -113,9 +116,6 @@ static char *locale_fast (const char *string, bool from)
size_t outb = inb * 6 + 1; size_t outb = inb * 6 + 1;
char output[outb], *optr = output; char output[outb], *optr = output;
if (string == NULL)
return NULL;
while (vlc_iconv (hd, &iptr, &inb, &optr, &outb) == (size_t)(-1)) while (vlc_iconv (hd, &iptr, &inb, &optr, &outb) == (size_t)(-1))
{ {
*optr++ = '?'; *optr++ = '?';
...@@ -136,9 +136,6 @@ static char *locale_fast (const char *string, bool from) ...@@ -136,9 +136,6 @@ static char *locale_fast (const char *string, bool from)
char *out; char *out;
int len; int len;
if (string == NULL)
return NULL;
len = 1 + MultiByteToWideChar (from ? CP_ACP : CP_UTF8, len = 1 + MultiByteToWideChar (from ? CP_ACP : CP_UTF8,
0, string, -1, NULL, 0); 0, string, -1, NULL, 0);
wchar_t wide[len]; wchar_t wide[len];
......
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