[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sylpheed
Subject:    [sylpheed:22151] question to the coders on the list (64-bit bug. maybe.)
From:       James Noyes <jnoyes-sylpheed () retrogeeks ! com>
Date:       2003-12-28 1:35:48
[Download RAW message or body]

Hi all,
  Long-time sylpheed user and huge fan here.  This question is for the
coders on the list, regarding a fix I just had to make to sylpheed.  I need to
understand what is actually going on before I declare this to be anything that
needs to be fixed in sylpheed vs. being fixed in iconv vs. being fixed maybe
somewhere else.

First, I run as much code as possible 64-bit.  I have a 64-bit workstation,
and I like to keep my operating environment 64-bit clean whenever possible. 
Sylpheed has been working just fine for me for quite some time compiled
64-bit.  I'll point out that I am not a coder by trade, I just dabble.

I recently upgraded my workstation and re-installed the OS (Solaris).  This
time, however, I didn't choose "C" for my locale, I chose "en_US.ISO8859-15". 
Suddenly, my existing sylpheed binaries started core dumping with a bus error.
References here pertain to 0.9.7, but 0.9.8a is still set up the same way.

I traced the crash I was experiencing to codeconv.c, line 844/845:

while ((n_conv = iconv(cd, (ICONV_CONST gchar **)&inbuf_p, &in_left,
                               &outbuf_p, &out_left)) < 0) {

In sylpheed, in_left and out_left are declared as gint (see lines 804 and 806
of codeconv.c).
But libiconv expects those arguments to be size_t (see line 82 of iconv.h):

extern size_t iconv (iconv_t cd, const char* * inbuf, size_t *inbytesleft,
   char* * outbuf, size_t *outbytesleft);

gcc complains about those arguments being passed from "incompatible" types at
compile-time.  However, gint and size_t are both 64 bits (or 32 when compiled
32-bit).  I have double-checked this several times, by using sizeof() and by
looking at .h files.  How are they "incompatible"?  If I change lines 804 and
806 of codeconv.c to declare in_left and out_left as size_t instead, the crash
goes away.

So after all that, here's my question(s):
Is it ok to change in_left and out_left to size_t?
Why are size_t and gint handled differently, even though they are the same size?
Is this an alignment issue?  It sure seems like one.
Is this a compiler issue?  That seems possible also.
Who do I need to report this to so it gets "fixed".  The sylpheed coders?  The libiconv coders?  The gcc coders maybe?

Thanks in advance for any insight.  I'm a little confused and I really hope
to understand what's going on with this at some point.  Responses to the list
are fine, I read everything that's posted.

-- 
Cheers,
James Noyes
(jnoyes-sylpheed@retrogeeks.com)

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic