Nitpick comments
This commit is contained in:
@@ -122,6 +122,11 @@ bool Section::loadSectionFile(const int fontId, const float lineCompression, con
|
|||||||
}
|
}
|
||||||
for (uint32_t& pos : lut) {
|
for (uint32_t& pos : lut) {
|
||||||
serialization::readPod(file, pos);
|
serialization::readPod(file, pos);
|
||||||
|
if (pos < HEADER_SIZE || pos >= lutOffset) {
|
||||||
|
LOG_ERR("SCT", "Deserialization failed: LUT entry %u out of range [%u, %u)", pos, HEADER_SIZE, lutOffset);
|
||||||
|
clearCache();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// File is intentionally left open; subsequent loadPageFromSectionFile() calls
|
// File is intentionally left open; subsequent loadPageFromSectionFile() calls
|
||||||
// seek within this handle instead of re-opening the file each time.
|
// seek within this handle instead of re-opening the file each time.
|
||||||
@@ -268,11 +273,11 @@ bool Section::createSectionFile(const int fontId, const float lineCompression, c
|
|||||||
|
|
||||||
// Cache the LUT in memory and open the file for reading so that
|
// Cache the LUT in memory and open the file for reading so that
|
||||||
// subsequent loadPageFromSectionFile() calls can seek directly without re-opening.
|
// subsequent loadPageFromSectionFile() calls can seek directly without re-opening.
|
||||||
this->lut = std::move(lut);
|
|
||||||
if (!Storage.openFileForRead("SCT", filePath, file)) {
|
if (!Storage.openFileForRead("SCT", filePath, file)) {
|
||||||
LOG_ERR("SCT", "Failed to open section file for reading after creation");
|
LOG_ERR("SCT", "Failed to open section file for reading after creation");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
this->lut = std::move(lut);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user