com php-src: Move (back) missing functions in system libgd to gd_compat - display libPng version in all cases - gd_compat.c in ext/gd (nothing in
ext/gd /libgd): ext/gd/config.m4 ext/gd/gd.c ext/gd/gd _compat.c ext/gd/gd_compat.h
| From: | Remi Collet | Date: | Sun, 05 May 2013 07:54:27 +0000 |
| Subject: | com php-src: Move (back) missing functions in system libgd to gd_compat - display libPng version in all cases - gd_compat.c in ext/gd (nothing in ext/gd /libgd): ext/gd/config.m4 ext/gd/gd.c ext/gd/gd _compat.c ext/gd/gd_compat.h |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-72129@lists.php.net to get a copy of this message | ||
Commit: 0cae9a15d73a8b3d4a8dad92b295985df0dff98a
Author: Remi Collet <remi@php.net> Sun, 5 May 2013 09:54:27 +0200
Parents: 9a48b6506cf1b4d98fa7d4e15f851430b6c07ada
Branches: PHP-5.5 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=0cae9a15d73a8b3d4a8dad92b295985df0dff98a
Log:
Move (back) missing functions in system libgd to gd_compat
- display libPng version in all cases
- gd_compat..c in ext/gd (nothing in ext/gd/libgd)
Changed paths:
M ext/gd/config.m4
M ext/gd/gd.c
A ext/gd/gd_compat.c
A ext/gd/gd_compat.h
Diff:
diff --git a/ext/gd/config.m4 b/ext/gd/config.m4
index 748a352..957284e 100644
--- a/ext/gd/config.m4
+++ b/ext/gd/config.m4
@@ -336,6 +336,7 @@ else
if test "$PHP_GD" != "no"; then
GD_MODULE_TYPE=external
+ extra_sources="gd_compat.c"
dnl Various checks for GD features
PHP_GD_ZLIB
diff --git a/ext/gd/gd.c b/ext/gd/gd.c
index 6147353..d463444 100644
--- a/ext/gd/gd.c
+++ b/ext/gd/gd.c
@@ -53,41 +53,12 @@
# include <Wingdi.h>
#endif
-#ifdef HAVE_GD_JPG
-# include <jpeglib.h>
-#endif
-
#ifdef HAVE_GD_XPM
# include <X11/xpm.h>
#endif
#ifndef HAVE_GD_BUNDLED
-#ifdef HAVE_GD_JPG
-int gdJpegGetVersionInt()
-{
- return JPEG_LIB_VERSION;
-}
-
-const char * gdJpegGetVersionString()
-{
- switch(JPEG_LIB_VERSION) {
- case 62:
- return "6b";
- break;
-
- case 70:
- return "7";
- break;
-
- case 80:
- return "8";
- break;
-
- default:
- return "unknown";
- }
-}
-#endif /* HAVE_GD_JPG */
+# include "gd_compat.h"
#endif /* HAVE_GD_BUNDLED */
static int le_gd, le_gd_font;
@@ -1350,10 +1321,8 @@ PHP_MINFO_FUNCTION(gd)
#ifdef HAVE_GD_PNG
php_info_print_table_row(2, "PNG Support", "enabled");
-#ifndef HAVE_GD_BUNDLED
php_info_print_table_row(2, "libPNG Version", gdPngGetVersionString());
#endif
-#endif
php_info_print_table_row(2, "WBMP Support", "enabled");
#if defined(HAVE_GD_XPM)
php_info_print_table_row(2, "XPM Support", "enabled");
diff --git a/ext/gd/gd_compat.c b/ext/gd/gd_compat.c
new file mode 100644
index 0000000..dbb16a5
--- /dev/null
+++ b/ext/gd/gd_compat.c
@@ -0,0 +1,47 @@
+#include "php_config.h"
+
+#ifdef HAVE_GD_PNG
+/* needs to be first */
+# include <png.h>
+#endif
+
+#ifdef HAVE_GD_JPG
+# include <jpeglib.h>
+#endif
+
+#include "gd_compat.c"
+
+#ifdef HAVE_GD_JPG
+int gdJpegGetVersionInt()
+{
+ return JPEG_LIB_VERSION;
+}
+
+const char * gdJpegGetVersionString()
+{
+ switch(JPEG_LIB_VERSION) {
+ case 62:
+ return "6b";
+ break;
+
+ case 70:
+ return "7";
+ break;
+
+ case 80:
+ return "8";
+ break;
+
+ default:
+ return "unknown";
+ }
+}
+#endif
+
+#ifdef HAVE_GD_PNG
+const char * gdPngGetVersionString()
+{
+ return PNG_LIBPNG_VER_STRING;
+}
+#endif
+
diff --git a/ext/gd/gd_compat.h b/ext/gd/gd_compat.h
new file mode 100644
index 0000000..ea812ea
--- /dev/null
+++ b/ext/gd/gd_compat.h
@@ -0,0 +1,8 @@
+#ifndef GD_COMPAT_H
+#define GD_COMPAT_H 1
+
+const char * gdPngGetVersionString();
+const char * gdJpegGetVersionString();
+int gdJpegGetVersionInt();
+
+#endif /* GD_COMPAT_H */