From fada91ccf2b31d69d72899388b1833186d763d1a Mon Sep 17 00:00:00 2001 From: Tao Bao Date: Thu, 27 Oct 2016 18:16:06 -0700 Subject: applypatch: Switch the parameter of Value** to std::vector. Test: Unit tests and install-recovery.sh pass on angler and dragon. Change-Id: I328e6554edca667cf850f5584ebf1ac211e3d4d1 --- applypatch/main.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'applypatch/main.cpp') diff --git a/applypatch/main.cpp b/applypatch/main.cpp index 294f7ee21..988b6f9b1 100644 --- a/applypatch/main.cpp +++ b/applypatch/main.cpp @@ -23,9 +23,10 @@ #include #include +#include + #include "applypatch/applypatch.h" #include "edify/expr.h" -#include "openssl/sha.h" static int CheckMode(int argc, char** argv) { if (argc < 3) { @@ -129,15 +130,13 @@ static int PatchMode(int argc, char** argv) { printf("failed to parse patch args\n"); return 1; } - std::vector patches; - std::vector patch_ptrs; + + std::vector> patches; for (size_t i = 0; i < files.size(); ++i) { - patches.push_back(Value(VAL_BLOB, - std::string(files[i].data.cbegin(), files[i].data.cend()))); - patch_ptrs.push_back(&patches[i]); + patches.push_back(std::make_unique( + VAL_BLOB, std::string(files[i].data.cbegin(), files[i].data.cend()))); } - return applypatch(argv[1], argv[2], argv[3], target_size, - sha1s, patch_ptrs.data(), &bonus); + return applypatch(argv[1], argv[2], argv[3], target_size, sha1s, patches, &bonus); } // This program applies binary patches to files in a way that is safe -- cgit v1.2.3