Convert system/tools/sysprop to Result::ok()
No functionality changes, this is a mechanical cleanup.
Test: cd system/apexd && m
Change-Id: I5da354e48d0fb12721dd430a6e9ad2d83b040a5e
diff --git a/ApiChecker.cpp b/ApiChecker.cpp
index f2008e5..316a4b4 100644
--- a/ApiChecker.cpp
+++ b/ApiChecker.cpp
@@ -107,7 +107,7 @@
// only deprecated properties.
if (auto res =
CompareProps(latest.props(i), propsMap[latest.props(i).module()]);
- !res) {
+ !res.ok()) {
return res;
}
}
diff --git a/ApiCheckerMain.cpp b/ApiCheckerMain.cpp
index a1a5475..081ca84 100644
--- a/ApiCheckerMain.cpp
+++ b/ApiCheckerMain.cpp
@@ -43,21 +43,21 @@
sysprop::SyspropLibraryApis latest, current;
- if (auto res = ParseApiFile(argv[1]); res) {
+ if (auto res = ParseApiFile(argv[1]); res.ok()) {
latest = std::move(*res);
} else {
LOG(FATAL) << "parsing sysprop_library API file " << argv[1]
<< " failed: " << res.error();
}
- if (auto res = ParseApiFile(argv[2]); res) {
+ if (auto res = ParseApiFile(argv[2]); res.ok()) {
current = std::move(*res);
} else {
LOG(FATAL) << "parsing sysprop_library API file " << argv[2]
<< " failed: " << res.error();
}
- if (auto res = CompareApis(latest, current); !res) {
+ if (auto res = CompareApis(latest, current); !res.ok()) {
LOG(ERROR) << "sysprop_library API check failed:\n" << res.error();
return EXIT_FAILURE;
}
diff --git a/ApiDumpMain.cpp b/ApiDumpMain.cpp
index e607196..38d9083 100644
--- a/ApiDumpMain.cpp
+++ b/ApiDumpMain.cpp
@@ -47,7 +47,7 @@
std::map<std::string, sysprop::Properties> modules;
for (int i = 2; i < argc; ++i) {
- if (auto res = ParseProps(argv[i]); res) {
+ if (auto res = ParseProps(argv[i]); res.ok()) {
if (!modules.emplace(res->module(), *res).second) {
LOG(FATAL) << "duplicated module name " << res->module();
}
diff --git a/Common.cpp b/Common.cpp
index b6bb1b2..b4f0e42 100644
--- a/Common.cpp
+++ b/Common.cpp
@@ -223,7 +223,7 @@
for (int i = 0; i < props.prop_size(); ++i) {
const auto& prop = props.prop(i);
- if (auto res = ValidateProp(props, prop); !res) return res;
+ if (auto res = ValidateProp(props, prop); !res.ok()) return res;
}
std::unordered_set<std::string> prop_names;
@@ -288,7 +288,7 @@
return Errorf("Error parsing file {}", input_file_path);
}
- if (auto res = ValidateProps(ret); !res) {
+ if (auto res = ValidateProps(ret); !res.ok()) {
return res.error();
}
@@ -320,7 +320,7 @@
input_file_path, props->module());
}
- if (auto res = ValidateProps(*props); !res) {
+ if (auto res = ValidateProps(*props); !res.ok()) {
return res.error();
}
diff --git a/CppGen.cpp b/CppGen.cpp
index f047e7d..25b1ea9 100644
--- a/CppGen.cpp
+++ b/CppGen.cpp
@@ -440,7 +440,7 @@
const std::string& include_name) {
sysprop::Properties props;
- if (auto res = ParseProps(input_file_path); res) {
+ if (auto res = ParseProps(input_file_path); res.ok()) {
props = std::move(*res);
} else {
return res.error();
diff --git a/CppMain.cpp b/CppMain.cpp
index 5f06669..a5cacc3 100644
--- a/CppMain.cpp
+++ b/CppMain.cpp
@@ -101,7 +101,7 @@
int main(int argc, char* argv[]) {
Arguments args;
- if (auto res = ParseArgs(argc, argv); res) {
+ if (auto res = ParseArgs(argc, argv); res.ok()) {
args = std::move(*res);
} else {
LOG(ERROR) << argv[0] << ": " << res.error();
@@ -111,7 +111,7 @@
if (auto res = GenerateCppFiles(args.input_file_path, args.header_dir,
args.public_header_dir, args.source_dir,
args.include_name);
- !res) {
+ !res.ok()) {
LOG(FATAL) << "Error during generating cpp sysprop from "
<< args.input_file_path << ": " << res.error();
}
diff --git a/JavaGen.cpp b/JavaGen.cpp
index 4ac45b1..7e23dfb 100644
--- a/JavaGen.cpp
+++ b/JavaGen.cpp
@@ -402,7 +402,7 @@
const std::string& java_output_dir) {
sysprop::Properties props;
- if (auto res = ParseProps(input_file_path); res) {
+ if (auto res = ParseProps(input_file_path); res.ok()) {
props = std::move(*res);
} else {
return res.error();
diff --git a/JavaMain.cpp b/JavaMain.cpp
index 723e2d3..370b00e 100644
--- a/JavaMain.cpp
+++ b/JavaMain.cpp
@@ -93,14 +93,14 @@
int main(int argc, char* argv[]) {
Arguments args;
std::string err;
- if (auto res = ParseArgs(argc, argv, &args); !res) {
+ if (auto res = ParseArgs(argc, argv, &args); !res.ok()) {
LOG(ERROR) << res.error();
PrintUsage(argv[0]);
}
if (auto res = GenerateJavaLibrary(args.input_file_path, args.scope,
args.java_output_dir);
- !res) {
+ !res.ok()) {
LOG(FATAL) << "Error during generating java sysprop from "
<< args.input_file_path << ": " << res.error();
}