Skip to content

Commit

Permalink
Inline pack_begin.h/pack_end.h to avoid MSVC Warning C4103
Browse files Browse the repository at this point in the history
  • Loading branch information
obligaron authored and glebm committed Nov 2, 2023
1 parent 45627e9 commit 7c2924d
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 69 deletions.
15 changes: 13 additions & 2 deletions libmpq/explode.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,14 @@
#define LIBMPQ_PKZIP_CMP_BAD_DATA 3
#define LIBMPQ_PKZIP_CMP_ABORT 4

#include "pack_begin.h"
#ifdef _MSC_VER
#pragma pack(push,1)
#define PACK_STRUCT
#else
/* we assume GNU here */
#define PACK_STRUCT __attribute__((packed))
#endif

/* compression structure. */
typedef struct {
uint32_t offs0000; /* 0000 - start. */
Expand Down Expand Up @@ -66,7 +73,11 @@ typedef struct {
uint8_t clen_bits[0x10]; /* 3104 - number of valid bits for copied block. */
uint16_t len_base[0x10]; /* 3114 - buffer. */
} PACK_STRUCT pkzip_cmp_s;
#include "pack_end.h"

#ifdef _MSC_VER
#pragma pack(pop)
#endif
#undef PACK_STRUCT

/* data structure. */
typedef struct {
Expand Down
15 changes: 13 additions & 2 deletions libmpq/mpq-internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,14 @@
#define TRUE 1
#endif

#include "pack_begin.h"
#ifdef _MSC_VER
#pragma pack(push,1)
#define PACK_STRUCT
#else
/* we assume GNU here */
#define PACK_STRUCT __attribute__((packed))
#endif

/* mpq archive header. */
typedef struct {
uint32_t mpq_magic; /* the 0x1A51504D ('MPQ\x1A') signature. */
Expand Down Expand Up @@ -119,7 +126,11 @@ typedef struct {
uint32_t block_table_indices; /* real mapping for file number to block entry. */
uint32_t block_table_diff; /* block table difference between valid blocks and invalid blocks before. */
} PACK_STRUCT mpq_map_s;
#include "pack_end.h"

#ifdef _MSC_VER
#pragma pack(pop)
#endif
#undef PACK_STRUCT

/* archive structure used since diablo 1.00 by blizzard. */
struct mpq_archive {
Expand Down
34 changes: 0 additions & 34 deletions libmpq/pack_begin.h

This file was deleted.

31 changes: 0 additions & 31 deletions libmpq/pack_end.h

This file was deleted.

0 comments on commit 7c2924d

Please sign in to comment.