fix saving issue

- fix CKStateChunk resize memory error.
- fix wrong CKBitmapHandler free position in CKBitmapData writer.
- fix init value error of CKFileWriter::m_DisableAddingFile when copying from reader.
- fix ReadString, WriteString error in CKStateChunk (forget NULL terminal)
- change CKPathManager resolve path order. Resolve temp path first, then resources folder.
- fix mixdata combine error when writing CKTexture.
This commit is contained in:
2023-09-30 16:01:39 +08:00
parent abea66d6f0
commit ee4b621cac
10 changed files with 62 additions and 36 deletions

View File

@ -130,9 +130,18 @@ namespace LibCmo::CK2 {
return false;
}
// check blank string
if (strByteSize == 0) {
strl->clear();
return true;
}
// read data
// MARK: the written string has NULL terminal.
// strByteSize also include NULL terminal,
// so we need minus 1 when resizing (not ReadByteData, because we still need read NULL terminal to skip it.)
XContainer::XString cache;
cache.resize(strByteSize);
cache.resize(strByteSize - 1);
if (!this->ReadByteData(cache.data(), strByteSize)) {
strl->clear();
return false;