From 087bc0c7d380fafc41bcc76610bff17f433cecd2 Mon Sep 17 00:00:00 2001 From: Tao Bao Date: Thu, 19 Jan 2017 10:46:39 -0800 Subject: imgpatch: Compile with ZLIB_CONST defined. So z_stream.next_in takes pointer to const data. Test: mmma bootable/recovery/applypatch Change-Id: If269b766a7c84fa2f67424ee61ba5afab0159261 --- applypatch/Android.mk | 12 +++++++++--- applypatch/imgpatch.cpp | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'applypatch') diff --git a/applypatch/Android.mk b/applypatch/Android.mk index ec3c6ee38..3c88d1f58 100644 --- a/applypatch/Android.mk +++ b/applypatch/Android.mk @@ -35,7 +35,9 @@ LOCAL_STATIC_LIBRARIES := \ libcrypto \ libbz \ libz -LOCAL_CFLAGS := -Werror +LOCAL_CFLAGS := \ + -DZLIB_CONST \ + -Werror include $(BUILD_STATIC_LIBRARY) # libimgpatch (static library) @@ -54,7 +56,9 @@ LOCAL_STATIC_LIBRARIES := \ libcrypto \ libbz \ libz -LOCAL_CFLAGS := -Werror +LOCAL_CFLAGS := \ + -DZLIB_CONST \ + -Werror include $(BUILD_STATIC_LIBRARY) # libimgpatch (host static library) @@ -74,7 +78,9 @@ LOCAL_STATIC_LIBRARIES := \ libcrypto \ libbz \ libz -LOCAL_CFLAGS := -Werror +LOCAL_CFLAGS := \ + -DZLIB_CONST \ + -Werror include $(BUILD_HOST_STATIC_LIBRARY) # libapplypatch_modes (static library) diff --git a/applypatch/imgpatch.cpp b/applypatch/imgpatch.cpp index ae6071f0e..00ea90efa 100644 --- a/applypatch/imgpatch.cpp +++ b/applypatch/imgpatch.cpp @@ -160,7 +160,7 @@ int ApplyImagePatch(const unsigned char* old_data, ssize_t old_size, const Value strm.zfree = Z_NULL; strm.opaque = Z_NULL; strm.avail_in = src_len; - strm.next_in = const_cast(old_data + src_start); + strm.next_in = old_data + src_start; strm.avail_out = expanded_len; strm.next_out = expanded_source.data(); -- cgit v1.2.3