mirror of
https://github.com/google/brotli.git
synced 2024-11-22 03:30:07 +00:00
Merge pull request #25 from irori/sign-compare
Make decoder code warning-free
This commit is contained in:
commit
35cd3db9c1
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
include ../shared.mk
|
include ../shared.mk
|
||||||
|
|
||||||
|
CPPFLAGS += -Wall
|
||||||
|
|
||||||
OBJS = bit_reader.o decode.o huffman.o safe_malloc.o streams.o
|
OBJS = bit_reader.o decode.o huffman.o safe_malloc.o streams.o
|
||||||
|
|
||||||
all : $(OBJS)
|
all : $(OBJS)
|
||||||
|
@ -646,7 +646,7 @@ int BrotliDecompressedSize(size_t encoded_size,
|
|||||||
}
|
}
|
||||||
/* Look at the first 8 bytes, it is enough to decode the length of the first
|
/* Look at the first 8 bytes, it is enough to decode the length of the first
|
||||||
meta-block. */
|
meta-block. */
|
||||||
for (i = 0; i < encoded_size && i < 8; ++i) {
|
for (i = 0; (size_t)i < encoded_size && i < 8; ++i) {
|
||||||
val |= (uint64_t)encoded_buffer[i] << (8 * i);
|
val |= (uint64_t)encoded_buffer[i] << (8 * i);
|
||||||
}
|
}
|
||||||
/* Skip the window bits. */
|
/* Skip the window bits. */
|
||||||
@ -683,7 +683,7 @@ int BrotliDecompressedSize(size_t encoded_size,
|
|||||||
both are set to 1, we have a stream with an uncompressed meta-block
|
both are set to 1, we have a stream with an uncompressed meta-block
|
||||||
followed by an empty one, so the decompressed size is the size of the
|
followed by an empty one, so the decompressed size is the size of the
|
||||||
first meta-block. */
|
first meta-block. */
|
||||||
int offset = ((bit_pos + 7) >> 3) + meta_block_len;
|
size_t offset = ((bit_pos + 7) >> 3) + meta_block_len;
|
||||||
if (offset < encoded_size && ((encoded_buffer[offset] & 3) == 3)) {
|
if (offset < encoded_size && ((encoded_buffer[offset] & 3) == 3)) {
|
||||||
*decoded_size = (size_t)meta_block_len;
|
*decoded_size = (size_t)meta_block_len;
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user