Julian Brierley ([EMAIL PROTECTED]) wrote: > Hans-Juergen Taenzer wrote:
>> doing some tests with the new version, I have encountered a >> problem: >> >> void testva(void) >> { >> char *s; >> unsigned long ul1 = 0x7FFFFFFF; >> unsigned long ul2 = 0xFFFFFFFF; >> >> s = sqlite3_mprintf("%lu", ul1); >> printf("ul1: %lx, %s\n", ul1, s); >> >> s = sqlite3_mprintf("%lu", ul2); >> printf("ul2: %lx, %s\n", ul2, s); >> >> printf("sizeof(unsigned long): %u\n", sizeof(unsigned long)); >> } >> >> Output is: >> >> ul1: 7fffffff, 2147483647 >> ul2: ffffffff, 18446744073709551615 >> sizeof(unsigned long): 4 >> >> Is this the expected behavior? Compiler is MSVC 6. > Perhaps if the two lines of code starting at 349 in printf.c were > changed from: > else if( flag_long ) longvalue = va_arg(ap,long int); > else longvalue = va_arg(ap,int); > to somthing like: > else if( flag_long ) > { > if (infop->flags & FLAG_SIGNED) > longvalue = va_arg(ap,long int); > else > longvalue = va_arg(ap,unsigned long int); > } > else > { > if (infop->flags & FLAG_SIGNED) > longvalue = va_arg(ap,int); > else > longvalue = va_arg(ap,unsigned int); > } > You would get what you expect for %lu and %u? > ul1: 7fffffff, 2147483647 > ul2: ffffffff, 4294967295 I haven't tried it yet. I think this function (or the workhorse vxprintf) is very important for sqlite. I think its to dangerous to change without good knowledge of sqlite. I've opened a ticket. The different behavior between 2.8 and 3.0 makes it somewhat difficult to migrate my databases to sqlite 3.0. Hans-Jürgen --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]