🎨 Simplify code
This commit is contained in:
parent
205642821f
commit
e6af0c35de
1 changed files with 13 additions and 14 deletions
|
@ -38,14 +38,14 @@ void inflateInit(uint8_t* comprBufferIn, uint8_t* uncomprBufferIn, unsigned long
|
|||
|
||||
struct InflateOutput inflateInflate(unsigned long numInputBytes, bool hasMoreBytes) {
|
||||
if (numInputBytes == 0) {
|
||||
//continue in input buffer where we were before
|
||||
//Continue in input buffer where we were before
|
||||
} else {
|
||||
//go back to beginning of input buffer
|
||||
//Go back to beginning of input buffer
|
||||
comprBufferNext = comprBuffer;
|
||||
remainingInput = numInputBytes;
|
||||
}
|
||||
|
||||
//output buffer was previously fully filled and all output was processed. New uncompressed data can be written starting at offset 0
|
||||
//Output buffer was previously fully filled and all output was processed. New uncompressed data can be written starting at offset 0
|
||||
if (spaceInOutput == 0) {
|
||||
uncomprBufferNext = (mz_uint8 *)uncomprBuffer;
|
||||
spaceInOutput = uncomprBufferSize;
|
||||
|
@ -77,17 +77,16 @@ struct InflateOutput inflateInflate(unsigned long numInputBytes, bool hasMoreByt
|
|||
spaceInOutput -= out_bytes;
|
||||
out.numBytesWrittenToOutput += out_bytes;
|
||||
|
||||
//Check for errors
|
||||
if (status <= TINFL_STATUS_DONE) {
|
||||
if (status == TINFL_STATUS_DONE) {
|
||||
// Decompression completed successfully.
|
||||
out.hasReachedEnd = true;
|
||||
break;
|
||||
} else {
|
||||
// Decompression failed.
|
||||
fprintf(stderr, "tinfl_decompress() failed with status %i!\n", status);
|
||||
errorAndExit();
|
||||
}
|
||||
//Check miniz output
|
||||
if (status == TINFL_STATUS_DONE) {
|
||||
// Decompression completed successfully
|
||||
out.hasReachedEnd = true;
|
||||
break;
|
||||
}
|
||||
if (status < TINFL_STATUS_DONE) {
|
||||
// Decompression failed
|
||||
fprintf(stderr, "tinfl_decompress() failed with status %i!\n", status);
|
||||
errorAndExit();
|
||||
}
|
||||
|
||||
if (status == TINFL_STATUS_NEEDS_MORE_INPUT && remainingInput != 0) {
|
||||
|
|
Loading…
Reference in a new issue