summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTianjie Xu <xunchang@google.com>2017-06-27 00:03:46 +0200
committerandroid-build-merger <android-build-merger@google.com>2017-06-27 00:03:46 +0200
commit312c30c4f73683e3e680613a1f02a9a3a1ef83a2 (patch)
tree19820afe38a70b5dda06520a324c0e55c9804310
parentMerge "Restructure vr_ui" am: 20d40ce53a am: 674851dc86 (diff)
parentMerge "avoid assuming build number is a 32-bit integer" am: 30afdee987 (diff)
downloadandroid_bootable_recovery-312c30c4f73683e3e680613a1f02a9a3a1ef83a2.tar
android_bootable_recovery-312c30c4f73683e3e680613a1f02a9a3a1ef83a2.tar.gz
android_bootable_recovery-312c30c4f73683e3e680613a1f02a9a3a1ef83a2.tar.bz2
android_bootable_recovery-312c30c4f73683e3e680613a1f02a9a3a1ef83a2.tar.lz
android_bootable_recovery-312c30c4f73683e3e680613a1f02a9a3a1ef83a2.tar.xz
android_bootable_recovery-312c30c4f73683e3e680613a1f02a9a3a1ef83a2.tar.zst
android_bootable_recovery-312c30c4f73683e3e680613a1f02a9a3a1ef83a2.zip
-rw-r--r--install.cpp22
1 files changed, 9 insertions, 13 deletions
diff --git a/install.cpp b/install.cpp
index db4ba9373..7ba8f0139 100644
--- a/install.cpp
+++ b/install.cpp
@@ -66,18 +66,14 @@ static constexpr float VERIFICATION_PROGRESS_FRACTION = 0.25;
static std::condition_variable finish_log_temperature;
// This function parses and returns the build.version.incremental
-static int parse_build_number(const std::string& str) {
+static std::string parse_build_number(const std::string& str) {
size_t pos = str.find('=');
if (pos != std::string::npos) {
- std::string num_string = android::base::Trim(str.substr(pos+1));
- int build_number;
- if (android::base::ParseInt(num_string.c_str(), &build_number, 0)) {
- return build_number;
- }
+ return android::base::Trim(str.substr(pos+1));
}
LOG(ERROR) << "Failed to parse build number in " << str;
- return -1;
+ return "";
}
bool read_metadata_from_package(ZipArchiveHandle zip, std::string* metadata) {
@@ -114,14 +110,14 @@ static void read_source_target_build(ZipArchiveHandle zip, std::vector<std::stri
for (const std::string& line : lines) {
std::string str = android::base::Trim(line);
if (android::base::StartsWith(str, "pre-build-incremental")) {
- int source_build = parse_build_number(str);
- if (source_build != -1) {
- log_buffer->push_back(android::base::StringPrintf("source_build: %d", source_build));
+ std::string source_build = parse_build_number(str);
+ if (!source_build.empty()) {
+ log_buffer->push_back("source_build: " + source_build);
}
} else if (android::base::StartsWith(str, "post-build-incremental")) {
- int target_build = parse_build_number(str);
- if (target_build != -1) {
- log_buffer->push_back(android::base::StringPrintf("target_build: %d", target_build));
+ std::string target_build = parse_build_number(str);
+ if (!target_build.empty()) {
+ log_buffer->push_back("target_build: " + target_build);
}
}
}