|
From: Mike A. <mt...@um...> - 2009-05-22 03:41:00
|
I've been attempting to get libdbi to work on my MacOSX PowerPC machine so I can use it with GnuCash. This has not been working because of an endian bug in dbi_result.c. The methods that return integer values (dbi_result_get_short_idx, dbi_result_get_int_idx, and dbi_result_get_longlong_idx) all assume that they can simply return the member of the field_values union that corresponds to the type they are supposed to return. For example dbi_result_get_int_idx returns field_values[fieldidx].d_long if DBI_INTEGER_SIZEMASK is less than or equal to 4. This won't work on big-endian machines. Instead you need to return the correct member of the union for the value of DBI_INTEGER_SIZEMASK so the compiler knows to cast it to the return type. I've attached a patch to fix this. This patch makes the code bigger, but not much slower. If this is a problem it could be made conditional on the endianess of the target machine, but this didn't seem worth the trouble to me. -- Mike Alexander mt...@um... Ann Arbor, MI PGP key ID: BEA343A6 |