From 2fc17d83cb8e1adb95542c6c18a698082a7f687c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Fri, 3 May 2013 12:40:45 +0200 Subject: [PATCH] * Remove overflow2, getmbi and skipheaders from gd_compat.h * Add missing return in _php_ctx_getmbi * Reintroduce imagecreatefromxbm by checking for gdCreateImageFromXbm --- ext/gd/config.m4 | 1 + ext/gd/gd.c | 13 ++++--------- ext/gd/libgd/gd_compat.h | 4 ---- 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/ext/gd/config.m4 b/ext/gd/config.m4 index 255035a924..dc38562935 100644 --- a/ext/gd/config.m4 +++ b/ext/gd/config.m4 @@ -288,6 +288,7 @@ AC_DEFUN([PHP_GD_CHECK_VERSION],[ PHP_CHECK_LIBRARY(gd, gdImagePixelate, [AC_DEFINE(HAVE_GD_IMAGE_PIXELATE, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ]) PHP_CHECK_LIBRARY(gd, gdImageFlipBoth, [AC_DEFINE(HAVE_GD_IMAGE_FLIP, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ]) PHP_CHECK_LIBRARY(gd, gdImageCreateFromJpegEx,[AC_DEFINE(HAVE_GD_JPGEX, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ]) + PHP_CHECK_LIBRARY(gd, gdImageCreateFromXbm, [AC_DEFINE(HAVE_GD_XBM, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ]) PHP_CHECK_LIBRARY(gd, gdSetErrorMethod, [AC_DEFINE(HAVE_LIBGD21, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ]) ]) diff --git a/ext/gd/gd.c b/ext/gd/gd.c index 5d8ae4e6c6..94b057fb16 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -53,13 +53,6 @@ # include #endif -#if HAVE_LIBGD -#if !HAVE_GD_BUNDLED -# include "libgd/gd_compat.h" -#else -extern int overflow2(int a, int b); -#endif - static int le_gd, le_gd_font; #if HAVE_LIBT1 #include @@ -2396,17 +2389,19 @@ PHP_FUNCTION(imagetypes) /* {{{ _php_ctx_getmbi */ -static _php_ctx_getmbi(gdIOCtx *ctx) +static int _php_ctx_getmbi(gdIOCtx *ctx) { int i, mbi = 0; do { i = (ctx->getC)(ctx); if (i < 0) { - break; + return -1; } mbi = (mbi << 7) | (i & 0x7f); } while (i & 0x80); + + return mbi; } /* }}} */ diff --git a/ext/gd/libgd/gd_compat.h b/ext/gd/libgd/gd_compat.h index 745fe80f70..f6e00d7fa0 100644 --- a/ext/gd/libgd/gd_compat.h +++ b/ext/gd/libgd/gd_compat.h @@ -12,10 +12,6 @@ const char * gdJpegGetVersionString(); int gdJpegGetVersionInt(); #if !defined(HAVE_LIBGD21) -int overflow2(int a, int b); -int getmbi (int (*getin) (void *in), void *in); -int skipheader (int (*getin) (void *in), void *in); - /* filters section * -- 2.40.0