Commit 2abddade authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Remove --disable-non-utf8

parent ae7b55a4
......@@ -763,20 +763,6 @@ fi
AM_CONDITIONAL(HAVE_MINIZIP, [ test "${have_minizip}" = "yes" ])
dnl Manual switch for UTF-8
AC_ARG_ENABLE(non-utf8,
[AS_HELP_STRING([--enable-non-utf8],
[support legacy non-UTF-8 systems (default disabled)])],, [
AS_IF([test "${SYS}" = "mingw32" -o "${SYS}" = "mingwce" -o "${SYS}" = "os2"], [
enable_non_utf8="no"
])
])
AS_IF([test "${enable_non_utf8}" != "no"], [
AC_DEFINE([ASSUME_UTF8], [1],
[Define to 1 if the operating system uses UTF-8 internally])
])
dnl Check for dbus
AC_ARG_ENABLE(dbus,
[AS_HELP_STRING([--enable-dbus],
......
......@@ -51,7 +51,33 @@ VLC_API char * vlc_strcasestr(const char *, const char *) VLC_USED;
VLC_API char * EnsureUTF8( char * );
VLC_API const char * IsUTF8( const char * ) VLC_USED;
#ifdef WIN32
VLC_API char * FromCharset( const char *charset, const void *data, size_t data_size ) VLC_USED;
VLC_API void * ToCharset( const char *charset, const char *in, size_t *outsize ) VLC_USED;
#ifndef WIN32
# define FromLocale(l) (l)
# define ToLocale(u) (u)
# define LocaleFree(s) ((void)(s))
# define FromLocaleDup strdup
# define ToLocaleDup strdup
#else
VLC_USED
static inline const char *FromLocale (const char *locale)
{
return locale ? FromCharset ("", locale, strlen (locale)) : NULL;
}
VLC_USED
static inline const char *ToLocale (const char *utf8)
{
size_t outsize;
return utf8 ? ToCharset ("", utf8, &outsize) : NULL;
}
# define LocaleFree(s) free((char *)(s))
# define FromLocaleDup FromLocale
# define ToLocaleDup ToLocale
VLC_USED
static inline char *FromWide (const wchar_t *wide)
{
......@@ -116,9 +142,6 @@ static inline char *FromLatin1 (const char *latin)
return utf8 ? utf8 : str;
}
VLC_API char * FromCharset( const char *charset, const void *data, size_t data_size ) VLC_USED;
VLC_API void * ToCharset( const char *charset, const char *in, size_t *outsize ) VLC_USED;
VLC_API double us_strtod( const char *, char ** ) VLC_USED;
VLC_API float us_strtof( const char *, char ** ) VLC_USED;
VLC_API double us_atof( const char * ) VLC_USED;
......
......@@ -144,8 +144,6 @@ filter_chain_VideoFlush
filter_ConfigureBlend
filter_DeleteBlend
filter_NewBlend
FromLocale
FromLocaleDup
FromCharset
GetLang_1
GetLang_2B
......@@ -240,7 +238,6 @@ libvlc_InternalInit
libvlc_InternalWait
libvlc_Quit
libvlc_SetExitHandler
LocaleFree
make_URI
make_path
mdate
......@@ -437,8 +434,6 @@ subpicture_region_New
vlc_tls_ClientCreate
vlc_tls_ClientDelete
ToCharset
ToLocale
ToLocaleDup
update_Check
update_Delete
update_Download
......
......@@ -47,109 +47,19 @@
#include <errno.h>
#include <wctype.h>
/**
* Releases (if needed) a localized or uniformized string.
* @param str non-NULL return value from FromLocale() or ToLocale().
*/
void LocaleFree (const char *str)
{
#ifdef ASSUME_UTF8
(void) str;
#else
free ((char *)str);
#endif
}
/**
* Converts a string from the system locale character encoding to UTF-8.
*
* @param locale nul-terminated string to convert
*
* @return a nul-terminated UTF-8 string, or NULL in case of error.
* To avoid memory leak, you have to pass the result to LocaleFree()
* when it is no longer needed.
*/
char *FromLocale (const char *locale)
{
#ifdef ASSUME_UTF8
return (char *)locale;
#else
return locale ? FromCharset ("", locale, strlen(locale)) : NULL;
#endif
}
/**
* converts a string from the system locale character encoding to utf-8,
* the result is always allocated on the heap.
*
* @param locale nul-terminated string to convert
*
* @return a nul-terminated utf-8 string, or null in case of error.
* The result must be freed using free() - as with the strdup() function.
*/
char *FromLocaleDup (const char *locale)
{
#ifdef ASSUME_UTF8
return strdup (locale);
#else
return FromCharset ("", locale, strlen(locale));
#endif
}
/**
* ToLocale: converts an UTF-8 string to local system encoding.
*
* @param utf8 nul-terminated string to be converted
*
* @return a nul-terminated string, or NULL in case of error.
* To avoid memory leak, you have to pass the result to LocaleFree()
* when it is no longer needed.
*/
char *ToLocale (const char *utf8)
{
#ifdef ASSUME_UTF8
return (char *)utf8;
#else
size_t outsize;
return utf8 ? ToCharset ("", utf8, &outsize) : NULL;
#endif
}
/**
* converts a string from UTF-8 to the system locale character encoding,
* the result is always allocated on the heap.
*
* @param utf8 nul-terminated string to convert
*
* @return a nul-terminated string, or null in case of error.
* The result must be freed using free() - as with the strdup() function.
*/
char *ToLocaleDup (const char *utf8)
{
#ifdef ASSUME_UTF8
return strdup (utf8);
#else
size_t outsize;
return ToCharset ("", utf8, &outsize);
#endif
}
/**
* Formats an UTF-8 string as vfprintf(), then print it, with
* appropriate conversion to local encoding.
*/
int utf8_vfprintf( FILE *stream, const char *fmt, va_list ap )
{
#ifdef ASSUME_UTF8
#ifndef WIN32
return vfprintf (stream, fmt, ap);
#else
char *str;
int res;
# if defined( WIN32 ) && !defined( UNDER_CE )
# ifndef UNDER_CE
/* Writing to the console is a lot of fun on Microsoft Windows.
* If you use the standard I/O functions, you must use the OEM code page,
* which is different from the usual ANSI code page. Or maybe not, if the
......
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