Add missing prototype
[lms] / lightmediascanner / src / lib / lightmediascanner_charset_conv.h
1 /**
2  * Copyright (C) 2007 by INdT
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17  *
18  * @author Gustavo Sverzut Barbieri <gustavo.barbieri@openbossa.org>
19  */
20
21 #ifndef _LIGHTMEDIASCANNER_CHARSET_CONV_H_
22 #define _LIGHTMEDIASCANNER_CHARSET_CONV_H_ 1
23
24 #ifdef GNUC_MALLOC
25 #undef GNUC_MALLOC
26 #endif
27 #ifdef GNUC_WARN_UNUSED_RESULT
28 #undef GNUC_WARN_UNUSED_RESULT
29 #endif
30 #ifdef GNUC_NON_NULL
31 #undef GNUC_NON_NULL
32 #endif
33 #ifdef API
34 #undef API
35 #endif
36
37 #ifdef __GNUC__
38 # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
39 #  define GNUC_MALLOC __attribute__((__malloc__))
40 # else
41 #  define GNUC_MALLOC
42 # endif
43 # if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
44 #  define GNUC_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
45 #  define GNUC_NON_NULL(...) __attribute__((nonnull(__VA_ARGS__)))
46 # else
47 #  define GNUC_WARN_UNUSED_RESULT
48 #  define GNUC_NON_NULL(...)
49 # endif
50 # if __GNUC__ >= 4
51 #  define API __attribute__ ((visibility("default")))
52 # else
53 #  define API
54 # endif
55 #else
56 #  define GNUC_MALLOC
57 #  define GNUC_WARN_UNUSED_RESULT
58 #  define GNUC_NON_NULL(...)
59 #  define API
60 #endif
61
62 #ifdef __cplusplus
63 extern "C" {
64 #endif
65 /**
66  * @defgroup LMS_CHARSET Charset Conversion
67  *
68  * Utilities to convert strings to UTF-8, the charset used in database.
69  * @{
70  */
71
72     typedef struct lms_charset_conv lms_charset_conv_t;
73
74     API lms_charset_conv_t *lms_charset_conv_new(void) GNUC_MALLOC GNUC_WARN_UNUSED_RESULT;
75     API void lms_charset_conv_free(lms_charset_conv_t *lcc) GNUC_NON_NULL(1);
76     API int lms_charset_conv_add(lms_charset_conv_t *lcc, const char *charset) GNUC_NON_NULL(1, 2);
77     API int lms_charset_conv_del(lms_charset_conv_t *lcc, const char *charset) GNUC_NON_NULL(1, 2);
78
79     API int lms_charset_conv(lms_charset_conv_t *lcc, char **p_str, unsigned int *p_len) GNUC_NON_NULL(1, 2, 3);
80     API int lms_charset_conv_force(lms_charset_conv_t *lcc, char **p_str, unsigned int *p_len) GNUC_NON_NULL(1, 2, 3);
81     API int lms_charset_conv_check(lms_charset_conv_t *lcc, const char *str, unsigned int len) GNUC_NON_NULL(1, 2);
82
83 /**
84  * @}
85  */
86 #ifdef __cplusplus
87 }
88 #endif
89 #endif /* _LIGHTMEDIASCANNER_CHARSET_CONV_H_ */