Skip to content

Commit e88ff43

Browse files
committed
Clear lzss static variables at download start
1 parent 31220c2 commit e88ff43

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/decompress/lzss.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ int bit_buffer = 0, bit_mask = 128;
3030
unsigned char buffer[N * 2];
3131

3232
static size_t bytes_written_fputc = 0;
33+
static size_t bytes_read_fgetc = 0;
3334

3435
/**************************************************************************************
3536
PRIVATE FUNCTIONS
@@ -45,8 +46,6 @@ void lzss_fputc(int const c)
4546

4647
int lzss_fgetc()
4748
{
48-
static size_t bytes_read_fgetc = 0;
49-
5049
/* lzss_file_size is set within SSUBoot:main
5150
* and contains the size of the LZSS file. Once
5251
* all those bytes have been read its time to return
@@ -163,6 +162,8 @@ int lzss_download(ArduinoEsp32OtaReadByteFuncPointer read_byte, ArduinoEsp32OtaW
163162
read_byte_fptr = read_byte;
164163
write_byte_fptr = write_byte;
165164
LZSS_FILE_SIZE = lzss_file_size;
165+
bytes_written_fputc = 0;
166+
bytes_read_fgetc = 0;
166167
lzss_decode();
167168
return bytes_written_fputc;
168169
}

0 commit comments

Comments
 (0)