Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ArduinoBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ jobs:
# Set the build folder and file names for esp32-qemu-sim
debug: true
qemu-timeout: 999
timeout-interrupt-regex: "All tests performed"
build-folder: examples/Test_tar_gz_tgz/build
partitions-csv: partitions.csv
firmware-bin: Test_tar_gz_tgz.ino.bin
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/PlatformioBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
python-version: '3.10'

- name: Install PlatformIO
run: |
Expand Down
4 changes: 2 additions & 2 deletions library.properties
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name=ESP32-targz
version=1.2.8
version=1.2.9
author=tobozo <[email protected]>
maintainer=tobozo <[email protected]>
sentence=A library to compress/decompress tar+gzip archives.
paragraph=Archive a directory to tar.gz, extract tar.gz to a filesystem or stream, gzip webserver responses on the fly, perform OTA updates from compressed binary.
category=Data Processing
url=https://github.com/tobozo/ESP32-targz/
url=https://github.com/tobozo/ESP32-targz
architectures=esp32,esp8266,rp2040,mbed_rp2040
includes=ESP32-targz.h
36 changes: 24 additions & 12 deletions src/libunpacker/LibUnpacker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,13 @@ void BaseUnpacker::setFsFreeBytesCb( fsFreeBytesCb cb )
// set logger callback
void BaseUnpacker::setLoggerCallback( genericLoggerCallback cb )
{
log_v("Assigning debug logger callback : 0x%8x", (uint)cb );
tgzLogger = cb;
if( cb ) {
log_v("Assigning debug logger callback : 0x%8x", (uint)cb );
tgzLogger = cb;
} else {
//log_v("Disabling logger callback" );
tgzLogger = BaseUnpacker::targzNullLoggerCallback;
}
}


Expand Down Expand Up @@ -1204,13 +1209,14 @@ unsigned int GzUnpacker::gzReadSourceByte(CC_UNUSED struct GZ::TINF_DATA *data,
// show_progress => enable/disable bytes count (not always applicable)
int GzUnpacker::gzUncompress( bool isupdate, bool stream_to_tar, bool use_dict, bool show_progress )
{

log_d("gzUncompress( isupdate = %s, stream_to_tar = %s, use_dict = %s, show_progress = %s)",
isupdate ? "true" : "false",
stream_to_tar ? "true" : "false",
use_dict ? "true" : "false",
show_progress ? "true" : "false"
);
if( tgzLogger != targzNullLoggerCallback ) {
log_d("gzUncompress( isupdate = %s, stream_to_tar = %s, use_dict = %s, show_progress = %s)",
isupdate ? "true" : "false",
stream_to_tar ? "true" : "false",
use_dict ? "true" : "false",
show_progress ? "true" : "false"
);
}

if( !tarGzIO.gz->available() ) {
log_e("[ERROR] in gzUncompress: gz resource doesn't exist!");
Expand Down Expand Up @@ -1243,7 +1249,9 @@ int GzUnpacker::gzUncompress( bool isupdate, bool stream_to_tar, bool use_dict,
}
uzlib_dict_size = GZIP_DICT_SIZE;
uzLibDecompressor.readDestByte = NULL;
log_i("[INFO] gzUncompress tradeoff: faster, used %d bytes of ram (heap after alloc: %d)", GZIP_DICT_SIZE+output_buffer_size, HEAP_AVAILABLE());
if( tgzLogger != targzNullLoggerCallback ) {
log_i("[INFO] gzUncompress tradeoff: faster, used %d bytes of ram (heap after alloc: %d)", GZIP_DICT_SIZE+output_buffer_size, HEAP_AVAILABLE());
}
//log_w("[%d] alloc() done", HEAP_AVAILABLE() );
} else {
if( stream_to_tar ) {
Expand All @@ -1254,7 +1262,9 @@ int GzUnpacker::gzUncompress( bool isupdate, bool stream_to_tar, bool use_dict,
log_v("[INFO] gz output is file");
}
//output_buffer_size = SPI_FLASH_SEC_SIZE;
log_i("[INFO] gzUncompress tradeoff: slower will use %d bytes of ram (heap before alloc: %d)", output_buffer_size, HEAP_AVAILABLE());
if( tgzLogger != targzNullLoggerCallback ) {
log_i("[INFO] gzUncompress tradeoff: slower will use %d bytes of ram (heap before alloc: %d)", output_buffer_size, HEAP_AVAILABLE());
}
uzlib_gzip_dict = NULL;
uzlib_dict_size = 0;
}
Expand Down Expand Up @@ -1375,7 +1385,9 @@ int GzUnpacker::gzUncompress( bool isupdate, bool stream_to_tar, bool use_dict,
gzProgressCallback( 100 );
}

log_d("decompressed %d bytes", outlen + output_position);
if( tgzLogger != targzNullLoggerCallback ) {
log_d("decompressed %d bytes", outlen + output_position);
}

free( output_buffer );
gzExpanderCleanup();
Expand Down