Skip to content

Commit edc251c

Browse files
committed
Add padding to structures so it continues to work if features differ
1 parent 9ffbe56 commit edc251c

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

miniz_common.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ typedef int mz_bool;
3636
#ifdef MINIZ_NO_TIME
3737
typedef struct mz_dummy_time_t_tag
3838
{
39-
int m_dummy;
39+
mz_uint32 m_dummy1;
40+
mz_uint32 m_dummy2;
4041
} mz_dummy_time_t;
4142
#define MZ_TIME_T mz_dummy_time_t
4243
#else

miniz_zip.h

+12-7
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@ typedef struct
3232
mz_uint16 m_bit_flag;
3333
mz_uint16 m_method;
3434

35-
#ifndef MINIZ_NO_TIME
36-
MZ_TIME_T m_time;
37-
#endif
38-
3935
/* CRC-32 of uncompressed data. */
4036
mz_uint32 m_crc32;
4137

@@ -72,6 +68,11 @@ typedef struct
7268
/* Guaranteed to be zero terminated, may be truncated to fit. */
7369
char m_comment[MZ_ZIP_MAX_ARCHIVE_FILE_COMMENT_SIZE];
7470

71+
#ifdef MINIZ_NO_TIME
72+
MZ_TIME_T m_padding;
73+
#else
74+
MZ_TIME_T m_time;
75+
#endif
7576
} mz_zip_archive_file_stat;
7677

7778
typedef size_t (*mz_file_read_func)(void *pOpaque, mz_uint64 file_ofs, void *pBuf, size_t n);
@@ -183,9 +184,7 @@ typedef struct
183184
mz_uint flags;
184185

185186
int status;
186-
#ifndef MINIZ_DISABLE_ZIP_READER_CRC32_CHECKS
187-
mz_uint file_crc32;
188-
#endif
187+
189188
mz_uint64 read_buf_size, read_buf_ofs, read_buf_avail, comp_remaining, out_buf_ofs, cur_file_ofs;
190189
mz_zip_archive_file_stat file_stat;
191190
void *pRead_buf;
@@ -195,6 +194,12 @@ typedef struct
195194

196195
tinfl_decompressor inflator;
197196

197+
#ifdef MINIZ_DISABLE_ZIP_READER_CRC32_CHECKS
198+
mz_uint padding;
199+
#else
200+
mz_uint file_crc32;
201+
#endif
202+
198203
} mz_zip_reader_extract_iter_state;
199204

200205
/* -------- ZIP reading */

0 commit comments

Comments
 (0)