charset.h (960B)
1 // SPDX-License-Identifier: GPL-2.0-or-later 2 // Copyright The Music Player Daemon Project 3 4 #ifndef CHAR_CONV_H 5 #define CHAR_CONV_H 6 7 #include "config.h" 8 #include "Compiler.h" 9 10 #include <stdbool.h> 11 12 #ifdef HAVE_ICONV 13 14 /** 15 * Initializes the character set conversion library. 16 * 17 * @param enable_input allow conversion from locale to UTF-8 18 * @param enable_output allow conversion from UTF-8 to locale 19 */ 20 void 21 charset_init(bool enable_input, bool enable_output); 22 23 void charset_deinit(void); 24 25 gcc_pure 26 const char * 27 charset_to_utf8(const char *from); 28 29 gcc_pure 30 const char * 31 charset_from_utf8(const char *from); 32 33 #else 34 35 static inline void 36 charset_init(bool disable_input, bool disable_output) 37 { 38 (void)disable_input; 39 (void)disable_output; 40 } 41 42 static inline void 43 charset_deinit(void) 44 { 45 } 46 47 static inline const char * 48 charset_to_utf8(const char *from) 49 { 50 return from; 51 } 52 53 static inline const char * 54 charset_from_utf8(const char *from) 55 { 56 return from; 57 } 58 59 #endif 60 61 #endif