diff options
author | Tao Bao <tbao@google.com> | 2018-05-22 02:05:04 +0200 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2018-05-22 02:05:04 +0200 |
commit | b8a04272c8fe5a50c63336e1726045be875b5be9 (patch) | |
tree | 5cf0a4be1c879e37f848018423209b09ff482cb2 /updater | |
parent | [automerger skipped] Merge "Move stuff from recovery into librecovery." am: 901f0c3516 (diff) | |
parent | Merge "updater: Clean up the header lines computation." (diff) | |
download | android_bootable_recovery-b8a04272c8fe5a50c63336e1726045be875b5be9.tar android_bootable_recovery-b8a04272c8fe5a50c63336e1726045be875b5be9.tar.gz android_bootable_recovery-b8a04272c8fe5a50c63336e1726045be875b5be9.tar.bz2 android_bootable_recovery-b8a04272c8fe5a50c63336e1726045be875b5be9.tar.lz android_bootable_recovery-b8a04272c8fe5a50c63336e1726045be875b5be9.tar.xz android_bootable_recovery-b8a04272c8fe5a50c63336e1726045be875b5be9.tar.zst android_bootable_recovery-b8a04272c8fe5a50c63336e1726045be875b5be9.zip |
Diffstat (limited to 'updater')
-rw-r--r-- | updater/blockimg.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/updater/blockimg.cpp b/updater/blockimg.cpp index 236644e7f..48d1f4e10 100644 --- a/updater/blockimg.cpp +++ b/updater/blockimg.cpp @@ -1666,7 +1666,6 @@ static Value* PerformBlockImageUpdate(const char* name, State* state, return StringValue("t"); } - size_t start = 2; if (lines.size() < 4) { ErrorAbort(state, kArgsParsingFailure, "too few lines in the transfer list [%zu]", lines.size()); @@ -1708,8 +1707,6 @@ static Value* PerformBlockImageUpdate(const char* name, State* state, saved_last_command_index = -1; } - start += 2; - // Build a map of the available commands std::unordered_map<std::string, const Command*> cmd_map; for (size_t i = 0; i < cmdcount; ++i) { @@ -1722,17 +1719,18 @@ static Value* PerformBlockImageUpdate(const char* name, State* state, int rc = -1; + static constexpr size_t kTransferListHeaderLines = 4; // Subsequent lines are all individual transfer commands - for (size_t i = start; i < lines.size(); i++) { + for (size_t i = kTransferListHeaderLines; i < lines.size(); i++) { const std::string& line = lines[i]; if (line.empty()) continue; params.tokens = android::base::Split(line, " "); params.cpos = 0; - if (i - start > std::numeric_limits<int>::max()) { + if (i - kTransferListHeaderLines > std::numeric_limits<int>::max()) { params.cmdindex = -1; } else { - params.cmdindex = i - start; + params.cmdindex = i - kTransferListHeaderLines; } params.cmdname = params.tokens[params.cpos++].c_str(); params.cmdline = line.c_str(); |