summaryrefslogtreecommitdiffstats
path: root/updater/blockimg.cpp
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2018-06-08 21:56:03 +0200
committerandroid-build-merger <android-build-merger@google.com>2018-06-08 21:56:03 +0200
commit4fed385c6c7146ba4d0c2f8953a29556922136b6 (patch)
tree84de8c12121c2a8979b2bfdde2486a8f0ef9e316 /updater/blockimg.cpp
parentMerge "updater_sample: update README.md" am: 1cb7222784 am: fc824cb998 (diff)
parentMerge "updater: Remove the redundant check on line count." am: 4a8f5ec06d (diff)
downloadandroid_bootable_recovery-4fed385c6c7146ba4d0c2f8953a29556922136b6.tar
android_bootable_recovery-4fed385c6c7146ba4d0c2f8953a29556922136b6.tar.gz
android_bootable_recovery-4fed385c6c7146ba4d0c2f8953a29556922136b6.tar.bz2
android_bootable_recovery-4fed385c6c7146ba4d0c2f8953a29556922136b6.tar.lz
android_bootable_recovery-4fed385c6c7146ba4d0c2f8953a29556922136b6.tar.xz
android_bootable_recovery-4fed385c6c7146ba4d0c2f8953a29556922136b6.tar.zst
android_bootable_recovery-4fed385c6c7146ba4d0c2f8953a29556922136b6.zip
Diffstat (limited to 'updater/blockimg.cpp')
-rw-r--r--updater/blockimg.cpp12
1 files changed, 3 insertions, 9 deletions
diff --git a/updater/blockimg.cpp b/updater/blockimg.cpp
index f2811bccf..1646b7c17 100644
--- a/updater/blockimg.cpp
+++ b/updater/blockimg.cpp
@@ -1628,9 +1628,10 @@ static Value* PerformBlockImageUpdate(const char* name, State* state,
}
}
+ static constexpr size_t kTransferListHeaderLines = 4;
std::vector<std::string> lines = android::base::Split(transfer_list_value->data, "\n");
- if (lines.size() < 2) {
- ErrorAbort(state, kArgsParsingFailure, "too few lines in the transfer list [%zd]",
+ if (lines.size() < kTransferListHeaderLines) {
+ ErrorAbort(state, kArgsParsingFailure, "too few lines in the transfer list [%zu]",
lines.size());
return StringValue("");
}
@@ -1654,12 +1655,6 @@ static Value* PerformBlockImageUpdate(const char* name, State* state,
return StringValue("t");
}
- if (lines.size() < 4) {
- ErrorAbort(state, kArgsParsingFailure, "too few lines in the transfer list [%zu]",
- lines.size());
- return StringValue("");
- }
-
// Third line is how many stash entries are needed simultaneously.
LOG(INFO) << "maximum stash entries " << lines[2];
@@ -1698,7 +1693,6 @@ 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 = kTransferListHeaderLines; i < lines.size(); i++) {
const std::string& line = lines[i];