TRECISION: Fix endianess in decompress, fix some a warning

This commit is contained in:
Strangerke
2021-05-29 21:23:57 +01:00
committed by SupSuper
parent 8d17cc69a9
commit 73eb6008ad
2 changed files with 6 additions and 6 deletions
+5 -5
View File
@@ -113,8 +113,8 @@ Common::SeekableReadStream *FastFile::createReadStreamForMember(const Common::St
return nullptr;
}
void FastFile::decompress(const unsigned char *src, unsigned src_len, unsigned char *dst, int32 decompSize) {
uint16 *sw = (uint16 *)(src + src_len);
void FastFile::decompress(const unsigned char *src, uint32 srcSize, unsigned char *dst, uint32 decompSize) {
uint16 *sw = (uint16 *)(src + srcSize);
uint8 *d = dst;
int32 bytesWritten = 0;
const uint8 *s = src;
@@ -122,17 +122,17 @@ void FastFile::decompress(const unsigned char *src, unsigned src_len, unsigned c
while (s < (const uint8 *)sw) {
if (!--ctrl_cnt) {
ctrl = *--sw;
ctrl = READ_LE_UINT16(--sw);
ctrl_cnt = 16;
} else {
ctrl <<= 1;
}
if (ctrl & 0x8000) {
uint16 foo = *--sw;
uint16 foo = READ_LE_UINT16(--sw);
const uint8 *cs = d - (foo >> 4);
uint num = 16 - (foo & 0xF);
uint16 num = 16 - (foo & 0xF);
for (uint16 i = 0; i < num; ++i) {
*d++ = *cs++;
+1 -1
View File
@@ -57,7 +57,7 @@ private:
uint8 *_compBuffer;
const FileEntry *getEntry(const Common::String &name) const;
void decompress(const unsigned char *src, unsigned src_len, unsigned char *dst, int32 decompSize);
void decompress(const unsigned char *src, uint32 srcSize, unsigned char *dst, uint32 decompSize);
};
} // End of namespace Trecision