#include "VTUtils.hpp" #if defined(LIBCMO_OS_WIN32) #define ZLIB_WINAPI #endif #include #include "CKGlobals.hpp" #include namespace LibCmo::CK2 { void* CKUnPackData(CKINT DestSize, const void* SrcBuffer, CKINT SrcSize) { char* DestBuffer = new(std::nothrow) char[DestSize]; if (DestBuffer == nullptr) return nullptr; uLongf cache = DestSize; if (uncompress( reinterpret_cast(DestBuffer), &cache, reinterpret_cast(SrcBuffer), SrcSize) != Z_OK) { delete[] DestBuffer; return nullptr; } return DestBuffer; } CKDWORD CKComputeDataCRC(const void* data, size_t size, CKDWORD PreviousCRC) { return static_cast(adler32( static_cast(PreviousCRC), reinterpret_cast(data), static_cast(size) )); } }