diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2017-11-03 22:40:22 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2017-11-03 22:40:22 +0000 |
commit | ec958fd4ee7a60bae0f980a78a146402316b0b9f (patch) | |
tree | 1422024a19eae60caa2c60c5cf532ca27d203a30 | |
parent | 36e84181df0b3960fe34fd97894c8a955a584683 (diff) | |
parent | 435a2031d62e868aae928ec3c4090ea3bbea3397 (diff) | |
download | recovery-oreo-m2-s5-release.tar.gz |
Snap for 4431872 from 435a2031d62e868aae928ec3c4090ea3bbea3397 to oc-m2-releaseandroid-8.1.0_r8android-8.1.0_r52android-8.1.0_r50android-8.1.0_r47android-8.1.0_r46android-8.1.0_r43android-8.1.0_r41android-8.1.0_r36android-8.1.0_r35android-8.1.0_r33android-8.1.0_r30android-8.1.0_r26android-8.1.0_r25android-8.1.0_r20android-8.1.0_r2oreo-m7-releaseoreo-m6-s4-releaseoreo-m6-s3-releaseoreo-m6-s2-releaseoreo-m2-s5-releaseoreo-m2-s4-releaseoreo-m2-s3-releaseoreo-m2-s2-releaseoreo-m2-s1-releaseoreo-m2-release
Change-Id: I4ece9d5cd260040af666980d17cd8f06c04b9921
-rw-r--r-- | update_verifier/update_verifier.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/update_verifier/update_verifier.cpp b/update_verifier/update_verifier.cpp index faebbede..ba7b7aec 100644 --- a/update_verifier/update_verifier.cpp +++ b/update_verifier/update_verifier.cpp @@ -137,11 +137,12 @@ static bool read_blocks(const std::string& partition, const std::string& range_s LOG(ERROR) << "Error in parsing range string."; return false; } + range_count /= 2; std::vector<std::future<bool>> threads; size_t thread_num = std::thread::hardware_concurrency() ?: 4; - thread_num = std::min(thread_num, range_count / 2); - size_t group_range_count = range_count / thread_num; + thread_num = std::min(thread_num, range_count); + size_t group_range_count = (range_count + thread_num - 1) / thread_num; for (size_t t = 0; t < thread_num; t++) { auto thread_func = [t, group_range_count, &dm_block_device, &ranges, &partition]() { @@ -154,7 +155,8 @@ static bool read_blocks(const std::string& partition, const std::string& range_s return false; } - for (size_t i = 1 + group_range_count * t; i < group_range_count * (t + 1) + 1; i += 2) { + for (size_t i = group_range_count * 2 * t + 1; + i < std::min(group_range_count * 2 * (t + 1) + 1, ranges.size()); i += 2) { unsigned int range_start, range_end; bool parse_status = android::base::ParseUint(ranges[i], &range_start); parse_status = parse_status && android::base::ParseUint(ranges[i + 1], &range_end); |