the valueint,valuedouble always get 0 on PowerPC · Issue #1 · DaveGamble/cJSON · GitHub
Skip to content

the valueint,valuedouble always get 0 on PowerPC  #1

Description

@renshuo

env:
system: Freescale T4240
QorIQ SDK: QorIQ-SDK-V1.6-20140619-yocto
linux: Linux t4240qds 3.12.19-rt30-QorIQ-SDK-V1.6+gc29fe1a #5 SMP Thu Jan 15 02:16:53 UTC 2015 ppc64 GNU/Linux

problem:
I use cJSON on a T4240 machine.the code like this:

      cJSON* fs = cJSON_GetObjectItem(context, "frameSize"); 
      printf("val: %d %f\n", fs->valueint, fs->valuedouble);

always print:
val: 0 0.000000f
but the code run very well on my PC(GentooLinux, intel I7).

resolve:
modify cJSON.h, add "#pragma pack(1)" before define cJSON struct:

#pragma pack(1)
/* The cJSON structure: */
typedef struct cJSON {

but I don't know why it happen.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions