[prev in list] [next in list] [prev in thread] [next in thread]
List: sylpheed
Subject: [sylpheed:22153] 64-BIT BUGFIX was: Re: question to the coders on the list (64-bit
From: James Noyes <jnoyes-sylpheed () retrogeeks ! com>
Date: 2003-12-28 7:46:38
[Download RAW message or body]
On Sun, 28 Dec 2003 02:07:34 -0500
"James K. Lowden" <jklowden@schemamania.org> wrote:
> size_t on my system is unsigned. What is gint? Sounds signed to me.
> That would be incompatible.
>
gint is just a typedef to int, in glib.h, line 476.
> The arguments passed to iconv(3) should be size_t. As long as the use of
> in_left and out_left doesn't rely on negative values, changing it should
> be fine. Mind, I haven't looked at the code. I'm just telling you what I
> know about iconv.
>
From a few lines earlier in codeconv.c, it looks like in_left and out_left are
both derived from the results of strlen() calls and shouldn't be negative.
> Sylpheed, definitely. The iconv standard is widely implemented, and the
> only variation I've seen is whether or not the input buffer pointer is
> const.
>
After researching this the last few hours, I agree. It turns out that after
double and even triple-checking, my sizeof() checking methods were in error.
gint and size_t ARE in fact different sizes (4 and 8 bytes, respectively) on
64-bit (LP64) machines. Not only that, but strlen() returns a size_t, too. I
went ahead and changed ALL of the gint's in codeconv.c on lines 805-809 to
size_t's, and everything seems fine.
The reason this bug hadn't happened to me before now is that I hadn't used the
code later on in codeconv.c, since I was always using the "C" locale.
Is there any way to get this change incorporated into the distribution?
64-bit machines are going to become more popular in the near future, and this
will eventually bite someone else, maybe even on another platform.
Cheers,
James Noyes
Once again a happy sylpheed user
(jnoyes-sylpheed@retrogeeks.com)
["64-bit-fix.txt" (text/plain)]
*** sylpheed-0.9.8a/src/codeconv.c.64 Sat Dec 27 23:58:22 2003
--- sylpheed-0.9.8a/src/codeconv.c Wed Dec 3 21:52:47 2003
***************
*** 802,812 ****
const gchar *inbuf_p;
gchar *outbuf;
gchar *outbuf_p;
! size_t in_size;
! size_t in_left;
! size_t out_size;
! size_t out_left;
! size_t n_conv;
gint len;
if (!src_code)
--- 802,812 ----
const gchar *inbuf_p;
gchar *outbuf;
gchar *outbuf_p;
! gint in_size;
! gint in_left;
! gint out_size;
! gint out_left;
! gint n_conv;
gint len;
if (!src_code)
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic