Convert system/apex to Result::ok()
No functionality changes, this is a mechanical cleanup.
Test: cd system/apexd && m
Change-Id: I479084b9d1101b86c2e8d7ed631feba3edcedd8e
Merged-In: I479084b9d1101b86c2e8d7ed631feba3edcedd8e
diff --git a/apexd/apex_file.cpp b/apexd/apex_file.cpp
index 49bd83b..b780d97 100644
--- a/apexd/apex_file.cpp
+++ b/apexd/apex_file.cpp
@@ -128,7 +128,7 @@
} else {
manifest = ParseManifest(manifest_content);
}
- if (!manifest) {
+ if (!manifest.ok()) {
return manifest.error();
}
@@ -245,12 +245,12 @@
}
Result<std::string> key_name = getPublicKeyName(apex, data, length);
- if (!key_name) {
+ if (!key_name.ok()) {
return key_name.error();
}
Result<const std::string> public_key = getApexKey(*key_name);
- if (public_key) {
+ if (public_key.ok()) {
// TODO(b/115718846)
// We need to decide whether we need rollback protection, and whether
// we can use the rollback protection provided by libavb.
@@ -290,7 +290,7 @@
Result<void> st =
verifyVbMetaSignature(apex, vbmeta_buf.get(), footer.vbmeta_size);
- if (!st) {
+ if (!st.ok()) {
return st.error();
}
@@ -349,25 +349,25 @@
}
Result<std::unique_ptr<AvbFooter>> footer = getAvbFooter(*this, fd);
- if (!footer) {
+ if (!footer.ok()) {
return footer.error();
}
Result<std::unique_ptr<uint8_t[]>> vbmeta_data =
verifyVbMeta(*this, fd, **footer);
- if (!vbmeta_data) {
+ if (!vbmeta_data.ok()) {
return vbmeta_data.error();
}
Result<const AvbHashtreeDescriptor*> descriptor =
findDescriptor(vbmeta_data->get(), (*footer)->vbmeta_size);
- if (!descriptor) {
+ if (!descriptor.ok()) {
return descriptor.error();
}
Result<std::unique_ptr<AvbHashtreeDescriptor>> verifiedDescriptor =
verifyDescriptor(*descriptor);
- if (!verifiedDescriptor) {
+ if (!verifiedDescriptor.ok()) {
return verifiedDescriptor.error();
}
verityData.desc = std::move(*verifiedDescriptor);
@@ -387,13 +387,13 @@
const std::string& mount_path) const {
Result<ApexManifest> verifiedManifest =
ReadManifest(mount_path + "/" + kManifestFilenamePb);
- if (!verifiedManifest) {
+ if (!verifiedManifest.ok()) {
LOG(ERROR) << "Could not read manifest from " << mount_path << "/"
<< kManifestFilenamePb << " : " << verifiedManifest.error();
// Fallback to Json manifest if present.
LOG(ERROR) << "Trying to find a JSON manifest";
verifiedManifest = ReadManifest(mount_path + "/" + kManifestFilenameJson);
- if (!verifiedManifest) {
+ if (!verifiedManifest.ok()) {
return verifiedManifest.error();
}
}
@@ -411,13 +411,13 @@
std::vector<std::string> result;
for (const auto& path : paths) {
auto exist = PathExists(path);
- if (!exist) {
+ if (!exist.ok()) {
return exist.error();
}
if (!*exist) continue;
const auto& apexes = FindApexFilesByName(path);
- if (!apexes) {
+ if (!apexes.ok()) {
return apexes;
}