]> git.sesse.net Git - vlc/commitdiff
Remove duplication and do the NULL text before dereferencing (CID 232)
authorRémi Duraffort <ivoire@videolan.org>
Wed, 1 Oct 2008 18:34:56 +0000 (20:34 +0200)
committerRémi Duraffort <ivoire@videolan.org>
Wed, 1 Oct 2008 18:36:02 +0000 (20:36 +0200)
src/text/unicode.c

index 299e3668f46fe33c4fed72e0a863a10ff3fd1016..df0df105a31b8ef0caff60e3fca969fd19caaa5e 100644 (file)
@@ -99,6 +99,9 @@ static int find_charset (void)
 
 static char *locale_fast (const char *string, bool from)
 {
+    if( string == NULL )
+        return NULL;
+
 #if defined (USE_ICONV)
     if (find_charset ())
         return (char *)string;
@@ -113,9 +116,6 @@ static char *locale_fast (const char *string, bool from)
     size_t outb = inb * 6 + 1;
     char output[outb], *optr = output;
 
-    if (string == NULL)
-        return NULL;
-
     while (vlc_iconv (hd, &iptr, &inb, &optr, &outb) == (size_t)(-1))
     {
         *optr++ = '?';
@@ -136,9 +136,6 @@ static char *locale_fast (const char *string, bool from)
     char *out;
     int len;
 
-    if (string == NULL)
-        return NULL;
-
     len = 1 + MultiByteToWideChar (from ? CP_ACP : CP_UTF8,
                                    0, string, -1, NULL, 0);
     wchar_t wide[len];