generated from gdt050579/appcui-template
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into dissasm_view
- Loading branch information
Showing
33 changed files
with
1,055 additions
and
707 deletions.
There are no files selected for viewing
Submodule AppCUI
updated
7 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
GViewCore/src/Unpack/CMakeLists.txt → GViewCore/src/Decoding/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
target_sources(GViewCore PRIVATE | ||
Base64.cpp | ||
LZXPRESS.cpp | ||
QuotedPrintable.cpp | ||
zip.cpp | ||
zlib.cpp | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#include "../include/GView.hpp" | ||
#include <zlib.h> | ||
|
||
namespace GView::Decoding::ZLIB | ||
{ | ||
bool Decompress(const Buffer& input, uint64 inputSize, Buffer& output, uint64 outputSize) | ||
{ | ||
CHECK(input.IsValid(), false, ""); | ||
CHECK(inputSize > 0, false, ""); | ||
CHECK(outputSize > inputSize, false, ""); | ||
|
||
output.Resize(outputSize); | ||
|
||
uint64 outputSizeCopy = outputSize; | ||
int32 ret = uncompress(output.GetData(), (uLongf*) &outputSizeCopy, input.GetData(), static_cast<uLong>(inputSize)); | ||
CHECK(outputSize == outputSizeCopy, false, "ZLIB error: %d!", ret); | ||
CHECK(ret == Z_OK, false, "ZLIB error: %d!", ret); | ||
|
||
return true; | ||
} | ||
|
||
bool DecompressStream(const BufferView& input, Buffer& output, String& message, uint64& sizeConsumed) | ||
{ | ||
CHECK(input.IsValid(), false, ""); | ||
CHECK(input.GetLength() > 0, false, ""); | ||
output.Resize(input.GetLength()); | ||
sizeConsumed = 0; | ||
|
||
z_stream stream; | ||
memset(&stream, Z_NULL, sizeof(stream)); | ||
|
||
stream.avail_in = static_cast<uInt>(input.GetLength()); | ||
stream.next_in = const_cast<Bytef*>(input.GetData()); | ||
stream.avail_out = static_cast<uInt>(input.GetLength()); | ||
stream.next_out = reinterpret_cast<Bytef*>(output.GetData()); | ||
|
||
int ret = inflateInit(&stream); | ||
CHECK(ret == Z_OK, false, ""); | ||
|
||
struct ZWrapper { | ||
z_stream& z; | ||
|
||
ZWrapper(z_stream& z) : z(z) | ||
{ | ||
} | ||
~ZWrapper() | ||
{ | ||
inflateEnd(&z); | ||
} | ||
} zWrapper(stream); | ||
|
||
while (ret == Z_OK || ret == Z_BUF_ERROR) { | ||
ret = inflate(&stream, Z_NO_FLUSH); | ||
if (ret == Z_BUF_ERROR) { | ||
output.Resize(stream.total_out * 2); | ||
stream.avail_out = static_cast<uInt>(stream.total_out); | ||
stream.next_out = reinterpret_cast<Bytef*>(output.GetData() + stream.total_out); | ||
} | ||
} | ||
|
||
output.Resize(stream.total_out); | ||
sizeConsumed = stream.total_in; | ||
message.Format("Return code: %d with msg: %s", ret, stream.msg); | ||
|
||
CHECK(ret == Z_OK || ret == Z_STREAM_END, false, ""); | ||
|
||
return true; | ||
} | ||
} // namespace GView::ZLIB |
Oops, something went wrong.