"Barrass, Richard" <[EMAIL PROTECTED]> wrote:
>  
> mingw-win32 compiler (GCC v3.4.2). Our test application works fine with
> our small (~22k) test database.
>  
> However, on our embedded platform (ARM 9) with the following
> configuration
>  
> Code-sourcey arm-none-eabi cross compiler (GCC v3.4.4) running with
> newlib. we have errors reading the database.
>  
> We can read the sqlite_master table, but as soon as we try and read
> anything else, we get an error 11 (malformed database). Detailed
> inspection of the file IO shows this to be binary equivalent on both
> platforms, but when reading the 'root page column' from sqlite_master
> table, the number seen as table '2' on the working platform, became
> 8589934594 (or in Hex, 0x200000002)
>  
> A similar corruption was seen for the other tables - table 3 ->
> 0x300000003, table 4 ->0x400000004.
>  

The following code snippet is from vdbeaux.c:

  int sqlite3VdbeSerialGet(
    const unsigned char *buf,
    u32 serial_type,
    Mem *pMem
  ){
    switch( serial_type ){
      case 10:
      case 11:
      case 0: { 
        pMem->flags = MEM_Null;
        break;
      }
      case 1: {
        pMem->i = (signed char)buf[0];  /****** TROUBLE HERE? ****/
        pMem->flags = MEM_Int;
        return 1;
      }

I put a comment on the line I suspect is malfunctioning.
This is where the integer value '2' gets read out of the
database file and into a 64-bit integer in memory.
pMem->i is a long long int, and buf[0] is a character.
I'm guessing your compiler is not doing the conversion
quite right.

Can you run in the debugger on the ARM and see what
is happening?  If you don't have  debugger on the ARM,
can you at least use some printf()s to see what is going
on at that point?
--
D. Richard Hipp   <[EMAIL PROTECTED]>


-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to