summaryrefslogtreecommitdiffstats
path: root/applypatch/include
diff options
context:
space:
mode:
authorEthan Yonker <dees_troy@teamw.in>2017-12-14 21:43:59 +0100
committerEthan Yonker <dees_troy@teamw.in>2017-12-15 19:48:49 +0100
commitecbd3e8ba9d84eca9d4fdea9b24717364f81a668 (patch)
treed3027aeb161e13673416d1684e6f4e47c85241d0 /applypatch/include
parentFix build error in AOSP 8.1.0 r1 tree (diff)
parentMerge cherrypicks of [3156476, 3155698, 3156194, 3156639, 3156018, 3156477, 3156098, 3156099, 3156100, 3156101, 3156102, 3158393, 3155699, 3155700, 3156195, 3156196, 3156019, 3156020, 3158394] into oc-mr1-release (diff)
downloadandroid_bootable_recovery-ecbd3e8ba9d84eca9d4fdea9b24717364f81a668.tar
android_bootable_recovery-ecbd3e8ba9d84eca9d4fdea9b24717364f81a668.tar.gz
android_bootable_recovery-ecbd3e8ba9d84eca9d4fdea9b24717364f81a668.tar.bz2
android_bootable_recovery-ecbd3e8ba9d84eca9d4fdea9b24717364f81a668.tar.lz
android_bootable_recovery-ecbd3e8ba9d84eca9d4fdea9b24717364f81a668.tar.xz
android_bootable_recovery-ecbd3e8ba9d84eca9d4fdea9b24717364f81a668.tar.zst
android_bootable_recovery-ecbd3e8ba9d84eca9d4fdea9b24717364f81a668.zip
Diffstat (limited to 'applypatch/include')
-rw-r--r--applypatch/include/applypatch/applypatch.h17
-rw-r--r--applypatch/include/applypatch/imgpatch.h9
2 files changed, 11 insertions, 15 deletions
diff --git a/applypatch/include/applypatch/applypatch.h b/applypatch/include/applypatch/applypatch.h
index 4489decb6..581360ef1 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"
-typedef ssize_t (*SinkFn)(const unsigned char*, ssize_t, void*);
+using SinkFn = std::function<size_t(const unsigned char*, size_t)>;
// applypatch.cpp
int ShowLicenses();
@@ -66,18 +67,12 @@ int SaveFileContents(const char* filename, const FileContents* file);
// bspatch.cpp
void ShowBSDiffLicense();
-int ApplyBSDiffPatch(const unsigned char* old_data, ssize_t old_size,
- const Value* patch, ssize_t patch_offset,
- SinkFn sink, void* token, SHA_CTX* ctx);
-int ApplyBSDiffPatchMem(const unsigned char* old_data, ssize_t old_size,
- const Value* patch, ssize_t patch_offset,
- std::vector<unsigned char>* new_data);
+int ApplyBSDiffPatch(const unsigned char* old_data, size_t old_size, const Value* patch,
+ size_t patch_offset, SinkFn sink, SHA_CTX* ctx);
// imgpatch.cpp
-int ApplyImagePatch(const unsigned char* old_data, ssize_t old_size,
- const Value* patch,
- SinkFn sink, void* token, SHA_CTX* ctx,
- const Value* bonus_data);
+int ApplyImagePatch(const unsigned char* old_data, size_t old_size, const Value* patch, SinkFn sink,
+ 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 6549f79f0..07c66094f 100644
--- a/applypatch/include/applypatch/imgpatch.h
+++ b/applypatch/include/applypatch/imgpatch.h
@@ -19,10 +19,11 @@
#include <sys/types.h>
-using SinkFn = ssize_t (*)(const unsigned char*, ssize_t, void*);
+#include <functional>
-int ApplyImagePatch(const unsigned char* old_data, ssize_t old_size,
- const unsigned char* patch_data, ssize_t patch_size,
- SinkFn sink, void* token);
+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);
#endif // _APPLYPATCH_IMGPATCH_H