[vlc-commits] Export vlc_towc()

Rémi Denis-Courmont git at videolan.org
Sun Nov 29 14:14:03 CET 2015


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Nov 29 14:21:04 2015 +0200| [89f83434a31ba53abe1693d5792740a90ab3fdc1] | committer: Rémi Denis-Courmont

Export vlc_towc()

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=89f83434a31ba53abe1693d5792740a90ab3fdc1
---

 include/vlc_charset.h |   24 +++++++++++++++++++++++-
 src/config/help.c     |    1 +
 src/config/keys.c     |    1 +
 src/libvlc.h          |    2 --
 src/libvlccore.sym    |    1 +
 src/text/unicode.c    |    9 ---------
 6 files changed, 26 insertions(+), 12 deletions(-)

diff --git a/include/vlc_charset.h b/include/vlc_charset.h
index 3119e89..253405d 100644
--- a/include/vlc_charset.h
+++ b/include/vlc_charset.h
@@ -27,9 +27,29 @@
 
 /**
  * \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) */
 typedef void *vlc_iconv_t;
 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)
     return utf8 ? utf8 : str;
 }
 
+/** @} */
+
 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;
diff --git a/src/config/help.c b/src/config/help.c
index bcd16c9..9d7e785 100644
--- a/src/config/help.c
+++ b/src/config/help.c
@@ -31,6 +31,7 @@
 #include <vlc_common.h>
 #include <vlc_modules.h>
 #include <vlc_plugin.h>
+#include <vlc_charset.h>
 #include "modules/modules.h"
 #include "config/configuration.h"
 #include "libvlc.h"
diff --git a/src/config/keys.c b/src/config/keys.c
index 94e5cf5..8b8aef6 100644
--- a/src/config/keys.c
+++ b/src/config/keys.c
@@ -42,6 +42,7 @@
 
 #include <vlc_common.h>
 #include <vlc_keys.h>
+#include <vlc_charset.h>
 #include "configuration.h"
 #include "libvlc.h"
 
diff --git a/src/libvlc.h b/src/libvlc.h
index dd2cc31..e18ee37 100644
--- a/src/libvlc.h
+++ b/src/libvlc.h
@@ -34,8 +34,6 @@ struct vlc_actions;
 struct vlc_actions *vlc_InitActions (libvlc_int_t *);
 extern void vlc_DeinitActions (libvlc_int_t *, struct vlc_actions *);
 
-size_t vlc_towc (const char *str, uint32_t *restrict pwc);
-
 /*
  * OS-specific initialization
  */
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index d346e18..4be47ac 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -628,6 +628,7 @@ vlc_timer_create
 vlc_timer_destroy
 vlc_timer_getoverrun
 vlc_timer_schedule
+vlc_towc
 vlc_ureduce
 vlc_epg_Init
 vlc_epg_Clean
diff --git a/src/text/unicode.c b/src/text/unicode.c
index feac999..87a665f 100644
--- a/src/text/unicode.c
+++ b/src/text/unicode.c
@@ -110,15 +110,6 @@ int utf8_fprintf( FILE *stream, const char *fmt, ... )
     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)
 {
     uint8_t *ptr = (uint8_t *)str, c;



More information about the vlc-commits mailing list