Skip to content

Commit eeba53e

Browse files
committed
Fix -Waddress-of-packed-member in explode.c
explode.c: In function ‘libmpq__do_decompress_pkzip’: explode.c:542:73: warning: taking address of packed member of ‘struct <anonymous>’ may result in an unaligned pointer value [-Waddress-of-packed-member] 542 | mpq_pkzip->in_bytes = mpq_pkzip->read_buf((char *)mpq_pkzip->in_buf, &mpq_pkzip->in_pos, mpq_pkzip->param);
1 parent f5f60c0 commit eeba53e

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

libmpq/explode.c

+7-4
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,9 @@ static int32_t skip_bit(pkzip_cmp_s *mpq_pkzip, uint32_t bits) {
145145
/* load input buffer if necessary. */
146146
mpq_pkzip->bit_buf >>= mpq_pkzip->extra_bits;
147147
if (mpq_pkzip->in_pos == mpq_pkzip->in_bytes) {
148-
mpq_pkzip->in_pos = sizeof(mpq_pkzip->in_buf);
149-
if ((mpq_pkzip->in_bytes = mpq_pkzip->read_buf((char *)mpq_pkzip->in_buf, &mpq_pkzip->in_pos, mpq_pkzip->param)) == 0) {
148+
uint32_t in_pos = sizeof(mpq_pkzip->in_buf);
149+
if ((mpq_pkzip->in_bytes = mpq_pkzip->read_buf((char *)mpq_pkzip->in_buf, &in_pos, mpq_pkzip->param)) == 0) {
150+
mpq_pkzip->in_pos = in_pos;
150151
return 1;
151152
}
152153
mpq_pkzip->in_pos = 0;
@@ -538,8 +539,10 @@ uint32_t libmpq__do_decompress_pkzip(uint8_t *work_buf, void *param) {
538539
mpq_pkzip->read_buf = data_read_input;
539540
mpq_pkzip->write_buf = data_write_output;
540541
mpq_pkzip->param = param;
541-
mpq_pkzip->in_pos = sizeof(mpq_pkzip->in_buf);
542-
mpq_pkzip->in_bytes = mpq_pkzip->read_buf((char *)mpq_pkzip->in_buf, &mpq_pkzip->in_pos, mpq_pkzip->param);
542+
543+
uint32_t in_pos = sizeof(mpq_pkzip->in_buf);
544+
mpq_pkzip->in_bytes = mpq_pkzip->read_buf((char *)mpq_pkzip->in_buf, &in_pos, mpq_pkzip->param);
545+
mpq_pkzip->in_pos = in_pos;
543546

544547
/* check if we have pkzip data. */
545548
if (mpq_pkzip->in_bytes <= 4) {

0 commit comments

Comments
 (0)