Skip to content

Commit

Permalink
Fix unused result errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
szmyd committed Sep 26, 2023
1 parent f757951 commit c963f1f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/lib/file/blob_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ BlobManager::Result< blob_id > FileHomeObject::_put_blob(ShardInfo const& _shard
WITH_SHARD_FILE(O_WRONLY)

auto err = pwrite(shard_fd, &h_size, sizeof(h_size), route.blob);
RELEASE_ASSERT(sizeof(h_size) == err, "Failed to write to: {}", shard_file.string());
RELEASE_ASSERT(0 < err, "Failed to write to: {}", shard_file.string());
err = err || pwrite(shard_fd, serialize.c_str(), h_size, sizeof(h_size) + route.blob);
RELEASE_ASSERT(h_size == err, "Failed to write to: {}", shard_file.string());
RELEASE_ASSERT(0 < err, "Failed to write to: {}", shard_file.string());
err = err || pwrite(shard_fd, _blob.body.bytes, _blob.body.size, sizeof(h_size) + h_size + route.blob);
RELEASE_ASSERT(_blob.body.size == err, "Failed to write to: {}", shard_file.string());
RELEASE_ASSERT(0 < err, "Failed to write to: {}", shard_file.string());
auto [_, happened] = shard.btree_.try_emplace(route, true);
RELEASE_ASSERT(happened, "Generated duplicate BlobRoute!");
close(shard_fd);
Expand All @@ -60,17 +60,17 @@ BlobManager::Result< Blob > FileHomeObject::_get_blob(ShardInfo const& _shard, b
WITH_SHARD_FILE(O_RDONLY)
size_t h_size = 0ull;
auto err = pread(shard_fd, &h_size, sizeof(h_size), route.blob);
RELEASE_ASSERT(sizeof(h_size) == err, "Failed to read from: {}", shard_file.string());
RELEASE_ASSERT(0 < err, "Failed to read from: {}", shard_file.string());

auto j_str = std::string(h_size, '\0');
err = pread(shard_fd, const_cast< char* >(j_str.c_str()), h_size, sizeof(h_size) + route.blob);
RELEASE_ASSERT(h_size == err, "Failed to read from: {}", shard_file.string());
RELEASE_ASSERT(0 < err, "Failed to read from: {}", shard_file.string());
auto shard_json = nlohmann::json::parse(j_str);

auto const body_size = shard_json["body_size"].get< uint64_t >();
auto b = Blob{sisl::io_blob_safe(body_size), "", 0};
err = pread(shard_fd, b.body.bytes, body_size, sizeof(h_size) + h_size + route.blob);
RELEASE_ASSERT(body_size == err, "Failed to read from: {}", shard_file.string());
RELEASE_ASSERT(0 < err, "Failed to read from: {}", shard_file.string());

b.user_key = shard_json["user_key"].get< std::string >();
b.object_off = shard_json["object_off"].get< uint64_t >();
Expand Down
2 changes: 1 addition & 1 deletion src/lib/file/shard_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ ShardManager::Result< ShardInfo > FileHomeObject::_create_shard(pg_id pg_owner,
j["deleted_capacity"] = info.deleted_capacity_bytes;
auto serialize = j.dump();
auto err = pwrite(shard_fd, serialize.c_str(), serialize.size(), 0ull);
RELEASE_ASSERT(serialize.size() == err, "Failed to write to: {}", shard_file.string());
RELEASE_ASSERT(0 < err, "Failed to write to: {}", shard_file.string());

auto [it, happened] = index_.try_emplace(info.id, std::make_unique< ShardIndex >());
RELEASE_ASSERT(happened, "Could not create BTree!");
Expand Down

0 comments on commit c963f1f

Please sign in to comment.