tvg_saver: resolve sanitizer report.

"runtime error: load of misaligned address 0x7fb67895c815 for type 'unsigned int', which requires 4 byte alignment"

same to c8cc973888
This commit is contained in:
Hermet Park 2021-09-24 12:04:31 +09:00
parent 3ee6883f16
commit daa114aafa

View file

@ -164,15 +164,15 @@ bool TvgSaver::saveEncoding(const std::string& path)
uncompressed += TVG_HEADER_RESERVED_LENGTH;
//Uncompressed Size
*reinterpret_cast<TvgBinCounter*>(uncompressed) = uncompressedSize;
memcpy(uncompressed, &uncompressedSize, TVG_HEADER_UNCOMPRESSED_SIZE);
uncompressed += TVG_HEADER_UNCOMPRESSED_SIZE;
//Comprssed Size
*reinterpret_cast<TvgBinCounter*>(uncompressed) = compressedSize;
memcpy(uncompressed, &compressedSize, TVG_HEADER_COMPRESSED_SIZE);
uncompressed += TVG_HEADER_COMPRESSED_SIZE;
//Compressed Size Bits
*reinterpret_cast<TvgBinCounter*>(uncompressed) = compressedSizeBits;
memcpy(uncompressed, &compressedSizeBits, TVG_HEADER_COMPRESSED_SIZE_BITS);
//Good optimization, flush to file.
auto fp = fopen(path.c_str(), "w+");