diff --git a/examples/Test_tar_gz_tgz/test_tools.h b/examples/Test_tar_gz_tgz/test_tools.h index a326d30..4caeaec 100644 --- a/examples/Test_tar_gz_tgz/test_tools.h +++ b/examples/Test_tar_gz_tgz/test_tools.h @@ -9,13 +9,14 @@ extern "C" { #endif #if defined ESP32 - #if defined ESP_IDF_VERSION_MAJOR && ESP_IDF_VERSION_MAJOR >= 4 + #if defined ESP_IDF_VERSION_MAJOR && ESP_IDF_VERSION_MAJOR >= 4 && ESP_IDF_VERSION_MAJOR < 5 #include #else #include #endif #endif +#pragma GCC diagnostic ignored "-Wswitch" bool isManualReset() { @@ -89,7 +90,7 @@ void SerialPrintCentered(const char *s, bool open = false, bool close = false ) if( open ) Serial.println( OpenLine ); Serial.println( out ); if( close ) Serial.println( CloseLine ); - delete out; + delete[] out; } void SerialPrintfCentered(const char* format, ... ) diff --git a/library.properties b/library.properties index 9ea5188..bcf404a 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=ESP32-targz -version=1.1.9 +version=1.2.0 author=tobozo maintainer=tobozo sentence=A library to unpack/uncompress tar, gz, and tar.gz files on ESP32 and ESP8266 diff --git a/src/ESP32-targz-lib.cpp b/src/ESP32-targz-lib.cpp index a843150..c1f2190 100644 --- a/src/ESP32-targz-lib.cpp +++ b/src/ESP32-targz-lib.cpp @@ -382,7 +382,7 @@ void BaseUnpacker::hexDumpData( const char* buff, size_t buffsize, uint32_t outp } } Serial.println( byteToStr + bytesStr + " " + binaryStr ); - delete byteToStr; + delete[] byteToStr; } @@ -401,7 +401,7 @@ void BaseUnpacker::hexDumpFile( fs::FS &fs, const char* filename, uint32_t outpu hexDumpData( buff, bytes_read, output_size ); bytes_read = binFile.readBytes( buff, output_size ); } - delete buff; + delete[] buff; } else { Serial.printf("Ignoring file %s (%d bytes)", filename, binFile.size() ); } @@ -1359,7 +1359,7 @@ int GzUnpacker::gzUncompress( bool isupdate, bool stream_to_tar, bool use_dict, output_position = 0; } - if( isupdate && outlen > 0 ) { + if( isupdate && outlen > 0 ) { // Update requirement: written output size must be a multiple of SPI_FLASH_SEC_SIZE size_t updatable_size = ( outlen + SPI_FLASH_SEC_SIZE-1 ) & ~( SPI_FLASH_SEC_SIZE-1 ); size_t zerofill_size = updatable_size - outlen; if( zerofill_size <= SPI_FLASH_SEC_SIZE ) {