[vlc-devel] commit: Remove duplication and do the NULL text before dereferencing ( CID 232) ( Rémi Duraffort )
git version control
git at videolan.org
Wed Oct 1 20:36:23 CEST 2008
vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Wed Oct 1 20:34:56 2008 +0200| [78277aedce99a6ca8f69844b5a93b70aa95a7ede] | committer: Rémi Duraffort
Remove duplication and do the NULL text before dereferencing (CID 232)
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=78277aedce99a6ca8f69844b5a93b70aa95a7ede
---
src/text/unicode.c | 9 +++------
1 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/src/text/unicode.c b/src/text/unicode.c
index 299e366..df0df10 100644
--- a/src/text/unicode.c
+++ b/src/text/unicode.c
@@ -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];
More information about the vlc-devel
mailing list