external: upgrade to pdfium-3050 and stop using bundled zlib

Change-Id: I2e572585ea1cebc65aa364d8ce059cf0a3e1b83f
Reviewed-on: https://gerrit.libreoffice.org/36443
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
diff --git a/download.lst b/download.lst
index 56c3722..f372257 100644
--- a/download.lst
+++ b/download.lst
@@ -183,8 +183,8 @@ export OWNCLOUD_ANDROID_LIB_SHA256SUM := b18b3e3ef7fae6a79b62f2bb43cc47a5346b633
export OWNCLOUD_ANDROID_LIB_TARBALL := owncloud-android-library-0.9.4-no-binary-deps.tar.gz
export PAGEMAKER_SHA256SUM := 3b5de037692f8e156777a75e162f6b110fa24c01749e4a66d7eb83f364e52a33
export PAGEMAKER_TARBALL := libpagemaker-0.0.3.tar.bz2
export PDFIUM_SHA256SUM := 6cba5355eed239fd2186e5c4876899d1e0fa6c0aab55a377a39941e327834b01
export PDFIUM_TARBALL := cfcb6b4f3b5b6097edc5df7903ef00ea-pdfium-3021.tar.bz2
export PDFIUM_SHA256SUM := 27cbf262470eac93613079a0f2fcbbd26be50a8487c7be6607a5e15f4e7c9497
export PDFIUM_TARBALL := pdfium-3050.tar.bz2
export PIXMAN_SHA256SUM := 21b6b249b51c6800dc9553b65106e1e37d0e25df942c90531d4c3997aa20a88e
export PIXMAN_TARBALL := e80ebae4da01e77f68744319f01d52a3-pixman-0.34.0.tar.gz
export PNG_SHA256SUM := b6cec903e74e9fdd7b5bbcde0ab2415dd12f2f9e84d9e4d9ddd2ba26a41623b2
diff --git a/external/pdfium/Library_pdfium.mk b/external/pdfium/Library_pdfium.mk
index 79f8917..e8f2a9e 100644
--- a/external/pdfium/Library_pdfium.mk
+++ b/external/pdfium/Library_pdfium.mk
@@ -250,7 +250,6 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
# fpdfdoc
$(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
    UnpackedTarball/pdfium/core/fpdfdoc/cline \
    UnpackedTarball/pdfium/core/fpdfdoc/clines \
    UnpackedTarball/pdfium/core/fpdfdoc/cpdf_aaction \
    UnpackedTarball/pdfium/core/fpdfdoc/cpdf_action \
    UnpackedTarball/pdfium/core/fpdfdoc/cpdf_actionfields \
@@ -417,7 +416,7 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
    UnpackedTarball/pdfium/fpdfsdk/pdfwindow/PWL_SpecialButton \
    UnpackedTarball/pdfium/fpdfsdk/pdfwindow/PWL_Utils \
    UnpackedTarball/pdfium/fpdfsdk/pdfwindow/PWL_Wnd \
    UnpackedTarball/pdfium/fpdfsdk/pdfwindow/cpwl_pathdata \
    UnpackedTarball/pdfium/fpdfsdk/pdfwindow/cpwl_color \
))

# third_party/bigint
@@ -489,27 +488,11 @@ $(eval $(call gb_Library_add_generated_cobjects,pdfium,\
    UnpackedTarball/pdfium/third_party/libopenjpeg20/tgt \
))

# third_party/fx_zlib
$(eval $(call gb_Library_add_generated_cobjects,pdfium,\
    UnpackedTarball/pdfium/third_party/zlib_v128/adler32 \
    UnpackedTarball/pdfium/third_party/zlib_v128/compress \
    UnpackedTarball/pdfium/third_party/zlib_v128/crc32 \
    UnpackedTarball/pdfium/third_party/zlib_v128/deflate \
    UnpackedTarball/pdfium/third_party/zlib_v128/gzclose \
    UnpackedTarball/pdfium/third_party/zlib_v128/gzlib \
    UnpackedTarball/pdfium/third_party/zlib_v128/gzread \
    UnpackedTarball/pdfium/third_party/zlib_v128/gzwrite \
    UnpackedTarball/pdfium/third_party/zlib_v128/infback \
    UnpackedTarball/pdfium/third_party/zlib_v128/inffast \
    UnpackedTarball/pdfium/third_party/zlib_v128/inflate \
    UnpackedTarball/pdfium/third_party/zlib_v128/inftrees \
    UnpackedTarball/pdfium/third_party/zlib_v128/trees \
    UnpackedTarball/pdfium/third_party/zlib_v128/uncompr \
    UnpackedTarball/pdfium/third_party/zlib_v128/zutil \
$(eval $(call gb_Library_use_externals,pdfium,\
    jpeg \
    zlib \
))

$(eval $(call gb_Library_use_external,pdfium,jpeg))

ifeq ($(OS),LINUX)
$(eval $(call gb_Library_add_libs,pdfium,\
    -ldl \
diff --git a/external/pdfium/README b/external/pdfium/README
index e4b2a78..8c8cbc5 100644
--- a/external/pdfium/README
+++ b/external/pdfium/README
@@ -10,5 +10,3 @@ How to update the tarball:
version=$(git for-each-ref|grep chromium/|tail -n 1|sed 's|.*/||')
git archive --prefix=pdfium/ --format=tar origin/chromium/${version} > pdfium-${version}.tar
bzip2 pdfium-${version}.tar
checksum=$(md5sum pdfium-${version}.tar.bz2|sed 's| .*||')
mv pdfium-${version}.tar.bz2 ${checksum}-pdfium-${version}.tar.bz2
diff --git a/external/pdfium/UnpackedTarball_pdfium.mk b/external/pdfium/UnpackedTarball_pdfium.mk
index 732e6b2..d868cc0 100644
--- a/external/pdfium/UnpackedTarball_pdfium.mk
+++ b/external/pdfium/UnpackedTarball_pdfium.mk
@@ -12,6 +12,7 @@ pdfium_patches += visibility.patch.1
# To support macOS 10.9 baseline.
pdfium_patches += macos.patch.1
pdfium_patches += ubsan.patch
pdfium_patches += system-zlib.patch.1

$(eval $(call gb_UnpackedTarball_UnpackedTarball,pdfium))

diff --git a/external/pdfium/system-zlib.patch.1 b/external/pdfium/system-zlib.patch.1
new file mode 100644
index 0000000..9197fd2
--- /dev/null
+++ b/external/pdfium/system-zlib.patch.1
@@ -0,0 +1,13 @@
diff --git a/core/fxcodec/codec/fx_codec_flate.cpp b/core/fxcodec/codec/fx_codec_flate.cpp
index c73703f..ea601af 100644
--- a/core/fxcodec/codec/fx_codec_flate.cpp
+++ b/core/fxcodec/codec/fx_codec_flate.cpp
@@ -15,7 +15,7 @@
 #include "core/fxcrt/fx_ext.h"
 #include "third_party/base/numerics/safe_conversions.h"
 #include "third_party/base/ptr_util.h"
-#include "third_party/zlib_v128/zlib.h"
+#include "zlib.h"
 
 extern "C" {