Commit 89f83434 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Export vlc_towc()

parent 1b68edb9
...@@ -27,9 +27,29 @@ ...@@ -27,9 +27,29 @@
/** /**
* \file * \file
* This files handles locale conversions in vlc * Characters sets handling
*
* \ingroup strings
* @{
*/ */
/**
* Decodes a code point from UTF-8.
*
* Converts the first character in a UTF-8 sequence into a Unicode code point.
*
* \param str an UTF-8 bytes sequence [IN]
* \param pwc address of a location to store the code point [OUT]
*
* \return the number of bytes occupied by the decoded code point
*
* \retval (size_t)-1 not a valid UTF-8 sequence
* \retval 0 null character (i.e. str points to an empty string)
* \retval 1 (non-null) ASCII character
* \retval 2-4 non-ASCII character
*/
VLC_API size_t vlc_towc(const char *str, uint32_t *restrict pwc);
/* iconv wrappers (defined in src/extras/libc.c) */ /* iconv wrappers (defined in src/extras/libc.c) */
typedef void *vlc_iconv_t; typedef void *vlc_iconv_t;
VLC_API vlc_iconv_t vlc_iconv_open( const char *, const char * ) VLC_USED; VLC_API vlc_iconv_t vlc_iconv_open( const char *, const char * ) VLC_USED;
...@@ -204,6 +224,8 @@ static inline char *FromLatin1 (const char *latin) ...@@ -204,6 +224,8 @@ static inline char *FromLatin1 (const char *latin)
return utf8 ? utf8 : str; return utf8 ? utf8 : str;
} }
/** @} */
VLC_API double us_strtod( const char *, char ** ) VLC_USED; VLC_API double us_strtod( const char *, char ** ) VLC_USED;
VLC_API float us_strtof( const char *, char ** ) VLC_USED; VLC_API float us_strtof( const char *, char ** ) VLC_USED;
VLC_API double us_atof( const char * ) VLC_USED; VLC_API double us_atof( const char * ) VLC_USED;
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <vlc_common.h> #include <vlc_common.h>
#include <vlc_modules.h> #include <vlc_modules.h>
#include <vlc_plugin.h> #include <vlc_plugin.h>
#include <vlc_charset.h>
#include "modules/modules.h" #include "modules/modules.h"
#include "config/configuration.h" #include "config/configuration.h"
#include "libvlc.h" #include "libvlc.h"
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#include <vlc_common.h> #include <vlc_common.h>
#include <vlc_keys.h> #include <vlc_keys.h>
#include <vlc_charset.h>
#include "configuration.h" #include "configuration.h"
#include "libvlc.h" #include "libvlc.h"
......
...@@ -34,8 +34,6 @@ struct vlc_actions; ...@@ -34,8 +34,6 @@ struct vlc_actions;
struct vlc_actions *vlc_InitActions (libvlc_int_t *); struct vlc_actions *vlc_InitActions (libvlc_int_t *);
extern void vlc_DeinitActions (libvlc_int_t *, struct vlc_actions *); extern void vlc_DeinitActions (libvlc_int_t *, struct vlc_actions *);
size_t vlc_towc (const char *str, uint32_t *restrict pwc);
/* /*
* OS-specific initialization * OS-specific initialization
*/ */
......
...@@ -628,6 +628,7 @@ vlc_timer_create ...@@ -628,6 +628,7 @@ vlc_timer_create
vlc_timer_destroy vlc_timer_destroy
vlc_timer_getoverrun vlc_timer_getoverrun
vlc_timer_schedule vlc_timer_schedule
vlc_towc
vlc_ureduce vlc_ureduce
vlc_epg_Init vlc_epg_Init
vlc_epg_Clean vlc_epg_Clean
......
...@@ -110,15 +110,6 @@ int utf8_fprintf( FILE *stream, const char *fmt, ... ) ...@@ -110,15 +110,6 @@ int utf8_fprintf( FILE *stream, const char *fmt, ... )
return res; return res;
} }
/**
* Converts the first character from a UTF-8 sequence into a code point.
*
* @param str an UTF-8 bytes sequence
* @return 0 if str points to an empty string, i.e. the first character is NUL;
* number of bytes that the first character occupies (from 1 to 4) otherwise;
* -1 if the byte sequence was not a valid UTF-8 sequence.
*/
size_t vlc_towc (const char *str, uint32_t *restrict pwc) size_t vlc_towc (const char *str, uint32_t *restrict pwc)
{ {
uint8_t *ptr = (uint8_t *)str, c; uint8_t *ptr = (uint8_t *)str, c;
......
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