2 * Copyright (C) 2007 by INdT
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.
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.
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.
18 * @author Gustavo Sverzut Barbieri <gustavo.barbieri@openbossa.org>
21 #ifndef _LIGHTMEDIASCANNER_CHARSET_CONV_H_
22 #define _LIGHTMEDIASCANNER_CHARSET_CONV_H_ 1
27 #ifdef GNUC_WARN_UNUSED_RESULT
28 #undef GNUC_WARN_UNUSED_RESULT
38 # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
39 # define GNUC_MALLOC __attribute__((__malloc__))
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__)))
47 # define GNUC_WARN_UNUSED_RESULT
48 # define GNUC_NON_NULL(...)
51 # define API __attribute__ ((visibility("default")))
57 # define GNUC_WARN_UNUSED_RESULT
58 # define GNUC_NON_NULL(...)
66 * @defgroup LMS_CHARSET Charset Conversion
68 * Utilities to convert strings to UTF-8, the charset used in database.
72 typedef struct lms_charset_conv lms_charset_conv_t;
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);
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);
89 #endif /* _LIGHTMEDIASCANNER_CHARSET_CONV_H_ */