]> granicus.if.org Git - php/commitdiff
Export php_gd_libgdimageptr_from_zval_p()
authorChristoph M. Becker <cmbecker69@gmx.de>
Sat, 11 Jul 2020 13:41:15 +0000 (15:41 +0200)
committerChristoph M. Becker <cmbecker69@gmx.de>
Sat, 11 Jul 2020 17:33:20 +0000 (19:33 +0200)
Some extension may need to retrieve the `gdImagePtr` from an `GdImage`
object; thus, we export the respective function.  To not being forced
to include gd.h in php_gd.h, we use the opaque `struct gdImageStruct *`
as return type.

We also rename php_gd2.dll to php_gd.dll, since there's not really much
point in giving the DLL a version number, since there is no php_gd.dll
for years (if there ever has been).  Renaming, on the other hand,
matches the name on other systems (gd.so), and allows to actually use
`ADD_EXTENSION_DEP()`.

UPGRADING
ext/gd/config.w32
ext/gd/gd.c
ext/gd/php_gd.h
php.ini-development
php.ini-production
win32/build/confutils.js

index 63a30d4ab4d8f4cb3dcc35b7c409b729db2bfd5c..e45cb23fbf358a850b423c0b3b95d7b90c9cf5d5 100644 (file)
--- a/UPGRADING
+++ b/UPGRADING
@@ -888,6 +888,9 @@ PHP 8.0 UPGRADE NOTES
     shell now consistently execute `%comspec% /s /c "$commandline"`, which has
     the same effect as executing `$commandline` (without additional quotes).
 
+- GD:
+  . php_gd2.dll has been renamed to php_gd.dll.
+
 - php-test-pack:
   . The test runner has been renamed from run-test.php to run-tests.php, to
     match its name in php-src.
index 8fe44def2b4fc03d8088f3912fd6913b4b801370..541d5f51e0e2b931dc5922f119830bc7f26ba208 100644 (file)
@@ -33,7 +33,7 @@ if (PHP_GD != "no") {
                CHECK_LIB("User32.lib", "gd", PHP_GD);
                CHECK_LIB("Gdi32.lib", "gd", PHP_GD);
 
-               EXTENSION("gd", "gd.c", null, "-Iext/gd/libgd", "php_gd2.dll");
+               EXTENSION("gd", "gd.c", null, "-Iext/gd/libgd");
                ADD_SOURCES("ext/gd/libgd", "gd2copypal.c gd.c \
                        gdcache.c gdfontg.c gdfontl.c gdfontmb.c gdfonts.c gdfontt.c \
                        gdft.c gd_gd2.c gd_gd.c gd_gif_in.c gd_gif_out.c gdhelpers.c gd_io.c gd_io_dp.c \
@@ -43,6 +43,7 @@ if (PHP_GD != "no") {
                        gd_crop.c gd_interpolation.c gd_matrix.c gd_bmp.c gd_tga.c", "gd");
                AC_DEFINE('HAVE_LIBGD', 1, 'GD support');
                ADD_FLAG("CFLAGS_GD", " \
+/D PHP_GD_EXPORTS=1 \
 /D HAVE_GD_DYNAMIC_CTX_EX=1 \
 /D HAVE_GD_BUNDLED=1  \
 /D HAVE_GD_GD2  \
index 5996579e3fdf80ad8d6f8395fb673be4dbca258f..eb35655f33a2202f78ae454a38480db8f97a06a8 100644 (file)
@@ -178,7 +178,7 @@ static zend_always_inline php_gd_image_object* php_gd_exgdimage_from_zobj_p(zend
  * Converts an extension GdImage instance contained within a zval into the gdImagePtr
  * for use with library APIs
  */
-static zend_always_inline gdImagePtr php_gd_libgdimageptr_from_zval_p(zval* zp)
+PHP_GD_API gdImagePtr php_gd_libgdimageptr_from_zval_p(zval* zp)
 {
        return php_gd_exgdimage_from_zobj_p(Z_OBJ_P(zp))->image;
 }
index ffb6f60b755d5b9913fb2924c3579f01185cd171..387346727621ec998d24212d68c947e3e763624d 100644 (file)
 #define PHP_IMG_TGA  128
 
 #ifdef PHP_WIN32
-#      define PHP_GD_API __declspec(dllexport)
+#      ifdef PHP_GD_EXPORTS
+#              define PHP_GD_API __declspec(dllexport)
+#      else
+#              define PHP_GD_API __declspec(dllimport)
+#      endif
 #elif defined(__GNUC__) && __GNUC__ >= 4
 #      define PHP_GD_API __attribute__ ((visibility("default")))
 #else
@@ -77,6 +81,8 @@ PHP_MINIT_FUNCTION(gd);
 PHP_MSHUTDOWN_FUNCTION(gd);
 PHP_RSHUTDOWN_FUNCTION(gd);
 
+PHP_GD_API struct gdImageStruct *php_gd_libgdimageptr_from_zval_p(zval* zp);
+
 #else
 
 #define phpext_gd_ptr NULL
index 4acfa89a197c6da3b0ff5a5e72e7510690f9b492..5471728ce0bf4c5a21ed35fc9e8cf244fccb650b 100644 (file)
@@ -901,7 +901,7 @@ default_socket_timeout = 60
 ;extension=ffi
 ;extension=ftp
 ;extension=fileinfo
-;extension=gd2
+;extension=gd
 ;extension=gettext
 ;extension=gmp
 ;extension=intl
index 2fdcdc0e5d3d2efe6545893dbe5e4b42aa8f6aed..08fc7557384bbdc7f3d2dc0d291b68af621a00a9 100644 (file)
@@ -903,7 +903,7 @@ default_socket_timeout = 60
 ;extension=ffi
 ;extension=ftp
 ;extension=fileinfo
-;extension=gd2
+;extension=gd
 ;extension=gettext
 ;extension=gmp
 ;extension=intl
index 2f2c01e47dc466239869863685339da7bf008e54..e71757748fdaaade75bd3867db4b8aee115b3c04 100644 (file)
@@ -2026,9 +2026,6 @@ function generate_tmp_php_ini()
                var directive = (extensions_enabled[i][2] ? 'zend_extension' : 'extension');
 
                var ext_name = extensions_enabled[i][0];
-               if ("gd" == ext_name) {
-                       ext_name = "gd2";
-               }
 
                if (!is_on_exclude_list_for_test_ini(ext_list, ext_name)) {
                        INI.WriteLine(directive + "=php_" + ext_name + ".dll");