pw_status: Update Status::CODE to Status::Code()
- Update Status::CODE style to Status::Code() using
pw_status/update_style.py.
- Make minor adjustments to the pw_assert tests to get them passing.
Change-Id: Ie54c3c605178fd1e42c7cedbcff324115f3ed279
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/19165
Commit-Queue: Wyatt Hepler <hepler@google.com>
Reviewed-by: Ewout van Bekkum <ewout@google.com>
diff --git a/pw_kvs/entry_cache.cc b/pw_kvs/entry_cache.cc
index c6d58a8..b6245a4 100644
--- a/pw_kvs/entry_cache.cc
+++ b/pw_kvs/entry_cache.cc
@@ -103,18 +103,18 @@
if (!key_found) {
PW_LOG_ERROR("No valid entries for key. Data has been lost!");
- return StatusWithSize(Status::DATA_LOSS, error_val);
+ return StatusWithSize::DataLoss(error_val);
} else if (key == read_key) {
PW_LOG_DEBUG("Found match for key hash 0x%08" PRIx32, hash);
*metadata = EntryMetadata(descriptors_[i], addresses(i));
- return StatusWithSize(Status::OK, error_val);
+ return StatusWithSize::Ok(error_val);
} else {
PW_LOG_WARN("Found key hash collision for 0x%08" PRIx32, hash);
- return StatusWithSize(Status::ALREADY_EXISTS, error_val);
+ return StatusWithSize::AlreadyExists(error_val);
}
}
}
- return StatusWithSize::NOT_FOUND;
+ return StatusWithSize::NotFound();
}
EntryMetadata EntryCache::AddNew(const KeyDescriptor& descriptor,
@@ -139,17 +139,17 @@
// Write a new entry if there is room.
if (index == -1) {
if (full()) {
- return Status::RESOURCE_EXHAUSTED;
+ return Status::ResourceExhausted();
}
AddNew(descriptor, address);
- return Status::OK;
+ return Status::Ok();
}
// Existing entry is old; replace the existing entry with the new one.
if (descriptor.transaction_id > descriptors_[index].transaction_id) {
descriptors_[index] = descriptor;
ResetAddresses(index, address);
- return Status::OK;
+ return Status::Ok();
}
// If the entries have a duplicate transaction ID, add the new (redundant)
@@ -160,7 +160,7 @@
" with transaction ID %" PRIu32 " has non-matching hash",
descriptor.key_hash,
descriptor.transaction_id);
- return Status::DATA_LOSS;
+ return Status::DataLoss();
}
// Verify that this entry is not in the same sector as an existing copy of
@@ -169,7 +169,7 @@
if (existing_address / sector_size_bytes == address / sector_size_bytes) {
PW_LOG_DEBUG("Multiple Redundant entries in same sector %u",
unsigned(address / sector_size_bytes));
- return Status::DATA_LOSS;
+ return Status::DataLoss();
}
}
@@ -177,7 +177,7 @@
} else {
PW_LOG_DEBUG("Found stale entry when appending; ignoring");
}
- return Status::OK;
+ return Status::Ok();
}
size_t EntryCache::present_entries() const {