summaryrefslogtreecommitdiffstats
path: root/applypatch/bspatch.cpp
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2016-10-18 02:05:12 +0200
committerGerrit Code Review <noreply-gerritcodereview@google.com>2016-10-18 02:05:12 +0200
commit2b17b24ae5eccd6c472c06abde93b5b83950c658 (patch)
tree021638587b8614ddaf65a41b38129cbb4034f7e4 /applypatch/bspatch.cpp
parentMerge "init: move healthd to late-init" (diff)
parentChange StringValue to use std::string (diff)
downloadandroid_bootable_recovery-2b17b24ae5eccd6c472c06abde93b5b83950c658.tar
android_bootable_recovery-2b17b24ae5eccd6c472c06abde93b5b83950c658.tar.gz
android_bootable_recovery-2b17b24ae5eccd6c472c06abde93b5b83950c658.tar.bz2
android_bootable_recovery-2b17b24ae5eccd6c472c06abde93b5b83950c658.tar.lz
android_bootable_recovery-2b17b24ae5eccd6c472c06abde93b5b83950c658.tar.xz
android_bootable_recovery-2b17b24ae5eccd6c472c06abde93b5b83950c658.tar.zst
android_bootable_recovery-2b17b24ae5eccd6c472c06abde93b5b83950c658.zip
Diffstat (limited to 'applypatch/bspatch.cpp')
-rw-r--r--applypatch/bspatch.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/applypatch/bspatch.cpp b/applypatch/bspatch.cpp
index a4945da28..eb45e9ce9 100644
--- a/applypatch/bspatch.cpp
+++ b/applypatch/bspatch.cpp
@@ -64,7 +64,7 @@ void ShowBSDiffLicense() {
);
}
-static off_t offtin(u_char *buf)
+static off_t offtin(const u_char *buf)
{
off_t y;
@@ -130,7 +130,7 @@ int ApplyBSDiffPatchMem(const unsigned char* old_data, ssize_t old_size,
// from oldfile to x bytes from the diff block; copy y bytes from the
// extra block; seek forwards in oldfile by z bytes".
- unsigned char* header = (unsigned char*) patch->data + patch_offset;
+ const unsigned char* header = reinterpret_cast<const unsigned char*>(&patch->data[patch_offset]);
if (memcmp(header, "BSDIFF40", 8) != 0) {
printf("corrupt bsdiff patch file header (magic number)\n");
return 1;
@@ -149,7 +149,7 @@ int ApplyBSDiffPatchMem(const unsigned char* old_data, ssize_t old_size,
int bzerr;
bz_stream cstream;
- cstream.next_in = patch->data + patch_offset + 32;
+ cstream.next_in = const_cast<char*>(&patch->data[patch_offset + 32]);
cstream.avail_in = ctrl_len;
cstream.bzalloc = NULL;
cstream.bzfree = NULL;
@@ -159,7 +159,7 @@ int ApplyBSDiffPatchMem(const unsigned char* old_data, ssize_t old_size,
}
bz_stream dstream;
- dstream.next_in = patch->data + patch_offset + 32 + ctrl_len;
+ dstream.next_in = const_cast<char*>(&patch->data[patch_offset + 32 + ctrl_len]);
dstream.avail_in = data_len;
dstream.bzalloc = NULL;
dstream.bzfree = NULL;
@@ -169,8 +169,8 @@ int ApplyBSDiffPatchMem(const unsigned char* old_data, ssize_t old_size,
}
bz_stream estream;
- estream.next_in = patch->data + patch_offset + 32 + ctrl_len + data_len;
- estream.avail_in = patch->size - (patch_offset + 32 + ctrl_len + data_len);
+ estream.next_in = const_cast<char*>(&patch->data[patch_offset + 32 + ctrl_len + data_len]);
+ estream.avail_in = patch->data.size() - (patch_offset + 32 + ctrl_len + data_len);
estream.bzalloc = NULL;
estream.bzfree = NULL;
estream.opaque = NULL;