Skip to content

Commit

Permalink
Fix a warning about an assignment discarding qualifiers
Browse files Browse the repository at this point in the history
By explicitly casting a `const void *` to a `Bytef *`, we get rid of
this warning from Clang:

    src/decompress.c:51:20: warning: assigning to 'Bytef *' (aka
          'unsigned char *') from 'const void *' discards qualifiers
          [-Wincompatible-pointer-types-discards-qualifiers]
        stream.next_in = buf;
                       ^ ~~~
  • Loading branch information
bdesham committed Apr 21, 2015
1 parent 469efba commit 4749efb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/decompress.c
Expand Up @@ -48,7 +48,8 @@ static void *decompress_zlib(const void *buf, const int buf_len,
}

stream.avail_in = buf_len;
stream.next_in = buf;
/* Explicitly cast away the const-ness of buf */
stream.next_in = (Bytef *)buf;

pagesize = getpagesize();
result_size = ((buf_len + pagesize - 1) & ~(pagesize - 1));
Expand Down

0 comments on commit 4749efb

Please sign in to comment.