Skip to content

Commit 4e13b41

Browse files
RaMdsCjuj
authored andcommitted
Fix VLA parameter warning (google#893)
Make VLA buffer types consistent in declarations and definitions. Resolves build crash when using -Werror due to "vla-parameter" warning. Signed-off-by: Adrian Herrera <[email protected]>
1 parent ade5e15 commit 4e13b41

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

c/dec/decode.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2033,8 +2033,10 @@ static BROTLI_NOINLINE BrotliDecoderErrorCode SafeProcessCommands(
20332033
}
20342034

20352035
BrotliDecoderResult BrotliDecoderDecompress(
2036-
size_t encoded_size, const uint8_t* encoded_buffer, size_t* decoded_size,
2037-
uint8_t* decoded_buffer) {
2036+
size_t encoded_size,
2037+
const uint8_t encoded_buffer[BROTLI_ARRAY_PARAM(encoded_size)],
2038+
size_t* decoded_size,
2039+
uint8_t decoded_buffer[BROTLI_ARRAY_PARAM(*decoded_size)]) {
20382040
BrotliDecoderState s;
20392041
BrotliDecoderResult result;
20402042
size_t total_out = 0;

c/enc/encode.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1470,8 +1470,9 @@ static size_t MakeUncompressedStream(
14701470

14711471
BROTLI_BOOL BrotliEncoderCompress(
14721472
int quality, int lgwin, BrotliEncoderMode mode, size_t input_size,
1473-
const uint8_t* input_buffer, size_t* encoded_size,
1474-
uint8_t* encoded_buffer) {
1473+
const uint8_t input_buffer[BROTLI_ARRAY_PARAM(input_size)],
1474+
size_t* encoded_size,
1475+
uint8_t encoded_buffer[BROTLI_ARRAY_PARAM(*encoded_size)]) {
14751476
BrotliEncoderState* s;
14761477
size_t out_size = *encoded_size;
14771478
const uint8_t* input_start = input_buffer;

0 commit comments

Comments
 (0)