summaryrefslogtreecommitdiffstats
path: root/applypatch/include
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2017-02-01 19:20:10 +0100
committerTao Bao <tbao@google.com>2017-03-28 19:14:53 +0200
commitc0e1c46a707370952ea1ddeb71b176d04fe71bb9 (patch)
treeee0958c7ee3dfbcb545fa285715d0ac81896661e /applypatch/include
parentapplypatch: Change the ssize_t length parameters to size_t. (diff)
downloadandroid_bootable_recovery-c0e1c46a707370952ea1ddeb71b176d04fe71bb9.tar
android_bootable_recovery-c0e1c46a707370952ea1ddeb71b176d04fe71bb9.tar.gz
android_bootable_recovery-c0e1c46a707370952ea1ddeb71b176d04fe71bb9.tar.bz2
android_bootable_recovery-c0e1c46a707370952ea1ddeb71b176d04fe71bb9.tar.lz
android_bootable_recovery-c0e1c46a707370952ea1ddeb71b176d04fe71bb9.tar.xz
android_bootable_recovery-c0e1c46a707370952ea1ddeb71b176d04fe71bb9.tar.zst
android_bootable_recovery-c0e1c46a707370952ea1ddeb71b176d04fe71bb9.zip
Diffstat (limited to 'applypatch/include')
-rw-r--r--applypatch/include/applypatch/applypatch.h7
-rw-r--r--applypatch/include/applypatch/imgpatch.h6
2 files changed, 8 insertions, 5 deletions
diff --git a/applypatch/include/applypatch/applypatch.h b/applypatch/include/applypatch/applypatch.h
index 52fb58287..da55432d5 100644
--- a/applypatch/include/applypatch/applypatch.h
+++ b/applypatch/include/applypatch/applypatch.h
@@ -20,6 +20,7 @@
#include <stdint.h>
#include <sys/stat.h>
+#include <functional>
#include <memory>
#include <string>
#include <vector>
@@ -41,7 +42,7 @@ struct FileContents {
// and use it as the source instead.
#define CACHE_TEMP_SOURCE "/cache/saved.file"
-using SinkFn = size_t (*)(const unsigned char*, size_t, void*);
+using SinkFn = std::function<size_t(const unsigned char*, size_t)>;
// applypatch.cpp
int ShowLicenses();
@@ -67,13 +68,13 @@ int SaveFileContents(const char* filename, const FileContents* file);
// bspatch.cpp
void ShowBSDiffLicense();
int ApplyBSDiffPatch(const unsigned char* old_data, size_t old_size, const Value* patch,
- size_t patch_offset, SinkFn sink, void* token, SHA_CTX* ctx);
+ size_t patch_offset, SinkFn sink, SHA_CTX* ctx);
int ApplyBSDiffPatchMem(const unsigned char* old_data, size_t old_size, const Value* patch,
size_t patch_offset, std::vector<unsigned char>* new_data);
// imgpatch.cpp
int ApplyImagePatch(const unsigned char* old_data, size_t old_size, const Value* patch, SinkFn sink,
- void* token, SHA_CTX* ctx, const Value* bonus_data);
+ SHA_CTX* ctx, const Value* bonus_data);
// freecache.cpp
int MakeFreeSpaceOnCache(size_t bytes_needed);
diff --git a/applypatch/include/applypatch/imgpatch.h b/applypatch/include/applypatch/imgpatch.h
index 16e4c4f57..07c66094f 100644
--- a/applypatch/include/applypatch/imgpatch.h
+++ b/applypatch/include/applypatch/imgpatch.h
@@ -19,9 +19,11 @@
#include <sys/types.h>
-using SinkFn = size_t (*)(const unsigned char*, size_t, void*);
+#include <functional>
+
+using SinkFn = std::function<size_t(const unsigned char*, size_t)>;
int ApplyImagePatch(const unsigned char* old_data, size_t old_size, const unsigned char* patch_data,
- size_t patch_size, SinkFn sink, void* token);
+ size_t patch_size, SinkFn sink);
#endif // _APPLYPATCH_IMGPATCH_H