From 6d0be7db4b417663ddc40c77978a354415dc82d7 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Sat, 19 Feb 2005 00:32:11 +0000 Subject: [PATCH] Added test of HAVE_ICONV, so compile is ok if iconv is not found --- src/common/weechat.c | 23 +++++++++++++++++------ weechat/src/common/weechat.c | 23 +++++++++++++++++------ 2 files changed, 34 insertions(+), 12 deletions(-) diff --git a/src/common/weechat.c b/src/common/weechat.c index c1e85e4e0..193c63d5d 100644 --- a/src/common/weechat.c +++ b/src/common/weechat.c @@ -8,11 +8,9 @@ * ### WeeChat - Wee Enhanced Environment for Chat ### * ### Fast & light environment for Chat ### * ### ### - * ### By: FlashCode ### - * ### Bounga ### - * ### Xahlexx ### - * ### ### - * ### http://weechat.flashtux.org ### + * ### By FlashCode ### + ### ### + * ### http://weechat.flashtux.org ### * ### ### * ############################################################################ * @@ -49,7 +47,11 @@ #include #include #include + +#ifdef HAVE_ICONV #include +#endif + #include #include "weechat.h" @@ -87,8 +89,11 @@ my_sigint () char * weechat_convert_encoding (char *from_code, char *to_code, char *string) { + char *outbuf; + + #ifdef HAVE_ICONV iconv_t cd; - char *inbuf, *ptr_inbuf, *outbuf, *ptr_outbuf; + char *inbuf, *ptr_inbuf, *ptr_outbuf; int inbytesleft, outbytesleft; if (from_code && from_code[0] && to_code && to_code[0] @@ -119,6 +124,12 @@ weechat_convert_encoding (char *from_code, char *to_code, char *string) } else outbuf = strdup (string); + #else + /* make gcc happy */ + (void) from_code; + (void) to_code; + outbuf = strdup (string); + #endif /* HAVE_ICONV */ return outbuf; } diff --git a/weechat/src/common/weechat.c b/weechat/src/common/weechat.c index c1e85e4e0..193c63d5d 100644 --- a/weechat/src/common/weechat.c +++ b/weechat/src/common/weechat.c @@ -8,11 +8,9 @@ * ### WeeChat - Wee Enhanced Environment for Chat ### * ### Fast & light environment for Chat ### * ### ### - * ### By: FlashCode ### - * ### Bounga ### - * ### Xahlexx ### - * ### ### - * ### http://weechat.flashtux.org ### + * ### By FlashCode ### + ### ### + * ### http://weechat.flashtux.org ### * ### ### * ############################################################################ * @@ -49,7 +47,11 @@ #include #include #include + +#ifdef HAVE_ICONV #include +#endif + #include #include "weechat.h" @@ -87,8 +89,11 @@ my_sigint () char * weechat_convert_encoding (char *from_code, char *to_code, char *string) { + char *outbuf; + + #ifdef HAVE_ICONV iconv_t cd; - char *inbuf, *ptr_inbuf, *outbuf, *ptr_outbuf; + char *inbuf, *ptr_inbuf, *ptr_outbuf; int inbytesleft, outbytesleft; if (from_code && from_code[0] && to_code && to_code[0] @@ -119,6 +124,12 @@ weechat_convert_encoding (char *from_code, char *to_code, char *string) } else outbuf = strdup (string); + #else + /* make gcc happy */ + (void) from_code; + (void) to_code; + outbuf = strdup (string); + #endif /* HAVE_ICONV */ return outbuf; }