Changeset 181 for trunk

Show
Ignore:
Timestamp:
07/12/07 15:06:51 (17 months ago)
Author:
zany
Message:

portable packed structs

Location:
trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/bfb/bfb.h

    r114 r181  
    3838#define BFB_LOG_DOMAIN  "bfb" 
    3939 
     40#ifdef __GNUC__ 
     41#define PACKED __attribute__ ((packed)) 
     42#else 
     43#define PACKED 
     44#endif 
     45 
     46#pragma pack(1) 
    4047typedef struct { 
    4148        uint8_t type; 
     
    4451        uint8_t payload[0]; /* ... up to 32 */ 
    4552        /* uint8_t xor; ? */ 
    46 } __attribute__((packed)) bfb_frame_t; 
     53} PACKED bfb_frame_t; 
     54#pragma pack() 
    4755 
     56#pragma pack(1) 
    4857typedef struct { 
    4958        uint8_t cmd; 
     
    5463        uint8_t data[0]; /* ... up to 518 ? */ 
    5564        /* uint16_t crc; */ 
    56 } __attribute__((packed)) bfb_data_t; 
     65} PACKED bfb_data_t; 
     66#pragma pack() 
    5767 
    5868 
  • trunk/obexftp/client.c

    r179 r181  
    8888 
    8989 
     90#ifdef __GNUC__ 
     91#define PACKED __attribute__ ((packed)) 
     92#else 
     93#define PACKED 
     94#endif 
     95 
     96#pragma pack(1) 
    9097typedef struct { /* fixed to 6 bytes for now */ 
    9198        uint8_t code; 
    9299        uint8_t info_len; 
    93100        uint8_t info[4]; 
    94 } __attribute__((packed)) apparam_t; 
     101} PACKED apparam_t; 
     102#pragma pack() 
    95103 
    96104#ifdef _WIN32