Skip to content

Commit 2f0dcf2

Browse files
committed
Fix [-Wundef] warning in GD extension
1 parent e852944 commit 2f0dcf2

File tree

4 files changed

+20
-20
lines changed

4 files changed

+20
-20
lines changed

ext/gd/gd.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ PHP_MINIT_FUNCTION(gd)
390390
REGISTER_LONG_CONSTANT("IMG_AFFINE_SHEAR_HORIZONTAL", GD_AFFINE_SHEAR_HORIZONTAL, CONST_CS | CONST_PERSISTENT);
391391
REGISTER_LONG_CONSTANT("IMG_AFFINE_SHEAR_VERTICAL", GD_AFFINE_SHEAR_VERTICAL, CONST_CS | CONST_PERSISTENT);
392392

393-
#if defined(HAVE_GD_BUNDLED)
393+
#ifdef HAVE_GD_BUNDLED
394394
REGISTER_LONG_CONSTANT("GD_BUNDLED", 1, CONST_CS | CONST_PERSISTENT);
395395
#else
396396
REGISTER_LONG_CONSTANT("GD_BUNDLED", 0, CONST_CS | CONST_PERSISTENT);
@@ -467,7 +467,7 @@ PHP_RSHUTDOWN_FUNCTION(gd)
467467
}
468468
/* }}} */
469469

470-
#if defined(HAVE_GD_BUNDLED)
470+
#ifdef HAVE_GD_BUNDLED
471471
#define PHP_GD_VERSION_STRING "bundled (2.1.0 compatible)"
472472
#else
473473
# define PHP_GD_VERSION_STRING GD_VERSION_STRING
@@ -482,11 +482,11 @@ PHP_MINFO_FUNCTION(gd)
482482

483483
/* need to use a PHPAPI function here because it is external module in windows */
484484

485-
#if defined(HAVE_GD_BUNDLED)
485+
#ifdef HAVE_GD_BUNDLED
486486
php_info_print_table_row(2, "GD Version", PHP_GD_VERSION_STRING);
487487
#else
488488
php_info_print_table_row(2, "GD headers Version", PHP_GD_VERSION_STRING);
489-
#if defined(HAVE_GD_LIBVERSION)
489+
#ifdef HAVE_GD_LIBVERSION
490490
php_info_print_table_row(2, "GD library Version", gdVersionString());
491491
#endif
492492
#endif
@@ -516,22 +516,22 @@ PHP_MINFO_FUNCTION(gd)
516516
#ifdef HAVE_GD_JPG
517517
{
518518
php_info_print_table_row(2, "JPEG Support", "enabled");
519-
#if defined(HAVE_GD_BUNDLED)
519+
#ifdef HAVE_GD_BUNDLED
520520
php_info_print_table_row(2, "libJPEG Version", gdJpegGetVersionString());
521521
#endif
522522
}
523523
#endif
524524

525525
#ifdef HAVE_GD_PNG
526526
php_info_print_table_row(2, "PNG Support", "enabled");
527-
#if defined(HAVE_GD_BUNDLED)
527+
#ifdef HAVE_GD_BUNDLED
528528
php_info_print_table_row(2, "libPNG Version", gdPngGetVersionString());
529529
#endif
530530
#endif
531531
php_info_print_table_row(2, "WBMP Support", "enabled");
532-
#if defined(HAVE_GD_XPM)
532+
#ifdef HAVE_GD_XPM
533533
php_info_print_table_row(2, "XPM Support", "enabled");
534-
#if defined(HAVE_GD_BUNDLED)
534+
#ifdef HAVE_GD_BUNDLED
535535
{
536536
char tmp[12];
537537
snprintf(tmp, sizeof(tmp), "%d", XpmLibraryVersion());
@@ -540,7 +540,7 @@ PHP_MINFO_FUNCTION(gd)
540540
#endif
541541
#endif
542542
php_info_print_table_row(2, "XBM Support", "enabled");
543-
#if defined(USE_GD_JISX0208)
543+
#ifdef USE_GD_JISX0208
544544
php_info_print_table_row(2, "JIS-mapped Japanese Font Support", "enabled");
545545
#endif
546546
#ifdef HAVE_GD_WEBP
@@ -588,7 +588,7 @@ PHP_FUNCTION(gd_info)
588588
add_assoc_bool(return_value, "PNG Support", 0);
589589
#endif
590590
add_assoc_bool(return_value, "WBMP Support", 1);
591-
#if defined(HAVE_GD_XPM)
591+
#ifdef HAVE_GD_XPM
592592
add_assoc_bool(return_value, "XPM Support", 1);
593593
#else
594594
add_assoc_bool(return_value, "XPM Support", 0);
@@ -609,7 +609,7 @@ PHP_FUNCTION(gd_info)
609609
#else
610610
add_assoc_bool(return_value, "TGA Read Support", 0);
611611
#endif
612-
#if defined(USE_GD_JISX0208)
612+
#ifdef USE_GD_JISX0208
613613
add_assoc_bool(return_value, "JIS-mapped Japanese Font Support", 1);
614614
#else
615615
add_assoc_bool(return_value, "JIS-mapped Japanese Font Support", 0);
@@ -1399,7 +1399,7 @@ PHP_FUNCTION(imagetypes)
13991399
ret |= PHP_IMG_PNG;
14001400
#endif
14011401
ret |= PHP_IMG_WBMP;
1402-
#if defined(HAVE_GD_XPM)
1402+
#ifdef HAVE_GD_XPM
14031403
ret |= PHP_IMG_XPM;
14041404
#endif
14051405
#ifdef HAVE_GD_WEBP
@@ -1676,7 +1676,7 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type,
16761676
case PHP_GDIMG_TYPE_GD2PART:
16771677
im = (*func_p)(fp, srcx, srcy, width, height);
16781678
break;
1679-
#if defined(HAVE_GD_XPM)
1679+
#ifdef HAVE_GD_XPM
16801680
case PHP_GDIMG_TYPE_XPM:
16811681
im = gdImageCreateFromXpm(file);
16821682
break;
@@ -1758,7 +1758,7 @@ PHP_FUNCTION(imagecreatefromxbm)
17581758
}
17591759
/* }}} */
17601760

1761-
#if defined(HAVE_GD_XPM)
1761+
#ifdef HAVE_GD_XPM
17621762
/* {{{ proto resource imagecreatefromxpm(string filename)
17631763
Create a new image from XPM file or URL */
17641764
PHP_FUNCTION(imagecreatefromxpm)
@@ -1800,7 +1800,7 @@ PHP_FUNCTION(imagecreatefromgd2part)
18001800
}
18011801
/* }}} */
18021802

1803-
#if defined(HAVE_GD_BMP)
1803+
#ifdef HAVE_GD_BMP
18041804
/* {{{ proto resource imagecreatefrombmp(string filename)
18051805
Create a new image from BMP file or URL */
18061806
PHP_FUNCTION(imagecreatefrombmp)
@@ -1810,7 +1810,7 @@ PHP_FUNCTION(imagecreatefrombmp)
18101810
/* }}} */
18111811
#endif
18121812

1813-
#if defined(HAVE_GD_TGA)
1813+
#ifdef HAVE_GD_TGA
18141814
/* {{{ proto resource imagecreatefromtga(string filename)
18151815
Create a new image from TGA file or URL */
18161816
PHP_FUNCTION(imagecreatefromtga)

ext/gd/libgd/gd_tga.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ int read_header_tga(gdIOCtx *ctx, oTga *tga)
168168
tga->fliph = (header[17] & 0x10) ? 1 : 0;
169169
tga->flipv = (header[17] & 0x20) ? 0 : 1;
170170

171-
#if DEBUG
171+
#ifdef DEBUG
172172
printf("format bps: %i\n", tga->bits);
173173
printf("flip h/v: %i / %i\n", tga->fliph, tga->flipv);
174174
printf("alpha: %i\n", tga->alphabits);

ext/gd/libgd/gdcache.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
/*********************************************************/
4242

4343
#include <stdlib.h>
44-
#if (!defined(__OpenBSD__)) && HAVE_MALLOC_H
44+
#if (!defined(__OpenBSD__)) && defined(HAVE_MALLOC_H)
4545
#include <malloc.h>
4646
#endif
4747
#ifndef NULL

ext/gd/libgd/gdft.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,9 +412,9 @@ static void *fontFetch (char **error, void *key)
412412
for (dir = gd_strtok_r (path, PATHSEPARATOR, &strtok_ptr_path); dir;
413413
dir = gd_strtok_r (0, PATHSEPARATOR, &strtok_ptr_path)) {
414414
if (!strcmp(dir, ".")) {
415-
#if HAVE_GETCWD
415+
#ifdef HAVE_GETCWD
416416
dir = VCWD_GETCWD(cur_dir, MAXPATHLEN);
417-
#elif HAVE_GETWD
417+
#elif defined(HAVE_GETWD)
418418
dir = VCWD_GETWD(cur_dir);
419419
#endif
420420
if (!dir) {

0 commit comments

Comments
 (0)