gnokii-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

PATCH: remove one hardcoded assumption of sizeof(wchar_t) == 4 in gsm-en


From: Alex Villací­s Lasso
Subject: PATCH: remove one hardcoded assumption of sizeof(wchar_t) == 4 in gsm-encoding.c
Date: Tue, 24 Oct 2006 13:10:44 -0500
User-agent: Thunderbird 1.5.0.7 (X11/20060913)

One line fix:

At line 161 of common/gsm-encoding.c in char_mbtowc(), reserved space for exactly one wchar_t is hardcoded as 4 bytes. This fails to work in cygwin/WinXP where wchar_t is 2 bytes. Replacing 4 with sizeof(wchar_t) fixes it for me.

Changelog:
* Use sizeof(wchar_t) instead of hardcoded 4 for the size of exactly one output wchar_t

Alex Villacís Lasso

--
The following cryptic message was allegedly found in the inner edge of a Windows
XP installation CD:

4F6E65204F5320746F2072756C65207468656D20616C6C2C204F6E65204F5320746F2066696E6420
7468656D2C0D0A4F6E65204F5320746F206272696E67207468656D20616C6C20616E6420696E2074
6865206461726B6E6573732062696E64207468656D2E0A

It is rumored that only a true Unix Wizard can decypher this mysterious message,
which supposedly encodes the true nature and purpose of the software.

diff -ur gnokii-0.6.14/common/gsm-encoding.c 
gnokii-0.6.14-patch/common/gsm-encoding.c
--- gnokii-0.6.14/common/gsm-encoding.c 2006-08-27 17:36:54.000000000 -0500
+++ gnokii-0.6.14-patch/common/gsm-encoding.c   2006-10-24 09:27:32.000000000 
-0500
@@ -158,7 +158,7 @@
        pin = (char *)src;
        pout = (char *)dst;
        inlen = 4;
-       outlen = 4;
+       outlen = sizeof(wchar_t);
 
        cd = iconv_open("WCHAR_T", gn_char_get_encoding());
        nconv = iconv(cd, &pin, &inlen, &pout, &outlen);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]