diff --git a/Source/Resource/GifLzw.cpp b/Source/Resource/GifLzw.cpp index 1702a9b6..5bd4f409 100644 --- a/Source/Resource/GifLzw.cpp +++ b/Source/Resource/GifLzw.cpp @@ -1,4 +1,4 @@ -#include "Resource/GifLzw.h" +#include "Resource/GifResource.h" #include diff --git a/Source/Resource/GifResource.cpp b/Source/Resource/GifResource.cpp index dd3ff2c6..09e03942 100644 --- a/Source/Resource/GifResource.cpp +++ b/Source/Resource/GifResource.cpp @@ -1,7 +1,6 @@ #include "Resource/GifResource.h" #include "File/File.h" -#include "Resource/GifLzw.h" #include #include @@ -47,8 +46,8 @@ namespace { // INLINED bool IsGifSignature(const void* data) { - const auto* bytes = static_cast(data); - return bytes[0] == 'G' && bytes[1] == 'I' && bytes[2] == 'F'; + constexpr char signature[] = {'G', 'I', 'F'}; + return std::memcmp(data, signature, sizeof(signature)) == 0; } } @@ -295,7 +294,7 @@ bool CGifRes::DecodeGif(const void* data, int bytes, bool iconOnly) { ++cursor; unsigned char* indices = new unsigned char[descriptor.width * descriptor.height]; - if (DecodeGifLzw(minimumCodeSize, compressed, compressedBytes, indices) > 0) { + if (this->DecodeGifLzw(minimumCodeSize, compressed, compressedBytes, indices) > 0) { const unsigned int pixelCount = screenHeight * screenWidth; std::uint32_t* pixels = new std::uint32_t[pixelCount]; diff --git a/Source/Resource/GifResource.h b/Source/Resource/GifResource.h index 1630de71..abf3d027 100644 --- a/Source/Resource/GifResource.h +++ b/Source/Resource/GifResource.h @@ -23,6 +23,7 @@ public: void CreateBlank(int width, int height); bool DecodeGif(const void* data, int bytes, bool iconOnly); + int DecodeGifLzw(int minimumCodeSize, const unsigned char* input, int inputBytes, unsigned char* output); /* 0124 */ std::vector frames; /* 0130 */ std::uint16_t loopCount;