- Timestamp:
- 2006-05-25T23:20:54Z (18 years ago)
- Branches:
- master
- Children:
- 79b6213
- Parents:
- 5d9b792
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
util.c
r5d9b792 r574af7e 39 39 #include <glib.h> 40 40 #include <time.h> 41 #ifdef GLIB242 #define iconv_t GIConv43 #define iconv_open g_iconv_open44 #define iconv_close g_iconv_close45 #define iconv g_iconv46 #else47 #include <iconv.h>48 #endif49 41 50 42 void strip_linefeed(gchar *text) … … 465 457 signed int do_iconv( char *from_cs, char *to_cs, char *src, char *dst, size_t size, size_t maxbuf ) 466 458 { 467 iconv_tcd;459 GIConv cd; 468 460 size_t res; 469 461 size_t inbytesleft, outbytesleft; … … 471 463 char *outbuf = dst; 472 464 473 cd = iconv_open( to_cs, from_cs );474 if( cd == ( iconv_t) -1 )465 cd = g_iconv_open( to_cs, from_cs ); 466 if( cd == (GIConv) -1 ) 475 467 return( -1 ); 476 468 477 469 inbytesleft = size ? size : strlen( src ); 478 470 outbytesleft = maxbuf - 1; 479 res = iconv( cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft );471 res = g_iconv( cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft ); 480 472 *outbuf = '\0'; 481 iconv_close( cd );473 g_iconv_close( cd ); 482 474 483 475 if( res == (size_t) -1 ) … … 489 481 char *set_eval_charset( irc_t *irc, set_t *set, char *value ) 490 482 { 491 iconv_tcd;483 GIConv cd; 492 484 493 485 if ( g_strncasecmp( value, "none", 4 ) == 0 ) 494 486 return( value ); 495 487 496 cd = iconv_open( "UTF-8", value );497 if( cd == ( iconv_t) -1 )488 cd = g_iconv_open( "UTF-8", value ); 489 if( cd == (GIConv) -1 ) 498 490 return( NULL ); 499 491 500 iconv_close( cd );492 g_iconv_close( cd ); 501 493 return( value ); 502 494 }
Note: See TracChangeset
for help on using the changeset viewer.