🎨 Simplify code

This commit is contained in:
C-3PO 2019-07-21 22:16:00 +02:00
parent 205642821f
commit e6af0c35de
Signed by: c3po
GPG key ID: 62993C4BB4D86F24

View file

@ -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) {