Skip to content

Commit

Permalink
minor bugfix: signed_log_test byte size.
Browse files Browse the repository at this point in the history
  • Loading branch information
songweijia committed May 9, 2024
1 parent a0188b2 commit 774fc18
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/applications/tests/unit_tests/signed_log_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,18 @@ std::string StringWithDelta::get_current_state() const {
}

size_t StringWithDelta::currentDeltaSize() {
return delta.size();
if (delta.size()==0) {
return 0;
} else {
return mutils::bytes_size(delta);
}
}

size_t StringWithDelta::currentDeltaToBytes(uint8_t * const buf, size_t buf_size) {
if (delta.size() == 0) {
dbg_default_trace("StringWithDelta: Calling currentDeltaToBytes with null buffer\n");
return 0;
} else if (buf_size < delta.size()) {
} else if (buf_size < mutils::bytes_size(delta)) {
dbg_default_error("{} failed because the buffer({}) given is smaller than needed({}).\n",
__func__,buf_size,delta.size());
return 0;
Expand Down

0 comments on commit 774fc18

Please sign in to comment.