Skip to content

Commit

Permalink
fix(dom): add deserializer log
Browse files Browse the repository at this point in the history
  • Loading branch information
ilikethese authored and hippy-actions[bot] committed Jan 22, 2024
1 parent 37f8721 commit 418afed
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions modules/footstone/include/footstone/deserializer.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ class Deserializer {
const uint8_t* position_;
const uint8_t* const end_;
uint32_t version_ = 0;
size_t length_ = 0;
};
} // namespace base
} // namespace tdf
6 changes: 3 additions & 3 deletions modules/footstone/src/deserializer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ using StringViewUtils = footstone::stringview::StringViewUtils;
constexpr uint32_t kSupportedVersion = 15;

Deserializer::Deserializer(const std::vector<const uint8_t>& data)
: position_(&data[0]), end_(&data[0] + data.size()) {}
: position_(&data[0]), end_(&data[0] + data.size()), length_(data.size()) {}

Deserializer::Deserializer(const uint8_t* data, size_t size) : position_(data), end_(data + size) {}
Deserializer::Deserializer(const uint8_t* data, size_t size) : position_(data), end_(data + size), length_(size) {}

Deserializer::~Deserializer() = default;

Expand All @@ -62,7 +62,7 @@ void Deserializer::ReadHeaderChecked() {
SerializationTag tag;
ReadTag(tag);
version_ = ReadVarint<uint32_t>();
FOOTSTONE_CHECK(version_ <= kSupportedVersion);
FOOTSTONE_CHECK(version_ <= kSupportedVersion) << "deserializer version is " << version_ << ", buffer size" << length_;
}
}

Expand Down

0 comments on commit 418afed

Please sign in to comment.