Skip to content

Commit

Permalink
Fix -Waddress-of-packed-member in explode.c
Browse files Browse the repository at this point in the history
    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);
  • Loading branch information
glebm committed Nov 1, 2021
1 parent f5f60c0 commit eeba53e
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions libmpq/explode.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,9 @@ static int32_t skip_bit(pkzip_cmp_s *mpq_pkzip, uint32_t bits) {
/* load input buffer if necessary. */
mpq_pkzip->bit_buf >>= mpq_pkzip->extra_bits;
if (mpq_pkzip->in_pos == mpq_pkzip->in_bytes) {
mpq_pkzip->in_pos = sizeof(mpq_pkzip->in_buf);
if ((mpq_pkzip->in_bytes = mpq_pkzip->read_buf((char *)mpq_pkzip->in_buf, &mpq_pkzip->in_pos, mpq_pkzip->param)) == 0) {
uint32_t in_pos = sizeof(mpq_pkzip->in_buf);
if ((mpq_pkzip->in_bytes = mpq_pkzip->read_buf((char *)mpq_pkzip->in_buf, &in_pos, mpq_pkzip->param)) == 0) {
mpq_pkzip->in_pos = in_pos;
return 1;
}
mpq_pkzip->in_pos = 0;
Expand Down Expand Up @@ -538,8 +539,10 @@ uint32_t libmpq__do_decompress_pkzip(uint8_t *work_buf, void *param) {
mpq_pkzip->read_buf = data_read_input;
mpq_pkzip->write_buf = data_write_output;
mpq_pkzip->param = param;
mpq_pkzip->in_pos = sizeof(mpq_pkzip->in_buf);
mpq_pkzip->in_bytes = mpq_pkzip->read_buf((char *)mpq_pkzip->in_buf, &mpq_pkzip->in_pos, mpq_pkzip->param);

uint32_t in_pos = sizeof(mpq_pkzip->in_buf);
mpq_pkzip->in_bytes = mpq_pkzip->read_buf((char *)mpq_pkzip->in_buf, &in_pos, mpq_pkzip->param);
mpq_pkzip->in_pos = in_pos;

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

0 comments on commit eeba53e

Please sign in to comment.