Skip to content

Serialisation output differs between x86-64 and 32 bit ARM #4

@GoogleCodeExporter

Description

@GoogleCodeExporter
What steps will reproduce the problem?
1. Compile and run the attached program on x86-64 and ARM
2. Compare outputs
3. Be sad

What is the expected output? What do you see instead?
The expected output is: 
92 DC 00 1B 57 BB 32 30 31 34 2F 30 32 2F 30 33 20 31 31 3A 30 35 3A 32 37 2E 
35 34 39 39 39 39 32 01 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 DC 00 
1B 57 BB 32 30 31 34 2F 
30 32 2F 30 33 20 31 31 3A 30 35 3A 32 37 2E 35 34 39 39 39 39 32 01 00 00 00 
00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 
The received (ARM) output is:
92 DC 00 1B 57 BB 32 30 31 34 2F 30 32 2F 30 33 20 31 31 3A 30 35 3A 32 37 2E 
35 34 39 39 39 39 32 01 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1B 
00 57 BB 32 30 31 34 2F 
30 32 2F 30 33 20 31 31 3A 30 35 3A 32 37 2E 35 34 39 39 39 39 32 01 00 00 00 
00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 
Note the difference after the first run of zeroes.

What version of the product are you using? On what operating system?
Compiled from source retrieved 2nd Feb 2014, compiled on Ubuntu 13.10, (also 
cross compiled for arm926ej)

Please provide any additional information below.
I'm not sure if this is simply a 32 bit vs 64 bit problem, the ARM part might 
be red herring. Both systems
are little endian, so it's not that.

The function that generated this output:

void sertest(void)
{
    int k,i,ii;
    msgpack_p *p = msgpack_pack_init();
    msgpack_pack_array(p, 2);
    for (i = 0; i < 2; i++)
    {
        msgpack_pack_array(p, 27);
        msgpack_pack_uint16(p, 87);
        msgpack_pack_str(p, "2014/02/03 11:05:27.5499992");
        msgpack_pack_int8 (p, (char) 1);
        for (ii = 0; ii < 24; ii++)
            msgpack_pack_uint16(p, 0);
    }
    const uint8_t * buf;
    uint32_t len;
    msgpack_get_buffer(p, &buf, &len);
    for ( k = 0; k < len; ++k )
    printf( "%02X ", buf[k] );
    printf( "\n len was %d \n", len );
}

Original issue reported on code.google.com by mich...@steelcode.com on 4 Feb 2014 at 12:59

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions