Skip to content

Commit

Permalink
FIX: suppress msvc's C4334 warnings in the Brotli source
Browse files Browse the repository at this point in the history
  • Loading branch information
Oldes committed Apr 16, 2024
1 parent 0de1752 commit 01bccc0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/core/brotli/enc/encode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1836,6 +1836,7 @@ size_t BrotliEncoderEstimatePeakMemoryUsage(int quality, int lgwin,
if (params.quality == FAST_ONE_PASS_COMPRESSION_QUALITY ||
params.quality == FAST_TWO_PASS_COMPRESSION_QUALITY) {
size_t state_size = sizeof(BrotliEncoderState);
#pragma warning(suppress: 4334)
size_t block_size = BROTLI_MIN(size_t, input_size, (1ul << params.lgwin));
size_t hash_table_size =
HashTableSize(MaxHashTableSize(params.quality), block_size);
Expand All @@ -1853,6 +1854,7 @@ size_t BrotliEncoderEstimatePeakMemoryUsage(int quality, int lgwin,
size_t short_ringbuffer_size = (size_t)1 << params.lgblock;
int ringbuffer_bits = ComputeRbBits(&params);
size_t ringbuffer_size = input_size < short_ringbuffer_size ?
#pragma warning(suppress: 4334)
input_size : (1u << ringbuffer_bits) + short_ringbuffer_size;
size_t hash_size[4] = {0};
size_t metablock_size =
Expand Down Expand Up @@ -1981,3 +1983,4 @@ size_t MakeUncompressedStreamForTest(
#if defined(__cplusplus) || defined(c_plusplus)
} /* extern "C" */
#endif

5 changes: 5 additions & 0 deletions src/core/brotli/enc/hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#ifndef BROTLI_ENC_HASH_H_
#define BROTLI_ENC_HASH_H_

#pragma warning(disable : 4334)

#include <stdlib.h> /* exit */
#include <string.h> /* memcmp, memset */

Expand Down Expand Up @@ -722,8 +724,11 @@ static BROTLI_INLINE size_t LookupAllCompoundDictionaryMatches(
return total_found;
}


#if defined(__cplusplus) || defined(c_plusplus)
} /* extern "C" */
#endif

#pragma warning(default : 4334)

#endif /* BROTLI_ENC_HASH_H_ */

0 comments on commit 01bccc0

Please sign in to comment.