Ticket #910: Map_alignment_error_fix.2.patch

File Map_alignment_error_fix.2.patch, 6.2 KB (added by arpysystems, 10 years ago)

SVN Patch file for correcting the byte alignment problem for WIN32 gcc compilers

  • navit/file.c

     
    7878
    7979static struct cache *file_cache;
    8080
    81 #ifdef _MSC_VER
     81#if defined (_MSC_VER) || defined (HAVE_API_WIN32) || defined (HAVE_API_WIN32_CE)
     82/* some compilers like cegcc don't honor the __attribute__(packed), so we need pragma to work */
    8283#pragma pack(push,1)
    83 #endif /* _MSC_VER */
     84#endif
    8485struct file_cache_id {
    8586        long long offset;
    8687        int size;
    8788        int file_name_id;
    8889        int method;
    89 #ifndef _MSC_VER
    90 }__attribute__ ((packed));
    91 #else /* _MSC_VER */
     90#if defined (_MSC_VER) || defined (HAVE_API_WIN32) || defined (HAVE_API_WIN32_CE)
    9291};
    9392#pragma pack(pop)
    94 #endif /* _MSC_VER */
     93#else
     94}__attribute__ ((packed));
     95#endif
    9596
    9697#ifdef HAVE_SOCKET
    9798static int
  • navit/zipfile.h

     
    1818 */
    1919
    2020#ifndef __ZIPFILE_H__
    21 #ifdef HAVE_API_WIN32_CE
    22 /* cegcc doesn't honor the __attribute__(packed) need pragma to work */
    23 #pragma pack(push)
    24 #pragma pack(1)
    25 #endif
    2621
    2722#define zip_split_sig 0x08074b50
    2823
     
    3227
    3328#define zip_lfh_sig 0x04034b50
    3429
    35 #ifdef _MSC_VER
     30#if defined (_MSC_VER) || defined (HAVE_API_WIN32) || defined (HAVE_API_WIN32_CE)
     31/* some compilers like cegcc don't honor the __attribute__(packed), so we need pragma to work */
    3632#pragma pack(push,1)
    37 #endif /* _MSC_VER */
     33#endif
    3834struct zip_lfh {
    3935        int ziplocsig;
    4036        short zipver;           // 4
     
    4844        unsigned short zipfnln; // 26
    4945        unsigned short zipxtraln; // 30
    5046        char zipname[0]; // 34
    51 #ifndef _MSC_VER
    52 }__attribute__ ((packed));
    53 #else /* _MSC_VER */
     47#if defined (_MSC_VER) || defined (HAVE_API_WIN32) || defined (HAVE_API_WIN32_CE)
    5448};
    5549#pragma pack(pop)
    56 #endif /* _MSC_VER */
     50#else
     51}__attribute__ ((packed));
     52#endif
    5753
    5854#define zip_cd_sig 0x02014b50
    5955
    60 #ifdef _MSC_VER
     56#if defined (_MSC_VER) || defined (HAVE_API_WIN32) || defined (HAVE_API_WIN32_CE)
     57/* some compilers like cegcc don't honor the __attribute__(packed), so we need pragma to work */
    6158#pragma pack(push,1)
    62 #endif /* _MSC_VER */
     59#endif
    6360struct zip_cd {
    6461        int zipcensig;
    6562        char zipcver;
     
    8178        unsigned int zipext;
    8279        unsigned int zipofst;
    8380        char zipcfn[0];
    84 #ifndef _MSC_VER
    85 }__attribute__ ((packed));
    86 #else /* _MSC_VER */
     81#if defined (_MSC_VER) || defined (HAVE_API_WIN32) || defined (HAVE_API_WIN32_CE)
    8782};
    8883#pragma pack(pop)
    89 #endif /* _MSC_VER */
     84#else
     85}__attribute__ ((packed));
     86#endif
    9087
    9188
    92 #ifdef _MSC_VER
     89#if defined (_MSC_VER) || defined (HAVE_API_WIN32) || defined (HAVE_API_WIN32_CE)
     90/* some compilers like cegcc don't honor the __attribute__(packed), so we need pragma to work */
    9391#pragma pack(push,1)
    94 #endif /* _MSC_VER */
     92#endif
    9593struct zip_cd_ext {
    9694        short tag;
    9795        short size;
    9896        unsigned long long zipofst;
    99 #ifndef _MSC_VER
    100 }__attribute__ ((packed));
    101 #else /* _MSC_VER */
     97#if defined (_MSC_VER) || defined (HAVE_API_WIN32) || defined (HAVE_API_WIN32_CE)
    10298};
    10399#pragma pack(pop)
    104 #endif /* _MSC_VER */
     100#else
     101}__attribute__ ((packed));
     102#endif
    105103
    106 #ifdef _MSC_VER
     104#if defined (_MSC_VER) || defined (HAVE_API_WIN32) || defined (HAVE_API_WIN32_CE)
     105/* some compilers like cegcc don't honor the __attribute__(packed), so we need pragma to work */
    107106#pragma pack(push,1)
    108 #endif /* _MSC_VER */
     107#endif
    109108struct zip_enc {
    110109        short efield_header;
    111110        short efield_size;
     
    113112        char vendor_id1,vendor_id2;
    114113        char encryption_strength;
    115114        short compress_method;
    116 #ifndef _MSC_VER
    117 }__attribute__ ((packed));
    118 #else /* _MSC_VER */
     115#if defined (_MSC_VER) || defined (HAVE_API_WIN32) || defined (HAVE_API_WIN32_CE)
    119116};
    120117#pragma pack(pop)
    121 #endif /* _MSC_VER */
     118#else
     119}__attribute__ ((packed));
     120#endif
    122121
    123122#define zip_eoc_sig 0x6054b50
    124123
    125 #ifdef _MSC_VER
     124#if defined (_MSC_VER) || defined (HAVE_API_WIN32) || defined (HAVE_API_WIN32_CE)
     125/* some compilers like cegcc don't honor the __attribute__(packed), so we need pragma to work */
    126126#pragma pack(push,1)
    127 #endif /* _MSC_VER */
     127#endif
    128128struct zip_eoc {
    129129        int zipesig;            /* end of central dir signature */
    130130        unsigned short zipedsk; /* number of this disk */
     
    135135        unsigned int zipeofst;  /* offset of start of central directory with respect to the starting disk number */
    136136        short zipecoml;         /* .ZIP file comment length */
    137137        char zipecom[0];        /* .ZIP file comment */
    138 #ifndef _MSC_VER
    139 }__attribute__ ((packed));
    140 #else /* _MSC_VER */
     138#if defined (_MSC_VER) || defined (HAVE_API_WIN32) || defined (HAVE_API_WIN32_CE)
    141139};
    142140#pragma pack(pop)
    143 #endif /* _MSC_VER */
     141#else
     142}__attribute__ ((packed));
     143#endif
    144144
    145145#define zip64_eoc_sig 0x6064b50
    146146
    147 #ifdef _MSC_VER
     147#if defined (_MSC_VER) || defined (HAVE_API_WIN32) || defined (HAVE_API_WIN32_CE)
     148/* some compilers like cegcc don't honor the __attribute__(packed), so we need pragma to work */
    148149#pragma pack(push,1)
    149 #endif /* _MSC_VER */
     150#endif
    150151struct zip64_eoc {
    151152        int zip64esig;                  /* zip64 end of central dir signature */
    152153        unsigned long long zip64esize;  /* size of zip64 end of central directory record */
     
    159160        unsigned long long zip64ecsz;   /* size of the central directory */
    160161        unsigned long long zip64eofst;  /* offset of start of central directory with respect to the starting disk number */
    161162        char zip64ecom[0];              /* zip64 extensible data sector */
    162 #ifndef _MSC_VER
    163 }__attribute__ ((packed));
    164 #else /* _MSC_VER */
     163#if defined (_MSC_VER) || defined (HAVE_API_WIN32) || defined (HAVE_API_WIN32_CE)
    165164};
    166165#pragma pack(pop)
    167 #endif /* _MSC_VER */
     166#else
     167}__attribute__ ((packed));
     168#endif
    168169
    169170#define zip64_eocl_sig 0x07064b50
    170171
    171 #ifdef _MSC_VER
     172#if defined (_MSC_VER) || defined (HAVE_API_WIN32) || defined (HAVE_API_WIN32_CE)
     173/* some compilers like cegcc don't honor the __attribute__(packed), so we need pragma to work */
    172174#pragma pack(push,1)
    173 #endif /* _MSC_VER */
     175#endif
    174176struct zip64_eocl {
    175177        int zip64lsig;
    176178        int zip64ldsk;
    177179        long long zip64lofst;
    178180        int zip74lnum;
    179 #ifndef _MSC_VER
    180 }__attribute__ ((packed));
    181 #else /* _MSC_VER */
     181#if defined (_MSC_VER) || defined (HAVE_API_WIN32) || defined (HAVE_API_WIN32_CE)
    182182};
    183183#pragma pack(pop)
    184 #endif /* _MSC_VER */
     184#else
     185}__attribute__ ((packed));
     186#endif
    185187
    186188#define __ZIPFILE_H__
    187 #ifdef __CEGCC__
    188 #pragma pack(pop)
    189 #endif
    190189
    191190#endif