mirror of https://code.videolan.org/videolan/vlc
* src/misc/charset.c: Fixed a segfault and removed some gcc warnings
The day i understand strings and memory in C is going to be a joyful day :) * modules/demux/mkv.cpp: fixed an error if there is no ICONV support
This commit is contained in:
parent
efaa4dec1d
commit
b6990fe688
|
@ -2,7 +2,7 @@
|
||||||
* mkv.cpp : matroska demuxer
|
* mkv.cpp : matroska demuxer
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
* Copyright (C) 2001 VideoLAN
|
* Copyright (C) 2001 VideoLAN
|
||||||
* $Id: mkv.cpp,v 1.27 2003/09/12 16:26:40 fenrir Exp $
|
* $Id: mkv.cpp,v 1.28 2003/10/11 21:08:40 hartman Exp $
|
||||||
*
|
*
|
||||||
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
|
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
|
||||||
*
|
*
|
||||||
|
@ -1045,8 +1045,8 @@ static int Open( vlc_object_t * p_this )
|
||||||
val.psz_string = "UTF-8";
|
val.psz_string = "UTF-8";
|
||||||
#if defined(HAVE_ICONV)
|
#if defined(HAVE_ICONV)
|
||||||
var_Create( p_input, "subsdec-encoding", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
|
var_Create( p_input, "subsdec-encoding", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
|
||||||
#endif
|
|
||||||
var_Set( p_input, "subsdec-encoding", val );
|
var_Set( p_input, "subsdec-encoding", val );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
if( !strcmp( tk.psz_codec, "V_MS/VFW/FOURCC" ) )
|
if( !strcmp( tk.psz_codec, "V_MS/VFW/FOURCC" ) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* encoding.
|
* encoding.
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
* Copyright (C) 2003 VideoLAN
|
* Copyright (C) 2003 VideoLAN
|
||||||
* $Id: charset.c,v 1.3 2003/09/29 17:36:35 gbazin Exp $
|
* $Id: charset.c,v 1.4 2003/10/11 21:08:40 hartman Exp $
|
||||||
*
|
*
|
||||||
* Authors: Derk-Jan Hartman <thedj at users.sf.net>
|
* Authors: Derk-Jan Hartman <thedj at users.sf.net>
|
||||||
*
|
*
|
||||||
|
@ -214,7 +214,7 @@ static char *vlc_encoding_from_locale( char *psz_locale )
|
||||||
|
|
||||||
if( psz_modifier == NULL )
|
if( psz_modifier == NULL )
|
||||||
return psz_dot;
|
return psz_dot;
|
||||||
if( psz_modifier - psz_dot < sizeof( buf ))
|
if( 0 < ( psz_modifier - psz_dot ) < sizeof( buf ))
|
||||||
{
|
{
|
||||||
memcpy( buf, psz_dot, psz_modifier - psz_dot );
|
memcpy( buf, psz_dot, psz_modifier - psz_dot );
|
||||||
buf[ psz_modifier - psz_dot ] = '\0';
|
buf[ psz_modifier - psz_dot ] = '\0';
|
||||||
|
@ -222,7 +222,7 @@ static char *vlc_encoding_from_locale( char *psz_locale )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* try language mapping */
|
/* try language mapping */
|
||||||
return vlc_encoding_from_language( psz_locale );
|
return (char *)vlc_encoding_from_language( psz_locale );
|
||||||
}
|
}
|
||||||
|
|
||||||
vlc_bool_t vlc_current_charset( char **psz_charset )
|
vlc_bool_t vlc_current_charset( char **psz_charset )
|
||||||
|
@ -260,7 +260,7 @@ vlc_bool_t vlc_current_charset( char **psz_charset )
|
||||||
/* On some old systems, one used to set locale = "iso8859_1". On others,
|
/* On some old systems, one used to set locale = "iso8859_1". On others,
|
||||||
* you set it to "language_COUNTRY.charset". Darwin only has LANG :(
|
* you set it to "language_COUNTRY.charset". Darwin only has LANG :(
|
||||||
*/
|
*/
|
||||||
psz_codeset = vlc_encoding_from_locale( psz_locale );
|
psz_codeset = vlc_encoding_from_locale( (char *)psz_locale );
|
||||||
# endif /* HAVE_LANGINFO_CODESET */
|
# endif /* HAVE_LANGINFO_CODESET */
|
||||||
|
|
||||||
#elif defined WIN32
|
#elif defined WIN32
|
||||||
|
@ -322,7 +322,7 @@ vlc_bool_t vlc_current_charset( char **psz_charset )
|
||||||
}
|
}
|
||||||
|
|
||||||
if( psz_charset )
|
if( psz_charset )
|
||||||
*psz_charset = (char *)psz_codeset;
|
*psz_charset = strdup((char *)psz_codeset);
|
||||||
|
|
||||||
if (strcasecmp(psz_codeset, "UTF8")==0 || strcasecmp(psz_codeset, "UTF-8")==0)
|
if (strcasecmp(psz_codeset, "UTF8")==0 || strcasecmp(psz_codeset, "UTF-8")==0)
|
||||||
return VLC_TRUE;
|
return VLC_TRUE;
|
||||||
|
|
Loading…
Reference in New Issue