FreeBSD Bugzilla – Attachment 26860 Details for
Bug 45741
[PATCH] centericq MSN UTF-8 (fixed getenv("LANG"))
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 3.80 KB, created by
Cheng-Lung Sung
on 2002-11-26 08:30:01 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
Cheng-Lung Sung
Created:
2002-11-26 08:30:01 UTC
Size:
3.80 KB
patch
obsolete
>diff -ruN /usr/ports/net/centericq/files/patch-msnhook.cc /tmp/centericq/files/patch-msnhook.cc >--- /usr/ports/net/centericq/files/patch-msnhook.cc Mon Nov 25 10:26:43 2002 >+++ /tmp/centericq/files/patch-msnhook.cc Tue Nov 26 16:13:38 2002 >@@ -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 -ruN /usr/ports/net/centericq/files/patch-utf8conv.h /tmp/centericq/files/patch-utf8conv.h >--- /usr/ports/net/centericq/files/patch-utf8conv.h Tue Nov 19 16:45:53 2002 >+++ /tmp/centericq/files/patch-utf8conv.h Tue Nov 26 16:13:42 2002 >@@ -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 '?'
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 45741
: 26860