summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Jeddeloh <andrew@gridware.io>2023-02-16 22:36:12 +0000
committerDerf Null <derf@finalrewind.org>2023-03-12 10:10:50 +0100
commita64294c3e7c136ae493799d8e9055f22841965db (patch)
treea1775c7a50fb12f555209a879729d955a69adf89
parent8198be8fb6f81e987c3d0a2f334f61914f77c84b (diff)
inflate: move i declaration to for loops
Move the declaration of i to each for loop. This makes it clear there's no interaction with i outside each loop. It also makes it so compilers wont complain with -Wshadow.
-rw-r--r--src/inflate.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/inflate.c b/src/inflate.c
index b536689..0ad1db1 100644
--- a/src/inflate.c
+++ b/src/inflate.c
@@ -387,16 +387,15 @@ static int8_t deflate_static_huffman()
static int8_t deflate_dynamic_huffman()
{
- uint8_t i;
uint16_t hlit = 257 + deflate_get_bits(5);
uint8_t hdist = 1 + deflate_get_bits(5);
uint8_t hclen = 4 + deflate_get_bits(4);
- for (i = 0; i < hclen; i++) {
+ for (uint8_t i = 0; i < hclen; i++) {
deflate_hc_lengths[deflate_hclen_index[i]] =
deflate_get_bits(3);
}
- for (i = hclen; i < sizeof(deflate_hc_lengths); i++) {
+ for (uint8_t i = hclen; i < sizeof(deflate_hc_lengths); i++) {
deflate_hc_lengths[deflate_hclen_index[i]] = 0;
}