Compiling errors on F11 64-bit; question on sending in patch files

J. Alex Aycinena alex.aycinena at gmail.com
Tue Jul 21 00:40:02 EDT 2009


Hi Christian,

On Sun, Jul 19, 2009 at 5:20 PM, J. Alex
Aycinena<alex.aycinena at gmail.com> wrote:
> Hi Christian,
>
> 2009/7/19 Christian Stimming <stimming at tuhh.de>:
>> Hi Alex,
>>
>> thanks for pointing this out. Apparently you've run into one very nasty thing
>> in the C language: It is unspecificed whether a "char" is signed or not. That
>> is, in one compiler a "char" is a "signed char" whereas on another compiler
>> it is an "unsigned char".
>>

snip

>> In this case, the actual long-term solution is to replace the "unsigned char"
>> by a "gchar". In gnc-date.c:831 this seems to be rather easy. This is clearly
>> preferred to a bunch of casts. If you have enough time to implement the type
>> change, a patch for this would indeed be very welcome.
>>
>
The following files had type discrepancies that were causing compiler
warnings that were resolved by changing a type declaration:

       src/backend/xml/io-example-account.c
       src/backend/xml/sixtp-dom-parsers.c
       src/backend/xml/sixtp-utils.c
       src/backend/xml/sixtp-dom-parsers.h
       src/backend/xml/sixtp.c
       src/libqof/qof/guid.c
       src/libqof/qof/gnc-date.c
       src/libqof/qof/qofutil.c
       src/libqof/qof/qofutil.h
       src/calculation/expression_parser.c
       src/gnome-utils/gnc-date-edit.c
       src/gnome-utils/gnc-dense-cal.h
       src/gnome-utils/gnc-menu-extensions.c

The following files had type discrepancies that were causing compiler
warnings that could not be resolved by changing a type declaration;
instead casting was used:

1 - src/register/register-gnome/gnucash-item-edit.c
The variable 'sel' is set with 'gtk_selection_data_get_text' which
returns a 'guchar *'; 'sel' is then used by functions
'gtk_editable_insert_text' and 'strlen' which require 'gchar *', so
there is no alternative but to cast.

2 - src/backend/xml/gnc-budget-xml-v2.c
The functions 'xmlNewNode'and 'xmlSetProp' require arguments that are
of type 'const xmlChar *' but the arguments are string literals (char
*). Can string literals be set up as type 'const xmlChar *'? The
patchfile has them being cast. BAD_CAST is defined for this purpose.

3 - src/backend/xml/gnc-schedxaction-xml-v2.c
Like above, the function 'xmlNewNode' requires arguments that are of
type 'const xmlChar *' but the arguments are string literals (char *).
In the three other changes the type 'const xmlChar *' needs to be
changed to 'char *' to be used by 'strcmp'.

4 - src/backend/xml/gnc-recurrence-xml-v2.c
Like above for the functions 'xmlNewNode'and 'xmlSetProp'.

5 - src/html/gnc-html-graph-gog-webkit.c
The function 'g_base64_encode' requires type 'guchar *' for the
argument and changing the variable to this caused other problems so
used casting instead.

6 - src/libqof/backend/file/qsf-xml-map.c (6 occurances)
The first occurance was solved by changing the type declaration, but
the other 5 required casting.

I attach a patchfile with the changes. If it looks Ok to you I would
be grateful if you could apply it.

Thanks,

Alex
-------------- next part --------------
A non-text attachment was scrubbed...
Name: type-discrepancy-patchfile
Type: application/octet-stream
Size: 13678 bytes
Desc: not available
URL: <http://lists.gnucash.org/pipermail/gnucash-devel/attachments/20090720/a079e90d/attachment.obj>


More information about the gnucash-devel mailing list