diff options
author | ijliao <ijliao@FreeBSD.org> | 2002-11-27 14:19:27 +0800 |
---|---|---|
committer | ijliao <ijliao@FreeBSD.org> | 2002-11-27 14:19:27 +0800 |
commit | e05b4381d7d6368ae04d8985b01e9033665c6fae (patch) | |
tree | fe4ade2d45508c2a105d2d31de2564749a7a0b2c /net-im | |
parent | 7128f01b754b5bf59dec17711e227f4662e0c97f (diff) | |
download | freebsd-ports-gnome-e05b4381d7d6368ae04d8985b01e9033665c6fae.tar.gz freebsd-ports-gnome-e05b4381d7d6368ae04d8985b01e9033665c6fae.tar.zst freebsd-ports-gnome-e05b4381d7d6368ae04d8985b01e9033665c6fae.zip |
fix core dump when getenv("LANG") return NULL
PR: 45741
Submitted by: Cheng-Lung Sung <clsung@dragon2.net>
Tested by: asmodai
Diffstat (limited to 'net-im')
-rw-r--r-- | net-im/centericq/Makefile | 2 | ||||
-rw-r--r-- | net-im/centericq/files/patch-msnhook.cc | 26 | ||||
-rw-r--r-- | net-im/centericq/files/patch-utf8conv.h | 8 |
3 files changed, 21 insertions, 15 deletions
diff --git a/net-im/centericq/Makefile b/net-im/centericq/Makefile index 47eefb9579ad..853978d3e59d 100644 --- a/net-im/centericq/Makefile +++ b/net-im/centericq/Makefile @@ -8,7 +8,7 @@ PORTNAME= centericq PORTVERSION= 4.8.7 -PORTREVISION= 4 +PORTREVISION= 5 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 04357d340f9c..e5965c3f0fac 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 Mon Nov 24 10:16:27 2002 -+++ src/hooks/msnhook.cc Mon Nov 25 10:16:27 2002 +--- src/hooks/msnhook.cc Mon Oct 28 19:29:41 2002 ++++ src/hooks/msnhook.cc Tue Nov 26 16:10:34 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,132 @@ +@@ -453,3 +456,136 @@ clist.get(contactroot)->playsound(imevent::email); } } @@ -68,6 +68,10 @@ + return loc_charset; + + lang = getenv("LANG"); ++ if (!lang) { ++ strcpy( loc_charset, DEFAULT_CHARSET ); ++ return loc_charset; ++ }; + ch = strrchr( lang, '.' ); + if (!ch) + strcpy( loc_charset, DEFAULT_CHARSET ); @@ -91,8 +95,8 @@ +char *StrToUtf8( const char *inbuf ) +{ + size_t length = strlen( inbuf ); -+ size_t outmaxlength = length * 4; /* FIXME: Is x4 multiplier enoght? */ -+ char *outbuf = (char*) malloc( outmaxlength + 1 ); ++ size_t outmaxlength = UTF8_BUF_LENGTH; ++ char *outbuf = utf8_buf; + char *outbuf_save = outbuf; + int ret; + @@ -111,9 +115,9 @@ +std::string StrToUtf8( const std::string &instr ) +{ + size_t length = instr.length(); -+ size_t outmaxlength = length * 4; /* FIXME: Is x4 multiplier enoght? */ ++ size_t outmaxlength = UTF8_BUF_LENGTH; + const char *inbuf = instr.c_str(); -+ char *outbuf = (char*) malloc( outmaxlength + 1 ); ++ char *outbuf = utf8_buf; + char *outbuf_save = outbuf; + int ret; + @@ -134,8 +138,8 @@ +char *Utf8ToStr( const char *inbuf ) +{ + size_t length = strlen( inbuf ); -+ size_t outmaxlength = length; -+ char *outbuf = (char*) malloc( outmaxlength + 1 ); ++ size_t outmaxlength = UTF8_BUF_LENGTH / 4; ++ char *outbuf = utf8_buf; + char *outbuf_save = outbuf; + int ret; + @@ -153,9 +157,9 @@ +std::string Utf8ToStr( const std::string &instr ) +{ + size_t length = instr.length(); -+ size_t outmaxlength = length; + const char *inbuf = instr.c_str(); -+ char *outbuf = (char*) malloc( outmaxlength + 1 ); ++ size_t outmaxlength = UTF8_BUF_LENGTH / 4; ++ char *outbuf = utf8_buf; + char *outbuf_save = outbuf; + int ret; + diff --git a/net-im/centericq/files/patch-utf8conv.h b/net-im/centericq/files/patch-utf8conv.h index ece334f978df..838fe7c819be 100644 --- a/net-im/centericq/files/patch-utf8conv.h +++ b/net-im/centericq/files/patch-utf8conv.h @@ -1,13 +1,13 @@ --- src/hooks/utf8conv.h Thu Jan 1 08:00:00 1970 -+++ src/hooks/utf8conv.h Tue Nov 19 15:19:44 2002 -@@ -0,0 +1,56 @@ ++++ src/hooks/utf8conv.h Tue Nov 26 16:10:40 2002 +@@ -0,0 +1,58 @@ +/*-------------------------------------------------------*/ +/* utf8conv.h ( Utf8 Converter ) */ +/*-------------------------------------------------------*/ +/* target : Converting Utf8 from/to string/char */ +/* modifier : clsung@dragon2.net */ +/* create : unknown */ -+/* update : 02/11/19 */ ++/* update : 02/11/26 */ +/*-------------------------------------------------------*/ +#ifndef _UTF8CONV_ +#define _UTF8CONV_ @@ -21,8 +21,10 @@ +#endif +#include <string> +#define DEFAULT_CHARSET "ISO-8859-1" ++#define UTF8_BUF_LENGTH 2048 +/* charset name cache buffer */ +static char loc_charset[32]; ++static char utf8_buf[UTF8_BUF_LENGTH]; // max 401 length or per message +/* +** Name: safe_iconv +** Purpose: 'Fault-tolerant' version if iconv. Replaces invalid seq with '?' |