Skip to content

Commit cef0793

Browse files
fixing types on lzss decoder
1 parent 9824566 commit cef0793

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/decompress/lzss.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,16 +241,18 @@ LZSSDecoder::status LZSSDecoder::handle_state() {
241241
return res;
242242
}
243243

244-
LZSSDecoder::status LZSSDecoder::decompress(const char* buffer, uint32_t size) {
244+
LZSSDecoder::status LZSSDecoder::decompress(uint8_t* const buffer, uint32_t size) {
245245
if(!get_char_cbk) {
246-
this->in_buffer = (uint8_t*)buffer;
246+
this->in_buffer = buffer;
247247
this->available += size;
248248
}
249249

250250
status res = IN_PROGRESS;
251251

252252
while((res = handle_state()) == IN_PROGRESS);
253253

254+
this->in_buffer = nullptr;
255+
254256
return res;
255257
}
256258

src/decompress/lzss.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class LZSSDecoder {
5656
* decode the provided buffer until buffer ends, then pause the process
5757
* @return DONE if the decompression is completed, NOT_COMPLETED if not
5858
*/
59-
status decompress(const char* buffer=nullptr, uint32_t size=0);
59+
status decompress(uint8_t* const buffer=nullptr, uint32_t size=0);
6060

6161
static const int LZSS_EOF = -1;
6262
static const int LZSS_BUFFER_EMPTY = -2;
@@ -93,7 +93,7 @@ class LZSSDecoder {
9393
int i, r;
9494

9595
std::function<void(const uint8_t)> put_char_cbk=nullptr;
96-
std::function<void(const uint8_t)> get_char_cbk=nullptr;
96+
std::function<uint8_t()> get_char_cbk=nullptr;
9797

9898
inline void putc(const uint8_t c) { if(put_char_cbk) { put_char_cbk(c); } }
9999

0 commit comments

Comments
 (0)