pack structures in portable fashion, now creates valid bitmap headers for Windows

This commit is contained in:
Robin Stuart 2016-09-10 18:35:45 +01:00
parent 6dbf817ffa
commit 71a30a9031
2 changed files with 18 additions and 22 deletions

View File

@ -43,16 +43,14 @@ extern "C" {
#include <stdint.h>
#endif
#pragma pack (1)
typedef struct bitmap_file_header {
uint16_t header_field;
uint32_t file_size;
uint32_t reserved;
uint32_t data_offset;
}
#ifdef __GNUC__
__attribute__((__packed__))
#endif
bitmap_file_header_t;
} bitmap_file_header_t;
typedef struct bitmap_info_header {
uint32_t header_size;
@ -66,11 +64,9 @@ extern "C" {
int32_t vert_res;
uint32_t colours;
uint32_t important_colours;
}
#ifdef __GNUC__
__attribute__((__packed__))
#endif
bitmap_info_header_t;
} bitmap_info_header_t;
#pragma pack ()
#ifdef __cplusplus
}

View File

@ -43,6 +43,8 @@ extern "C" {
#include <stdint.h>
#endif
#pragma pack (1)
typedef struct pcx_header {
uint8_t manufacturer;
uint8_t version;
@ -62,11 +64,9 @@ extern "C" {
uint16_t horiz_screen_size;
uint16_t vert_screen_size;
uint8_t filler[54];
}
#ifdef __GNUC__
__attribute__((__packed__ ))
#endif
pcx_header_t;
} pcx_header_t;
#pragma pack ()
#ifdef __cplusplus
}