X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=www%2Fapi%2Flightmediascanner__charset__conv_8c.html;fp=www%2Fapi%2Flightmediascanner__charset__conv_8c.html;h=1ae29c5b138d4f67b8bc814ab390f197f06ce4ef;hb=5d28172f584aef7fc9fc711f180b0c65fad258c3;hp=0000000000000000000000000000000000000000;hpb=f7c0a9f05a01670296b047374493ed29805508e2;p=lms diff --git a/www/api/lightmediascanner__charset__conv_8c.html b/www/api/lightmediascanner__charset__conv_8c.html new file mode 100644 index 0000000..1ae29c5 --- /dev/null +++ b/www/api/lightmediascanner__charset__conv_8c.html @@ -0,0 +1,290 @@ + + +Light Media Scanner: src/lib/lightmediascanner_charset_conv.c File Reference + + + + + +
+

src/lib/lightmediascanner_charset_conv.c File Reference

#include "lightmediascanner_charset_conv.h"
+#include <iconv.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <ctype.h>
+ +

+

+Include dependency graph for lightmediascanner_charset_conv.c:
+
+
+ +

+Go to the source code of this file. + + + + + + + + + + + + + + + + + + +

Functions

lms_charset_conv_tlms_charset_conv_new_full (int use_check, int use_fallback)
lms_charset_conv_tlms_charset_conv_new (void)
void lms_charset_conv_free (lms_charset_conv_t *lcc)
int lms_charset_conv_add (lms_charset_conv_t *lcc, const char *charset)
int lms_charset_conv_del (lms_charset_conv_t *lcc, const char *charset)
int lms_charset_conv (lms_charset_conv_t *lcc, char **p_str, unsigned int *p_len)
int lms_charset_conv_force (lms_charset_conv_t *lcc, char **p_str, unsigned int *p_len)
int lms_charset_conv_check (lms_charset_conv_t *lcc, const char *str, unsigned int len)
+


Function Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
int lms_charset_conv (lms_charset_conv_t lcc,
char **  p_str,
unsigned int *  p_len 
)
+
+
+ +

+If required, do charset conversion to UTF-8.

+

Parameters:
+ + + + +
lcc existing Light Media Scanner charset conversion.
p_str string to be converted.
p_len string size.
+
+
Note:
the check for string being already UTF-8 is not reliable, some cases might show false positives (UTF-16 is considered UTF-8).
+
See also:
lms_charset_conv_check()
+
Returns:
On success 0 is returned.
+ +

Definition at line 328 of file lightmediascanner_charset_conv.c.

+ +
+

+ +

+
+ + + + + + + + + + + + + + + + + + +
int lms_charset_conv_add (lms_charset_conv_t lcc,
const char *  charset 
)
+
+
+ +

+Register new charset to conversion tool.

+

Parameters:
+ + + +
lcc existing Light Media Scanner charset conversion.
charset charset name as understood by iconv_open(3).
+
+
Returns:
On success 0 is returned.
+ +

Definition at line 145 of file lightmediascanner_charset_conv.c.

+ +

Referenced by lms_charset_add().

+ +
+

+ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
int lms_charset_conv_check (lms_charset_conv_t lcc,
const char *  str,
unsigned int  len 
)
+
+
+ +

+Check if strings is not UTF-8 and conversion is required.

+

Parameters:
+ + + + +
lcc existing Light Media Scanner charset conversion.
str string to be analysed.
len string size.
+
+
Note:
current implementation is not reliable, it tries to convert from UTF-8 to UTF-8. Some cases, like ISO-8859-1 will work, but some like UTF-16 to UTF-8 will say it's already in the correct charset, even if it's not.
+
Returns:
0 if string is already UTF-8.
+ +

Definition at line 440 of file lightmediascanner_charset_conv.c.

+ +
+

+ +

+
+ + + + + + + + + + + + + + + + + + +
int lms_charset_conv_del (lms_charset_conv_t lcc,
const char *  charset 
)
+
+
+ +

+Forget about previously registered charset in conversion tool.

+

Parameters:
+ + + +
lcc existing Light Media Scanner charset conversion.
charset charset name.
+
+
Returns:
On success 0 is returned.
+ +

Definition at line 211 of file lightmediascanner_charset_conv.c.

+ +

Referenced by lms_charset_del().

+ +
+

+ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
int lms_charset_conv_force (lms_charset_conv_t lcc,
char **  p_str,
unsigned int *  p_len 
)
+
+
+ +

+Forcefully do charset conversion to UTF-8.

+

Parameters:
+ + + + +
lcc existing Light Media Scanner charset conversion.
p_str string to be converted.
p_len string size.
+
+
Note:
This function does not check for the string being in UTF-8 before doing the conversion, use it if you are sure about the charset. In this case you'll usually have just one charset added.
+
Returns:
On success 0 is returned.
+ +

Definition at line 386 of file lightmediascanner_charset_conv.c.

+ +
+

+

+
Generated on Wed Apr 22 23:56:01 2009 for Light Media Scanner by  + +doxygen 1.5.8
+ +