William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame] | 1 | From 498627ebda6271b59920f43a0b9b6187edeb7b09 Mon Sep 17 00:00:00 2001 |
| 2 | From: Adrian Herrera <adr.her.arc.95@gmail.com> |
| 3 | Date: Mon, 22 Mar 2021 21:06:47 +0000 |
| 4 | Subject: [PATCH] Fix VLA parameter warning |
| 5 | |
| 6 | Make VLA buffer types consistent in declarations and definitions. |
| 7 | Resolves build crash when using -Werror due to "vla-parameter" warning. |
| 8 | |
| 9 | Upstream-Status: Submitted [https://github.com/google/brotli/pull/893] |
| 10 | Signed-off-by: Adrian Herrera <adr.her.arc.95@gmail.com> |
| 11 | --- |
| 12 | c/dec/decode.c | 6 ++++-- |
| 13 | c/enc/encode.c | 5 +++-- |
| 14 | 2 files changed, 7 insertions(+), 4 deletions(-) |
| 15 | |
| 16 | diff --git a/BaseTools/Source/C/BrotliCompress/brotli/c/dec/decode.c b/BaseTools/Source/C/BrotliCompress/brotli/c/dec/decode.c |
| 17 | index 114c505..bb6f1ab 100644 |
| 18 | --- a/BaseTools/Source/C/BrotliCompress/brotli/c/dec/decode.c |
| 19 | +++ b/BaseTools/Source/C/BrotliCompress/brotli/c/dec/decode.c |
| 20 | @@ -2030,8 +2030,10 @@ static BROTLI_NOINLINE BrotliDecoderErrorCode SafeProcessCommands( |
| 21 | } |
| 22 | |
| 23 | BrotliDecoderResult BrotliDecoderDecompress( |
| 24 | - size_t encoded_size, const uint8_t* encoded_buffer, size_t* decoded_size, |
| 25 | - uint8_t* decoded_buffer) { |
| 26 | + size_t encoded_size, |
| 27 | + const uint8_t encoded_buffer[BROTLI_ARRAY_PARAM(encoded_size)], |
| 28 | + size_t* decoded_size, |
| 29 | + uint8_t decoded_buffer[BROTLI_ARRAY_PARAM(*decoded_size)]) { |
| 30 | BrotliDecoderState s; |
| 31 | BrotliDecoderResult result; |
| 32 | size_t total_out = 0; |
| 33 | diff --git a/c/enc/encode.c b/c/enc/encode.c |
| 34 | index 68548ef..ab0a490 100644 |
| 35 | --- a/BaseTools/Source/C/BrotliCompress/brotli/c/enc/encode.c |
| 36 | +++ c/BaseTools/Source/C/BrotliCompress/brotli/c/enc/encode.c |
| 37 | @@ -1470,8 +1470,9 @@ static size_t MakeUncompressedStream( |
| 38 | |
| 39 | BROTLI_BOOL BrotliEncoderCompress( |
| 40 | int quality, int lgwin, BrotliEncoderMode mode, size_t input_size, |
| 41 | - const uint8_t* input_buffer, size_t* encoded_size, |
| 42 | - uint8_t* encoded_buffer) { |
| 43 | + const uint8_t input_buffer[BROTLI_ARRAY_PARAM(input_size)], |
| 44 | + size_t* encoded_size, |
| 45 | + uint8_t encoded_buffer[BROTLI_ARRAY_PARAM(*encoded_size)]) { |
| 46 | BrotliEncoderState* s; |
| 47 | size_t out_size = *encoded_size; |
| 48 | const uint8_t* input_start = input_buffer; |
| 49 | -- |
| 50 | 2.31.1 |
| 51 | |