Warning, file /office/calligra/cmake/TestModernIconv.c was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 #ifdef HAVE_ICONV_H
0002 #include <iconv.h>
0003 #endif
0004 #ifdef HAVE_SYS_ICONV_H
0005 #include <sys/iconv.h>
0006 #endif
0007 #include <stdlib.h>
0008 
0009 int check( const char* from, const char* to )
0010 {
0011     iconv_t myConverter = iconv_open( to, from );
0012 
0013     if ( myConverter != (iconv_t)-1 ) {
0014     iconv_close( myConverter );
0015     return 0;
0016     }
0017     else
0018     return 1;
0019 }
0020 
0021 int main(int argc, char** argv)
0022 {
0023     const char* from[] = { "CP874", "CP932", "CP936", "CP949",
0024                "CP950", "CP1250", "CP1251", "CP1252",
0025                "CP1253", "CP1254", "CP1255", "CP1256",
0026                "CP1257", "koi8-r", 0 };
0027     const char* to[] = { "UNICODELITTLE", "UNICODEBIG", 0 };
0028     int fromIndex = 0;
0029     int toIndex = 0;
0030 
0031     while ( to[ toIndex ] != 0 ) {
0032     while( from[ fromIndex ] != 0 ) {
0033         if ( check( from[ fromIndex ], to[ toIndex ] ) != 0 )
0034         exit( 1 );
0035         fromIndex = fromIndex + 1;
0036     }
0037     toIndex = toIndex + 1;
0038     fromIndex = 0;
0039     }
0040     exit( 0 );
0041 }