mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
* src/mod_irc/iconv_erl.c: Bugfix (thanks to Tomas Janousek)
SVN Revision: 470
This commit is contained in:
parent
689842edf8
commit
5f2de53f01
@ -1,3 +1,7 @@
|
||||
2005-12-14 Alexey Shchepin <alexey@sevcom.net>
|
||||
|
||||
* src/mod_irc/iconv_erl.c: Bugfix (thanks to Tomas Janousek)
|
||||
|
||||
2005-12-13 Alexey Shchepin <alexey@sevcom.net>
|
||||
|
||||
* src/win32/ejabberd.nsi: Updated (thanks to Maxim Ryazanov)
|
||||
|
@ -58,24 +58,32 @@ static int iconv_erl_control(ErlDrvData drv_data,
|
||||
|
||||
cd = iconv_open(to, from);
|
||||
|
||||
if(cd == (iconv_t) -1)
|
||||
{
|
||||
if (cd == (iconv_t) -1) {
|
||||
cd = iconv_open("ascii", "ascii");
|
||||
if(cd == (iconv_t) -1)
|
||||
{
|
||||
cd = iconv_open("ascii", "ascii");
|
||||
}
|
||||
if (cd == (iconv_t) -1) {
|
||||
*rbuf = (char*)(b = driver_alloc_binary(size));
|
||||
memcpy(b->orig_bytes, string, size);
|
||||
|
||||
free(from);
|
||||
free(to);
|
||||
free(string);
|
||||
|
||||
return size;
|
||||
}
|
||||
}
|
||||
|
||||
outleft = avail = 4*size;
|
||||
inleft = size;
|
||||
rtmp = rstring = malloc(avail);
|
||||
iconv(cd, &stmp, &inleft, &rtmp, &outleft);
|
||||
while (inleft > 0) {
|
||||
if (iconv(cd, &stmp, &inleft, &rtmp, &outleft) == (size_t) -1) {
|
||||
stmp++;
|
||||
inleft--;
|
||||
}
|
||||
}
|
||||
|
||||
size = rtmp - rstring;
|
||||
|
||||
//printf("size=%d, res=%s\r\n", size, rstring);
|
||||
|
||||
*rbuf = (char*)(b = driver_alloc_binary(size));
|
||||
memcpy(b->orig_bytes, rstring, size);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user