Refactor value encoding in BinaryTable for improved clarity and consistency
This commit is contained in:
@@ -719,6 +719,7 @@ void BinaryTable::setAddressTable(const std::unordered_map<int64_t, BT_Pointer>&
|
||||
BT_Pointer newTableAddress = alloc(static_cast<int32_t>(buffer.size()));
|
||||
setFilePosition(newTableAddress.address());
|
||||
size_t written = fwrite(buffer.data(), 1, buffer.size(), file_);
|
||||
(void)written; // Suppress unused variable warning in release builds
|
||||
|
||||
if (written != buffer.size()) {
|
||||
throw std::runtime_error("Failed to write complete address table");
|
||||
@@ -851,6 +852,7 @@ void BinaryTable::truncateFile(int64_t newSize) {
|
||||
DEBUG_PRINTLN("DEBUG: truncateFile - resize successful");
|
||||
} catch (const std::exception& e) {
|
||||
DEBUG_PRINTLN("DEBUG: truncateFile - resize failed: " << e.what());
|
||||
(void)e; // Suppress unused variable warning in release builds
|
||||
}
|
||||
|
||||
file_ = fopen(filePath_.c_str(), "r+b");
|
||||
@@ -1085,16 +1087,19 @@ void BinaryTable::debugAddressTable(const std::string& context) {
|
||||
if (typeByte == 2) { // INTEGER
|
||||
int32_t value = readInt32(pointer.address() + 1);
|
||||
DEBUG_PRINTLN(" Value: " << value);
|
||||
(void)value; // Suppress unused variable warning in release builds
|
||||
} else {
|
||||
DEBUG_PRINT(" Raw bytes: ");
|
||||
for (int i = 0; i < 8; i++) {
|
||||
uint8_t byte = readByte(pointer.address() + i);
|
||||
DEBUG_PRINT(std::hex << (int)byte << " ");
|
||||
(void)byte; // Suppress unused variable warning in release builds
|
||||
}
|
||||
DEBUG_PRINTLN(std::dec);
|
||||
}
|
||||
} catch (const std::exception& e) {
|
||||
DEBUG_PRINTLN(" Error reading data: " << e.what());
|
||||
(void)e; // Suppress unused variable warning in release builds
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user