Skip to content

Commit

Permalink
fixed warnings on gcc (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
Husenap authored Apr 10, 2021
1 parent a58af71 commit 799fb80
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
14 changes: 8 additions & 6 deletions dubu_pack/src/dubu_pack/packer/Packer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,14 @@ void Packer::Pack() {
fileHeader.originalFileSize);

uLongf sourceLength = bufferBound;
int result = compress((Bytef*)mCompressionBuffer.data(),
&sourceLength,
(Bytef*)sourceFile.data(),
(uLong)sourceFile.size());

if (result == Z_OK && sourceLength < fileHeader.originalFileSize) {
int result = compress(
reinterpret_cast<Bytef*>(mCompressionBuffer.data()),
&sourceLength,
reinterpret_cast<Bytef*>(sourceFile.data()),
static_cast<uLong>(sourceFile.size()));

if (result == Z_OK &&
sourceLength < fileHeader.originalFileSize) {
fileHeader.compressedFileSize =
static_cast<uint32_t>(sourceLength);
temporaryFileBuffer.Write(mCompressionBuffer.data(),
Expand Down
9 changes: 5 additions & 4 deletions dubu_pack/src/dubu_pack/packer/Unpacker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ std::optional<blob> Unpacker::ReadFile(std::filesystem::path filePath) {
}
mFileBuffer.Read(&mCompressionBuffer[0], it->second.compressedFileSize);

int result = uncompress((Bytef*)&data[0],
&destinationLength,
(Bytef*)mCompressionBuffer.data(),
sourceLength);
int result =
uncompress(reinterpret_cast<Bytef*>(&data[0]),
&destinationLength,
reinterpret_cast<Bytef*>(mCompressionBuffer.data()),
sourceLength);

if (result != Z_OK) {
return std::nullopt;
Expand Down

0 comments on commit 799fb80

Please sign in to comment.