aboutsummaryrefslogtreecommitdiff
path: root/net-im
diff options
context:
space:
mode:
authorYing-Chieh Liao <ijliao@FreeBSD.org>2002-11-25 04:56:50 +0000
committerYing-Chieh Liao <ijliao@FreeBSD.org>2002-11-25 04:56:50 +0000
commit5c0fe8e3c102f775e2c7d080ff309f326e90916d (patch)
tree41a8394bba3a71bd34dcb8c3f0bc8f8dd5e1d8bb /net-im
parent7efaed9db4a48b361e4e6ae0763241a4a10aab1f (diff)
downloadports-5c0fe8e3c102f775e2c7d080ff309f326e90916d.tar.gz
ports-5c0fe8e3c102f775e2c7d080ff309f326e90916d.zip
fix coredump with MSN UTF-8
PR: 45697 Submitted by: Cheng-Lung Sung <clsung@dragon2.net>
Notes
Notes: svn path=/head/; revision=71075
Diffstat (limited to 'net-im')
-rw-r--r--net-im/centericq/Makefile2
-rw-r--r--net-im/centericq/files/patch-msnhook.cc69
2 files changed, 41 insertions, 30 deletions
diff --git a/net-im/centericq/Makefile b/net-im/centericq/Makefile
index b08cd48940f5..47eefb9579ad 100644
--- a/net-im/centericq/Makefile
+++ b/net-im/centericq/Makefile
@@ -8,7 +8,7 @@
PORTNAME= centericq
PORTVERSION= 4.8.7
-PORTREVISION= 3
+PORTREVISION= 4
CATEGORIES= net
MASTER_SITES= http://konst.org.ua/download/
diff --git a/net-im/centericq/files/patch-msnhook.cc b/net-im/centericq/files/patch-msnhook.cc
index 1e4940bb8926..04357d340f9c 100644
--- a/net-im/centericq/files/patch-msnhook.cc
+++ b/net-im/centericq/files/patch-msnhook.cc
@@ -1,5 +1,5 @@
---- src/hooks/msnhook.cc Tue Nov 19 10:18:22 2002
-+++ src/hooks/msnhook.cc Tue Nov 19 10:18:35 2002
+--- src/hooks/msnhook.cc Mon Nov 24 10:16:27 2002
++++ src/hooks/msnhook.cc Mon Nov 25 10:16:27 2002
@@ -30,6 +30,7 @@
#include "eventmanager.h"
#include "centericq.h"
@@ -39,7 +39,7 @@
em.store(immessage(ic, imevent::incoming, text));
if(c)
-@@ -453,3 +456,121 @@
+@@ -453,3 +456,132 @@
clist.get(contactroot)->playsound(imevent::email);
}
}
@@ -68,11 +68,12 @@
+ return loc_charset;
+
+ lang = getenv("LANG");
-+ ch = strrchr( lang, '.' ) + 1;
++ ch = strrchr( lang, '.' );
+ if (!ch)
+ strcpy( loc_charset, DEFAULT_CHARSET );
+ else {
+ iconv_t pt;
++ ch++;
+ strncpy( loc_charset, ch, sizeof(loc_charset) );
+ /* try to open iconv handle using guessed charset */
+ if ( (pt = iconv_open( loc_charset, loc_charset )) == (iconv_t)(-1) )
@@ -96,12 +97,15 @@
+ int ret;
+
+ iconv_t handle = iconv_open( "utf-8", guess_current_locale_charset() );
-+ ret = safe_iconv( handle, (const char **) &inbuf, &length, &outbuf, &outmaxlength );
++ if(((int) handle) != -1) {
++ ret = safe_iconv( handle, (const char **) &inbuf, &length, &outbuf, &outmaxlength );
+
-+ *outbuf = '\0';
-+ iconv_close( handle );
-+
-+ return outbuf_save;
++ *outbuf = '\0';
++ iconv_close( handle );
++ return outbuf_save;
++ } else {
++ return (char *)inbuf;
++ };
+}
+
+std::string StrToUtf8( const std::string &instr )
@@ -114,13 +118,17 @@
+ int ret;
+
+ iconv_t handle = iconv_open( "utf-8", guess_current_locale_charset() );
-+ ret = safe_iconv( handle, (const char **) &inbuf, &length, &outbuf, &outmaxlength );
++ if(((int) handle) != -1) {
++ ret = safe_iconv( handle, (const char **) &inbuf, &length, &outbuf, &outmaxlength );
+
-+ *outbuf = '\0';
-+ iconv_close( handle );
-+
-+ std::string return_me = outbuf_save;
-+ return return_me;
++ *outbuf = '\0';
++ iconv_close( handle );
++
++ std::string return_me = outbuf_save;
++ return return_me;
++ } else {
++ return instr;
++ };
+}
+
+char *Utf8ToStr( const char *inbuf )
@@ -132,13 +140,14 @@
+ int ret;
+
+ iconv_t handle = iconv_open( guess_current_locale_charset(), "utf-8" );
-+
-+ ret = safe_iconv( handle, (const char **) &inbuf, &length, &outbuf, &outmaxlength );
-+
-+ *outbuf = '\0';
-+ iconv_close( handle );
-+
-+ return outbuf_save;
++ if(((int) handle) != -1) {
++ ret = safe_iconv( handle, (const char **) &inbuf, &length, &outbuf, &outmaxlength );
++ *outbuf = '\0';
++ iconv_close( handle );
++ return outbuf_save;
++ } else {
++ return (char *)inbuf;
++ };
+}
+
+std::string Utf8ToStr( const std::string &instr )
@@ -152,12 +161,14 @@
+
+ iconv_t handle = iconv_open( guess_current_locale_charset(), "utf-8" );
+
-+ ret = safe_iconv( handle, (const char **) &inbuf, &length, &outbuf, &outmaxlength );
-+
-+ *outbuf = '\0';
-+ iconv_close( handle );
-+
-+ std::string return_me = outbuf_save;
-+ return return_me;
++ if(((int) handle) != -1) {
++ ret = safe_iconv( handle, (const char **) &inbuf, &length, &outbuf, &outmaxlength );
++ *outbuf = '\0';
++ iconv_close( handle );
++ std::string return_me = outbuf_save;
++ return return_me;
++ } else {
++ return instr;
++ };
+}
+#endif /* HAVE_ICONV_H */