From c31db81a9fbe4d08fc71b7039e804776b31edc26 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 13 Sep 2021 16:18:07 +0200 Subject: update to 2.3.3 open https://github.com/libgd/libgd/pull/766 missing macros open https://github.com/libgd/libgd/pull/767 missing headers --- compat_reports/2.3.2_to_2.3.3/compat_report.html | 2778 ++++++++++++++++++++++ gd.spec | 22 +- label.heic | Bin 1170 -> 0 bytes libgd-flip.patch | 50 + libgd-iostream.patch | 35 + libgd-upstream.patch | 196 -- 6 files changed, 2878 insertions(+), 203 deletions(-) create mode 100644 compat_reports/2.3.2_to_2.3.3/compat_report.html delete mode 100644 label.heic create mode 100644 libgd-flip.patch create mode 100644 libgd-iostream.patch delete mode 100644 libgd-upstream.patch diff --git a/compat_reports/2.3.2_to_2.3.3/compat_report.html b/compat_reports/2.3.2_to_2.3.3/compat_report.html new file mode 100644 index 0000000..d47f7e0 --- /dev/null +++ b/compat_reports/2.3.2_to_2.3.3/compat_report.html @@ -0,0 +1,2778 @@ + + + + + + + + + +libgd: 2.3.2 to 2.3.3 compatibility report + + + +

API compatibility report for the libgd library between 2.3.2 and 2.3.3 versions on x86_64

+ +
+
+ Binary
Compatibility
+ Source
Compatibility
+
+

Test Info


+ + + + + + + +
Library Namelibgd
Version #12.3.2
Version #22.3.3
Archx86_64
GCC Version10
SubjectBinary Compatibility
+

Test Results


+ + + + + + +
Total Header Files10
Total Libraries1
Total Symbols / Types251 / 59
Compatibility100%
+

Problem Summary


+ + + + + + + + + + + +
SeverityCount
Added Symbols-0
Removed SymbolsHigh0
Problems with
Data Types
High0
Medium0
Low9
Problems with
Symbols
High0
Medium0
Low29
Problems with
Constants
Low2
Other Changes
in Data Types
-8
Other Changes
in Constants
-1
+ + +

Problems with Data Types, Low Severity  9 


+gd.h
+ +[+] enum gdInterpolationMethod  1  +
+ + + +[+] typedef interpolation_method  1  +
+ + +
+gd_io.h
+ +[+] struct gdIOCtx  7  +
+ + +
+to the top
+ +

Problems with Symbols, Low Severity  29 


+gd.h, libgd.so.3.0.10
+ +[+] gdDPExtractData ( struct gdIOCtx* ctx, int* size )  1  +
+ + +[+] gdImageAvifCtx ( gdImagePtr im, gdIOCtx* outfile, int quality, int speed )  1  +
+ + +[+] gdImageCreateFromAvifCtx ( gdIOCtx* infile )  1  +
+ + +[+] gdImageCreateFromHeifCtx ( gdIOCtx* infile )  1  +
+ + +[+] gdImageCreateFromJpegCtx ( gdIOCtx* infile )  1  +
+ + +[+] gdImageCreateFromJpegCtxEx ( gdIOCtx* infile, int ignore_warning )  1  +
+ + +[+] gdImageCreateFromTgaCtx ( gdIOCtx* ctx )  1  +
+ + +[+] gdImageCreateFromTiffCtx ( gdIOCtx* infile )  1  +
+ + +[+] gdImageCreateFromWBMPCtx ( gdIOCtx* infile )  1  +
+ + +[+] gdImageCreateFromWebpCtx ( gdIOCtx* infile )  1  +
+ + +[+] gdImageGifAnimAddCtx ( gdImagePtr im, gdIOCtx* out, int LocalCM, int LeftOfs, int TopOfs, int Delay, int Disposal, gdImagePtr previm )  1  +
+ + +[+] gdImageGifAnimBeginCtx ( gdImagePtr im, gdIOCtx* out, int GlobalCM, int Loops )  1  +
+ + +[+] gdImageGifAnimEndCtx ( gdIOCtx* out )  1  +
+ + +[+] gdImageGifCtx ( gdImagePtr im, gdIOCtx* out )  1  +
+ + +[+] gdImageHeifCtx ( gdImagePtr im, gdIOCtx* outfile, int quality, enum gdHeifCodec codec, gdHeifChroma chroma )  1  +
+ + +[+] gdImageJpegCtx ( gdImagePtr im, gdIOCtx* out, int quality )  1  +
+ + +[+] gdImagePngCtx ( gdImagePtr im, gdIOCtx* out )  1  +
+ + +[+] gdImagePngCtxEx ( gdImagePtr im, gdIOCtx* out, int level )  1  +
+ + +[+] gdImageStringFT ( gdImage* im, int* brect, int fg, char const* fontlist, double ptsize, double angle, int x, int y, char const* string )  1  +
+ + +[+] gdImageStringFTEx ( gdImage* im, int* brect, int fg, char const* fontlist, double ptsize, double angle, int x, int y, char const* string, gdFTStringExtraPtr strex )  1  +
+ + +[+] gdImageStringTTF ( gdImage* im, int* brect, int fg, char const* fontlist, double ptsize, double angle, int x, int y, char const* string )  1  +
+ + +[+] gdImageTiffCtx ( gdImagePtr image, gdIOCtx* out )  1  +
+ + +[+] gdImageWBMPCtx ( gdImagePtr image, int fg, gdIOCtx* out )  1  +
+ + +[+] gdImageWebpCtx ( gdImagePtr im, gdIOCtx* outfile, int quantization )  1  +
+ + +[+] gdImageXbmCtx ( gdImagePtr image, char* file_name, int fg, gdIOCtx* out )  1  +
+ + +[+] gdNewDynamicCtx ( int size, void* data )  1  +
+ + +[+] gdNewDynamicCtxEx ( int size, void* data, int freeFlag )  1  +
+ + +[+] gdNewFileCtx ( FILE* p1 )  1  +
+ + +[+] gdNewSSCtx ( gdSourcePtr in, gdSinkPtr out )  1  +
+ +
+to the top
+ +

Problems with Constants, Low Severity  2 


+entities.h
+ +[+] ENTITY_NAME_LENGTH_MAX +
+ + + +[+] NR_OF_ENTITIES +
+ + +
+to the top
+ +

Other Changes in Data Types  8 


+gd.h
+ +[+] enum gdInterpolationMethod  8  +
+ + +
+to the top
+ +

Other Changes in Constants  1 


+gd.h
+ +[+] gdWebpLossless +
+ + +
+to the top
+

Header Files  10 


+
+entities.h
+gd.h
+gd_io.h
+gdcache.h
+gdfontg.h
+gdfontl.h
+gdfontmb.h
+gdfonts.h
+gdfontt.h
+gdfx.h
+
+
to the top
+

Libraries  1 


+
+libgd.so.3.0.10
+
+
to the top
+


+

Test Info


+ + + + + + +
Library Namelibgd
Version #12.3.2
Version #22.3.3
Archx86_64
SubjectSource Compatibility
+

Test Results


+ + + + + + +
Total Header Files10
Total Libraries1
Total Symbols / Types509 / 123
Compatibility99.8%
+

Problem Summary


+ + + + + + + + + + + +
SeverityCount
Added Symbols-19
Removed SymbolsHigh1
Problems with
Data Types
High0
Medium0
Low8
Problems with
Symbols
High0
Medium0
Low38
Problems with
Constants
Low3
Other Changes
in Data Types
-9
Other Changes
in Constants
-7
+ +

Added Symbols  19 


+gd_color_map.h
+GD_COLOR_MAP_X11 [data]
+gdColorMapLookup ( struct gdColorMap const color_map, char const* color_name, int* r, int* g, int* b )
+
+gd_errors.h
+gd_error ( char const* format, ... )
+gd_error_ex ( int priority, char const* format, ... )
+
+iostream
+__dso_handle [data]
+
+iostream
+namespace std
+__ioinit [data]
+cerr [data]
+cin [data]
+clog [data]
+cout [data]
+wcerr [data]
+wcin [data]
+wclog [data]
+wcout [data]
+
+syslog.h
+closelog ( )
+openlog ( char const* __ident, int __option, int __facility )
+setlogmask ( int __mask )
+syslog ( int __pri, char const* __fmt, ... )
+vsyslog ( int __pri, char const* __fmt, struct __va_list_tag* __ap )
+
+to the top
+

Removed Symbols  1 


+entities.h
+entities [data]
+
+to the top
+ +

Problems with Data Types, Low Severity  8 


+gd.h
+ +[+] typedef interpolation_method  1  +
+ + +
+gd_io.h
+ +[+] struct gdIOCtx  7  +
+ + +
+to the top
+ +

Problems with Symbols, Low Severity  38 


+gd.h
+ +[+] gdImageAvifCtx ( gdImagePtr im, gdIOCtx* outfile, int quality, int speed )  1  +
+ + +[+] gdImageCreateFromAvifCtx ( gdIOCtx* infile )  1  +
+ + +[+] gdImageCreateFromHeifCtx ( gdIOCtx* infile )  1  +
+ + +[+] gdImageCreateFromJpegCtx ( gdIOCtx* infile )  1  +
+ + +[+] gdImageCreateFromJpegCtxEx ( gdIOCtx* infile, int ignore_warning )  1  +
+ + +[+] gdImageCreateFromTgaCtx ( gdIOCtx* ctx )  1  +
+ + +[+] gdImageCreateFromTiffCtx ( gdIOCtx* infile )  1  +
+ + +[+] gdImageCreateFromWBMPCtx ( gdIOCtx* infile )  1  +
+ + +[+] gdImageCreateFromWebpCtx ( gdIOCtx* infile )  1  +
+ + +[+] gdImageGifAnimAddCtx ( gdImagePtr im, gdIOCtx* out, int LocalCM, int LeftOfs, int TopOfs, int Delay, int Disposal, gdImagePtr previm )  1  +
+ + +[+] gdImageGifAnimBeginCtx ( gdImagePtr im, gdIOCtx* out, int GlobalCM, int Loops )  1  +
+ + +[+] gdImageGifAnimEndCtx ( gdIOCtx* out )  1  +
+ + +[+] gdImageGifCtx ( gdImagePtr im, gdIOCtx* out )  1  +
+ + +[+] gdImageHeifCtx ( gdImagePtr im, gdIOCtx* outfile, int quality, enum gdHeifCodec codec, gdHeifChroma chroma )  1  +
+ + +[+] gdImageJpegCtx ( gdImagePtr im, gdIOCtx* out, int quality )  1  +
+ + +[+] gdImagePngCtx ( gdImagePtr im, gdIOCtx* out )  1  +
+ + +[+] gdImagePngCtxEx ( gdImagePtr im, gdIOCtx* out, int level )  1  +
+ + +[+] gdImageTiffCtx ( gdImagePtr image, gdIOCtx* out )  1  +
+ + +[+] gdImageWBMPCtx ( gdImagePtr image, int fg, gdIOCtx* out )  1  +
+ + +[+] gdImageWebpCtx ( gdImagePtr im, gdIOCtx* outfile, int quantization )  1  +
+ + +[+] gdImageXbmCtx ( gdImagePtr image, char* file_name, int fg, gdIOCtx* out )  1  +
+ + +[+] gdNewDynamicCtx ( int size, void* data )  1  +
+ + +[+] gdNewDynamicCtxEx ( int size, void* data, int freeFlag )  1  +
+ + +[+] gdNewFileCtx ( FILE* p1 )  1  +
+ + +[+] gdNewSSCtx ( gdSourcePtr in, gdSinkPtr out )  1  +
+ +
+gd_io.h
+ +[+] gdGetBuf ( void* p1, int p2, gdIOCtx* p3 )  1  +
+ + +[+] gdGetByte ( int* result, gdIOCtx* ctx )  1  +
+ + +[+] gdGetC ( gdIOCtx* ctx )  1  +
+ + +[+] gdGetInt ( int* result, gdIOCtx* ctx )  1  +
+ + +[+] gdGetIntLSB ( int* result, gdIOCtx* ctx )  1  +
+ + +[+] gdGetWord ( int* result, gdIOCtx* ctx )  1  +
+ + +[+] gdGetWordLSB ( short* result, gdIOCtx* ctx )  1  +
+ + +[+] gdPutBuf ( void const* p1, int p2, gdIOCtx* p3 )  1  +
+ + +[+] gdPutC ( unsigned char const c, gdIOCtx* ctx )  1  +
+ + +[+] gdPutInt ( int w, gdIOCtx* ctx )  1  +
+ + +[+] gdPutWord ( int w, gdIOCtx* ctx )  1  +
+ + +[+] gdSeek ( gdIOCtx* ctx, int const offset )  1  +
+ + +[+] gdTell ( gdIOCtx* ctx )  1  +
+ +
+to the top
+ +

Problems with Constants, Low Severity  3 


+entities.h
+ +[+] ENTITY_NAME_LENGTH_MAX +
+ + + +[+] NR_OF_ENTITIES +
+ + +
+gd.h
+ +[+] GD_RELEASE_VERSION +
+ + +
+to the top
+ +

Other Changes in Data Types  9 


+gd.h
+ +[+] enum gdInterpolationMethod  9  +
+ + +
+to the top
+ +

Other Changes in Constants  7 


+gd.h
+ +[+] BGD_MALLOC +
+ + + +[+] gdWebpLossless +
+ + +
+gd_errors.h
+ +[+] GD_DEBUG +
+ + + +[+] GD_ERROR +
+ + + +[+] GD_INFO +
+ + + +[+] GD_NOTICE +
+ + + +[+] GD_WARNING +
+ + +
+to the top
+

Header Files  10 


+
+entities.h
+gd.h
+gd_io.h
+gdcache.h
+gdfontg.h
+gdfontl.h
+gdfontmb.h
+gdfonts.h
+gdfontt.h
+gdfx.h
+
+
to the top
+

Libraries  1 


+
+libgd.so.3.0.10
+
+
to the top
+



+ +
+ + diff --git a/gd.spec b/gd.spec index 06c2e1b..890a5f1 100644 --- a/gd.spec +++ b/gd.spec @@ -44,8 +44,8 @@ Name: gd %else Name: gd-last %endif -Version: 2.3.2 -Release: 4%{?prever}%{?short}%{?dist} +Version: 2.3.3 +Release: 1%{?prever}%{?short}%{?dist} License: MIT URL: http://libgd.github.io/ %if 0%{?commit:1} @@ -55,10 +55,11 @@ Source0: libgd-%{version}-%{commit}.tgz %else Source0: https://github.com/libgd/libgd/releases/download/gd-%{version}/libgd-%{version}.tar.xz %endif -# Missing, temporary workaround, fixed upstream for next version -Source1: https://raw.githubusercontent.com/libgd/libgd/gd-%{version}/tests/heif/label.heic -Patch0: libgd-upstream.patch +# Needed by PHP see https://github.com/libgd/libgd/pull/766 +Patch0: libgd-flip.patch +# Missing header see https://github.com/libgd/libgd/pull/766 +Patch1: libgd-iostream.patch BuildRequires: freetype-devel BuildRequires: fontconfig-devel @@ -167,8 +168,8 @@ files for gd, a graphics library for creating PNG and JPEG graphics. %prep %setup -q -n libgd-%{version}%{?prever:-%{prever}} -install -m 0644 %{SOURCE1} tests/heif/ -%patch0 -p1 -b .up +%patch0 -p1 +%patch1 -p1 : $(perl config/getver.pl) @@ -247,6 +248,8 @@ XFAIL_TESTS="gdimagegrayscale/basic $XFAIL_TESTS" %endif %endif export XFAIL_TESTS +# Workaround to https://github.com/libgd/libgd/issues/763 +export TMPDIR=/tmp : Upstream test suite make check %{?_smp_mflags} @@ -276,6 +279,11 @@ grep %{version} $RPM_BUILD_ROOT%{_libdir}/pkgconfig/gdlib.pc %changelog +* Mon Sep 13 2021 Remi Collet - 2.3.3-1 +- update to 2.3.3 +- open https://github.com/libgd/libgd/pull/766 missing macros +- open https://github.com/libgd/libgd/pull/767 missing headers + * Wed Apr 28 2021 Remi Collet - 2.3.2-4 - rebuild for libavif new soname on Fedora 34 diff --git a/label.heic b/label.heic deleted file mode 100644 index 12814f7..0000000 Binary files a/label.heic and /dev/null differ diff --git a/libgd-flip.patch b/libgd-flip.patch new file mode 100644 index 0000000..4fa964f --- /dev/null +++ b/libgd-flip.patch @@ -0,0 +1,50 @@ +From f4bc1f5c26925548662946ed7cfa473c190a104a Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Mon, 13 Sep 2021 14:57:52 +0200 +Subject: [PATCH 1/2] Revert "Fix #318, these macros are not used as planed, we + have separate functions for each" + +This reverts commit bdc281eadb1d58d5c0c7bbc1125ee4674256df08. +--- + src/gd.h | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/src/gd.h b/src/gd.h +index 30560395..1ad9e637 100644 +--- a/src/gd.h ++++ b/src/gd.h +@@ -1604,6 +1604,11 @@ BGD_DECLARE(void) gdImageFlipHorizontal(gdImagePtr im); + BGD_DECLARE(void) gdImageFlipVertical(gdImagePtr im); + BGD_DECLARE(void) gdImageFlipBoth(gdImagePtr im); + ++#define GD_FLIP_HORINZONTAL 1 /* typo, kept for BC */ ++#define GD_FLIP_HORIZONTAL 1 ++#define GD_FLIP_VERTICAL 2 ++#define GD_FLIP_BOTH 3 ++ + /** + * Group: Crop + * + +From e47c619d792455aad23708d2ec2947455394427e Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Mon, 13 Sep 2021 14:59:47 +0200 +Subject: [PATCH 2/2] add comment to not remove these macros + +--- + src/gd.h | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/gd.h b/src/gd.h +index 1ad9e637..71f5a89c 100644 +--- a/src/gd.h ++++ b/src/gd.h +@@ -1604,6 +1604,8 @@ BGD_DECLARE(void) gdImageFlipHorizontal(gdImagePtr im); + BGD_DECLARE(void) gdImageFlipVertical(gdImagePtr im); + BGD_DECLARE(void) gdImageFlipBoth(gdImagePtr im); + ++/* Macros still used in gd extension up to PHP 8.0 ++ so please keep these unused macros for now */ + #define GD_FLIP_HORINZONTAL 1 /* typo, kept for BC */ + #define GD_FLIP_HORIZONTAL 1 + #define GD_FLIP_VERTICAL 2 diff --git a/libgd-iostream.patch b/libgd-iostream.patch new file mode 100644 index 0000000..c80b3ec --- /dev/null +++ b/libgd-iostream.patch @@ -0,0 +1,35 @@ +From 01bcbdcae35b90de082012e639094c711a7aa2b3 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Mon, 13 Sep 2021 15:05:18 +0200 +Subject: [PATCH] install missing header, used by gdpp.h + +--- + src/CMakeLists.txt | 1 + + src/Makefile.am | 2 +- + 2 files changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 3839bc78..c1eea100 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -194,6 +194,7 @@ install(FILES + gdfontt.h + gdfx.h + gdpp.h ++ gd_io_stream.h + DESTINATION include) + + CONFIGURE_FILE(../config/gdlib.pc.cmake gdlib.pc @ONLY) +diff --git a/src/Makefile.am b/src/Makefile.am +index dbe9243c..c8c779f1 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -52,7 +52,7 @@ EXTRA_DIST = \ + msinttypes/inttypes.h \ + msinttypes/stdint.h + +-include_HEADERS = gd.h gdfx.h gd_io.h gdcache.h gdfontg.h gdfontl.h gdfontmb.h gdfonts.h gdfontt.h gd_color_map.h gd_errors.h gdpp.h ++include_HEADERS = gd.h gdfx.h gd_io.h gdcache.h gdfontg.h gdfontl.h gdfontmb.h gdfonts.h gdfontt.h gd_color_map.h gd_errors.h gdpp.h gd_io_stream.h + + lib_LTLIBRARIES = libgd.la + diff --git a/libgd-upstream.patch b/libgd-upstream.patch deleted file mode 100644 index 332ad69..0000000 --- a/libgd-upstream.patch +++ /dev/null @@ -1,196 +0,0 @@ -From f7d12c91fa8bb0313dfc9d5ca827674c49a7bc9d Mon Sep 17 00:00:00 2001 -From: Martin Reboredo <39890836+YakoYakoYokuYoku@users.noreply.github.com> -Date: Tue, 16 Mar 2021 12:53:16 -0300 -Subject: [PATCH] Permit compilation with libheif version 1.7.0 (#686) - -libheif versions that came before 1.9.0 don't support changing the output image chroma. -I did not notice that and it resulted with tests failures across other OSes that don't have -a much newer libheif. - -See #678. Supersedes #685. ---- - src/gd_heif.c | 14 ++++++++------ - tests/heif/heif_im2im.c | 3 +++ - 2 files changed, 11 insertions(+), 6 deletions(-) - -diff --git a/src/gd_heif.c b/src/gd_heif.c -index 3b00a6c5..47ecd7ad 100644 ---- a/src/gd_heif.c -+++ b/src/gd_heif.c -@@ -321,12 +321,14 @@ static int _gdImageHeifCtx(gdImagePtr im, gdIOCtx *outfile, int quality, gdHeifC - return GD_FALSE; - } - -- err = heif_encoder_set_parameter_string(heif_enc, "chroma", chroma); -- if (err.code != heif_error_Ok) { -- gd_error("gd-heif invalid chroma subsampling parameter\n"); -- heif_encoder_release(heif_enc); -- heif_context_free(heif_ctx); -- return GD_FALSE; -+ if (heif_get_version_number_major() >= 1 && heif_get_version_number_minor() >= 9) { -+ err = heif_encoder_set_parameter_string(heif_enc, "chroma", chroma); -+ if (err.code != heif_error_Ok) { -+ gd_error("gd-heif invalid chroma subsampling parameter\n"); -+ heif_encoder_release(heif_enc); -+ heif_context_free(heif_ctx); -+ return GD_FALSE; -+ } - } - - err = heif_image_create(gdImageSX(im), gdImageSY(im), heif_colorspace_RGB, heif_chroma_interleaved_RGBA, &heif_im); -diff --git a/tests/heif/heif_im2im.c b/tests/heif/heif_im2im.c -index 202d6b3e..01abf021 100644 ---- a/tests/heif/heif_im2im.c -+++ b/tests/heif/heif_im2im.c -@@ -17,6 +17,9 @@ int main() - int size = 0; - CuTestImageResult result = {0, 0}; - -+ if (!gdTestAssertMsg(heif_get_version_number_major() == 1 && heif_get_version_number_minor() >= 9, "changing chroma subsampling is not supported in this libheif version\n")) -+ return 77; -+ - if (!gdTestAssertMsg(heif_have_decoder_for_format(heif_compression_HEVC) && heif_have_encoder_for_format(heif_compression_HEVC), "HEVC codec support missing from libheif\n")) - return 77; - -From f6a111c632fcf76dd3a42d750f18d2ed7bf8a5f1 Mon Sep 17 00:00:00 2001 -From: Ben Morss -Date: Tue, 16 Mar 2021 12:26:17 -0400 -Subject: [PATCH] Fix for libavif v0.8.2 (#680) - -Don't return AVIF_RESULT_TRUNCATED_DATA, as this is normal for libavif <= 0.8.2. In our tests, -this makes tests pass with libavif 0.8.2. - -Plus, we did a few things to stop compiler warnings - and added a newline to error output. - -thanks @wantehchang for the collaboration here! - -This fixes #677. ---- - src/gd_avif.c | 19 ++++++++++++------- - 1 file changed, 12 insertions(+), 7 deletions(-) - -diff --git a/src/gd_avif.c b/src/gd_avif.c -index cf94c70a..20906618 100644 ---- a/src/gd_avif.c -+++ b/src/gd_avif.c -@@ -151,7 +151,7 @@ static avifBool isAvifSrgbImage(avifImage *avifIm) { - */ - static avifBool isAvifError(avifResult result, const char *msg) { - if (result != AVIF_RESULT_OK) { -- gd_error("avif error - %s: %s", msg, avifResultToString(result)); -+ gd_error("avif error - %s: %s\n", msg, avifResultToString(result)); - return AVIF_TRUE; - } - -@@ -177,13 +177,18 @@ static avifResult readFromCtx(avifIO *io, uint32_t readFlags, uint64_t offset, s - void *dataBuf = NULL; - gdIOCtx *ctx = (gdIOCtx *) io->data; - -+ // readFlags is unsupported -+ if (readFlags != 0) { -+ return AVIF_RESULT_IO_ERROR; -+ } -+ - // TODO: if we set sizeHint, this will be more efficient. - -- if (offset > LONG_MAX || size < 0) -+ if (offset > INT_MAX || size > INT_MAX) - return AVIF_RESULT_IO_ERROR; - - // Try to seek offset bytes forward. If we pass the end of the buffer, throw an error. -- if (!ctx->seek(ctx, offset)) -+ if (!ctx->seek(ctx, (int) offset)) - return AVIF_RESULT_IO_ERROR; - - dataBuf = gdMalloc(size); -@@ -194,7 +199,7 @@ static avifResult readFromCtx(avifIO *io, uint32_t readFlags, uint64_t offset, s - - // Read the number of bytes requested. - // If getBuf() returns a negative value, that means there was an error. -- int charsRead = ctx->getBuf(ctx, dataBuf, size); -+ int charsRead = ctx->getBuf(ctx, dataBuf, (int) size); - if (charsRead < 0) { - gdFree(dataBuf); - return AVIF_RESULT_IO_ERROR; -@@ -202,7 +207,7 @@ static avifResult readFromCtx(avifIO *io, uint32_t readFlags, uint64_t offset, s - - out->data = dataBuf; - out->size = charsRead; -- return charsRead == size ? AVIF_RESULT_OK : AVIF_RESULT_TRUNCATED_DATA; -+ return AVIF_RESULT_OK; - } - - // avif.h says this is optional, but it seemed easy to implement. -@@ -339,7 +344,7 @@ BGD_DECLARE(gdImagePtr) gdImageCreateFromAvifPtr(int size, void *data) - */ - BGD_DECLARE(gdImagePtr) gdImageCreateFromAvifCtx (gdIOCtx *ctx) - { -- int x, y; -+ uint32_t x, y; - gdImage *im = NULL; - avifResult result; - avifIO *io; -@@ -482,7 +487,7 @@ static avifBool _gdImageAvifCtx(gdImagePtr im, gdIOCtx *outfile, int quality, in - - uint32_t val; - uint8_t *p; -- int x, y; -+ uint32_t x, y; - - if (im == NULL) - return 1; -From d967ef78ffbb9f21090dcf058617b2b0677d9830 Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Wed, 17 Mar 2021 14:42:22 +0100 -Subject: [PATCH] fix test when libraqm is used - ---- - tests/gdimagestringft/gdimagestringft_bbox.c | 17 +++++++++++++++++ - 1 file changed, 17 insertions(+) - -diff --git a/tests/gdimagestringft/gdimagestringft_bbox.c b/tests/gdimagestringft/gdimagestringft_bbox.c -index 5d57bc7b..a4b83eb8 100644 ---- a/tests/gdimagestringft/gdimagestringft_bbox.c -+++ b/tests/gdimagestringft/gdimagestringft_bbox.c -@@ -1,4 +1,5 @@ - #include "gd.h" -+#include "config.h" - #include - #include - #include -@@ -11,19 +12,35 @@ static int EXPECT[16][8] = { - {500, 400, 628, 400, 628, 376, 500, 376}, - {492, 362, 611, 312, 601, 290, 483, 339}, - {470, 330, 561, 239, 544, 221, 453, 312}, -+#ifdef HAVE_LIBRAQM -+ {437, 308, 486, 190, 464, 180, 414, 299}, -+#else - {437, 308, 486, 189, 464, 180, 414, 299}, -+#endif - {400, 301, 400, 173, 376, 173, 376, 301}, - {363, 309, 313, 190, 291, 200, 340, 318}, - {332, 331, 241, 240, 223, 257, 314, 348}, -+#ifdef HAVE_LIBRAQM -+ {311, 363, 193, 314, 183, 336, 302, 386}, -+#else - {311, 363, 192, 314, 183, 336, 302, 386}, -+#endif - {304, 399, 176, 399, 176, 423, 304, 423}, - {312, 435, 193, 485, 203, 507, 321, 458}, - {333, 465, 242, 556, 259, 574, 350, 483}, -+#ifdef HAVE_LIBRAQM -+ {364, 486, 315, 604, 337, 614, 387, 495}, -+#else - {364, 486, 315, 605, 337, 614, 387, 495}, -+#endif - {399, 492, 399, 620, 423, 620, 423, 492}, - {434, 484, 484, 603, 506, 593, 457, 475}, - {463, 464, 554, 555, 572, 538, 481, 447}, -+#ifdef HAVE_LIBRAQM -+ {483, 434, 601, 483, 611, 461, 492, 411}, -+#else - {483, 434, 602, 483, 611, 461, 492, 411}, -+#endif - }; - - int main() -- cgit