]> granicus.if.org Git - php/commitdiff
Fix [-Wundef] warning in GD extension
authorGeorge Peter Banyard <girgias@php.net>
Wed, 20 May 2020 15:35:42 +0000 (17:35 +0200)
committerGeorge Peter Banyard <girgias@php.net>
Wed, 20 May 2020 16:22:09 +0000 (18:22 +0200)
ext/gd/gd.c
ext/gd/libgd/gd_tga.c
ext/gd/libgd/gdcache.h
ext/gd/libgd/gdft.c

index 7f9d057106dd3a144b3c5020f3881a928a1d0a14..4089e40691db15fcb85796f712443f257aa13f69 100644 (file)
@@ -390,7 +390,7 @@ PHP_MINIT_FUNCTION(gd)
        REGISTER_LONG_CONSTANT("IMG_AFFINE_SHEAR_HORIZONTAL", GD_AFFINE_SHEAR_HORIZONTAL, CONST_CS | CONST_PERSISTENT);
        REGISTER_LONG_CONSTANT("IMG_AFFINE_SHEAR_VERTICAL", GD_AFFINE_SHEAR_VERTICAL, CONST_CS | CONST_PERSISTENT);
 
-#if defined(HAVE_GD_BUNDLED)
+#ifdef HAVE_GD_BUNDLED
        REGISTER_LONG_CONSTANT("GD_BUNDLED", 1, CONST_CS | CONST_PERSISTENT);
 #else
        REGISTER_LONG_CONSTANT("GD_BUNDLED", 0, CONST_CS | CONST_PERSISTENT);
@@ -467,7 +467,7 @@ PHP_RSHUTDOWN_FUNCTION(gd)
 }
 /* }}} */
 
-#if defined(HAVE_GD_BUNDLED)
+#ifdef HAVE_GD_BUNDLED
 #define PHP_GD_VERSION_STRING "bundled (2.1.0 compatible)"
 #else
 # define PHP_GD_VERSION_STRING GD_VERSION_STRING
@@ -482,11 +482,11 @@ PHP_MINFO_FUNCTION(gd)
 
        /* need to use a PHPAPI function here because it is external module in windows */
 
-#if defined(HAVE_GD_BUNDLED)
+#ifdef HAVE_GD_BUNDLED
        php_info_print_table_row(2, "GD Version", PHP_GD_VERSION_STRING);
 #else
        php_info_print_table_row(2, "GD headers Version", PHP_GD_VERSION_STRING);
-#if defined(HAVE_GD_LIBVERSION)
+#ifdef HAVE_GD_LIBVERSION
        php_info_print_table_row(2, "GD library Version", gdVersionString());
 #endif
 #endif
@@ -516,7 +516,7 @@ PHP_MINFO_FUNCTION(gd)
 #ifdef HAVE_GD_JPG
        {
                php_info_print_table_row(2, "JPEG Support", "enabled");
-#if defined(HAVE_GD_BUNDLED)
+#ifdef HAVE_GD_BUNDLED
                php_info_print_table_row(2, "libJPEG Version", gdJpegGetVersionString());
 #endif
        }
@@ -524,14 +524,14 @@ PHP_MINFO_FUNCTION(gd)
 
 #ifdef HAVE_GD_PNG
        php_info_print_table_row(2, "PNG Support", "enabled");
-#if defined(HAVE_GD_BUNDLED)
+#ifdef 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)
+#ifdef HAVE_GD_XPM
        php_info_print_table_row(2, "XPM Support", "enabled");
-#if defined(HAVE_GD_BUNDLED)
+#ifdef HAVE_GD_BUNDLED
        {
                char tmp[12];
                snprintf(tmp, sizeof(tmp), "%d", XpmLibraryVersion());
@@ -540,7 +540,7 @@ PHP_MINFO_FUNCTION(gd)
 #endif
 #endif
        php_info_print_table_row(2, "XBM Support", "enabled");
-#if defined(USE_GD_JISX0208)
+#ifdef USE_GD_JISX0208
        php_info_print_table_row(2, "JIS-mapped Japanese Font Support", "enabled");
 #endif
 #ifdef HAVE_GD_WEBP
@@ -588,7 +588,7 @@ PHP_FUNCTION(gd_info)
        add_assoc_bool(return_value, "PNG Support", 0);
 #endif
        add_assoc_bool(return_value, "WBMP Support", 1);
-#if defined(HAVE_GD_XPM)
+#ifdef HAVE_GD_XPM
        add_assoc_bool(return_value, "XPM Support", 1);
 #else
        add_assoc_bool(return_value, "XPM Support", 0);
@@ -609,7 +609,7 @@ PHP_FUNCTION(gd_info)
 #else
        add_assoc_bool(return_value, "TGA Read Support", 0);
 #endif
-#if defined(USE_GD_JISX0208)
+#ifdef USE_GD_JISX0208
        add_assoc_bool(return_value, "JIS-mapped Japanese Font Support", 1);
 #else
        add_assoc_bool(return_value, "JIS-mapped Japanese Font Support", 0);
@@ -1399,7 +1399,7 @@ PHP_FUNCTION(imagetypes)
        ret |= PHP_IMG_PNG;
 #endif
        ret |= PHP_IMG_WBMP;
-#if defined(HAVE_GD_XPM)
+#ifdef HAVE_GD_XPM
        ret |= PHP_IMG_XPM;
 #endif
 #ifdef HAVE_GD_WEBP
@@ -1676,7 +1676,7 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type,
                        case PHP_GDIMG_TYPE_GD2PART:
                                im = (*func_p)(fp, srcx, srcy, width, height);
                                break;
-#if defined(HAVE_GD_XPM)
+#ifdef HAVE_GD_XPM
                        case PHP_GDIMG_TYPE_XPM:
                                im = gdImageCreateFromXpm(file);
                                break;
@@ -1758,7 +1758,7 @@ PHP_FUNCTION(imagecreatefromxbm)
 }
 /* }}} */
 
-#if defined(HAVE_GD_XPM)
+#ifdef HAVE_GD_XPM
 /* {{{ proto resource imagecreatefromxpm(string filename)
    Create a new image from XPM file or URL */
 PHP_FUNCTION(imagecreatefromxpm)
@@ -1800,7 +1800,7 @@ PHP_FUNCTION(imagecreatefromgd2part)
 }
 /* }}} */
 
-#if defined(HAVE_GD_BMP)
+#ifdef HAVE_GD_BMP
 /* {{{ proto resource imagecreatefrombmp(string filename)
    Create a new image from BMP file or URL */
 PHP_FUNCTION(imagecreatefrombmp)
@@ -1810,7 +1810,7 @@ PHP_FUNCTION(imagecreatefrombmp)
 /* }}} */
 #endif
 
-#if defined(HAVE_GD_TGA)
+#ifdef HAVE_GD_TGA
 /* {{{ proto resource imagecreatefromtga(string filename)
    Create a new image from TGA file or URL */
 PHP_FUNCTION(imagecreatefromtga)
index 125a698f247775c10fff7956ccc6fee8fa856954..3f9922189aada58af902a14011788e39f3d45cc9 100644 (file)
@@ -168,7 +168,7 @@ int read_header_tga(gdIOCtx *ctx, oTga *tga)
        tga->fliph = (header[17] & 0x10) ? 1 : 0;
        tga->flipv = (header[17] & 0x20) ? 0 : 1;
 
-#if DEBUG
+#ifdef DEBUG
        printf("format bps: %i\n", tga->bits);
        printf("flip h/v: %i / %i\n", tga->fliph, tga->flipv);
        printf("alpha: %i\n", tga->alphabits);
index 0c5f83d92a6acbd817b9b3c7bd0decccfa4add2b..07b11bd7e2224925d18c6c3dd97d7a5967a8bc34 100644 (file)
@@ -41,7 +41,7 @@
 /*********************************************************/
 
 #include <stdlib.h>
-#if (!defined(__OpenBSD__)) && HAVE_MALLOC_H
+#if (!defined(__OpenBSD__)) && defined(HAVE_MALLOC_H)
  #include <malloc.h>
 #endif
 #ifndef NULL
index d68703aa3244fa5ff8f395fc4d91ae76500f1f31..71d32375b1adbebd65f5ffb404b24c322fbecca4 100644 (file)
@@ -412,9 +412,9 @@ static void *fontFetch (char **error, void *key)
                for (dir = gd_strtok_r (path, PATHSEPARATOR, &strtok_ptr_path); dir;
                     dir = gd_strtok_r (0, PATHSEPARATOR, &strtok_ptr_path)) {
                        if (!strcmp(dir, ".")) {
-                       #if HAVE_GETCWD
+                       #ifdef HAVE_GETCWD
                                dir = VCWD_GETCWD(cur_dir, MAXPATHLEN);
-#elif HAVE_GETWD
+#elif defined(HAVE_GETWD)
                                dir = VCWD_GETWD(cur_dir);
 #endif
                                if (!dir) {