From 2467dd6d05d97805cfbe027f9be4b4cfac8d9a25 Mon Sep 17 00:00:00 2001 From: Stig Bakken Date: Wed, 1 Dec 1999 22:59:45 +0000 Subject: [PATCH] @Fix some warnings when compiling in maintainer-mode (Stig) @Made mysql and gd work as shared extensions again (Stig) - Fixed some warnings in maintainer-mode. - Made mysql and gd work as shared extensions again by defining COMPILE_DL if PIC is defined. # We need a better solution for building .so extensions than this # PIC/COMPILE_DL hack! --- configure.in | 4 +-- ext/gd/gd.c | 10 +++---- ext/gd/gdttf.c | 59 +++------------------------------------ ext/gd/php3_gd.h | 3 ++ ext/mysql/php_mysql.c | 8 ++++-- ext/mysql/php_mysql.h | 6 ++-- ext/standard/php_output.h | 4 +-- main/SAPI.h | 4 +-- main/php_ini.h | 8 +++--- main/php_output.h | 4 +-- pear/README | 3 +- 11 files changed, 34 insertions(+), 79 deletions(-) diff --git a/configure.in b/configure.in index d628218aa2..0157c1d7cb 100644 --- a/configure.in +++ b/configure.in @@ -662,10 +662,8 @@ PHP_REGEX dnl If we are using gcc and the user has not specified CFLAGS, add -O2. test -n "$auto_cflags" && test -n "$GCC" && CFLAGS="$CFLAGS -O2" - - - CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS" + export CPPFLAGS if test "$PHP_THREAD_SAFETY" = "yes" || test "$PHP_EXPERIMENTAL_ZTS" = "yes"; then diff --git a/ext/gd/gd.c b/ext/gd/gd.c index 632489f3ca..3e2f2636ed 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -25,6 +25,10 @@ /* Note that there is no code from the gd package in this file */ +#ifdef PIC +# define COMPILE_DL 1 +#endif + #include "php.h" #include "ext/standard/head.h" #include @@ -136,11 +140,7 @@ php3_module_entry gd_module_entry = { }; #if COMPILE_DL -# if PHP_31 -# include "../phpdl.h" -# else -# include "dl/phpdl.h" -# endif +# include "dl/phpdl.h" DLEXPORT php3_module_entry *get_module(void) { return &gd_module_entry; } #endif diff --git a/ext/gd/gdttf.c b/ext/gd/gdttf.c index df1e549734..733800ab0d 100644 --- a/ext/gd/gdttf.c +++ b/ext/gd/gdttf.c @@ -23,6 +23,10 @@ #include #endif +#ifndef HAVE_GDIMAGECOLORRESOLVE +extern int gdImageColorResolve(gdImagePtr, int, int, int); +#endif + /* number of fonts cached before least recently used is replaced */ #define FONTCACHESIZE 6 @@ -149,61 +153,6 @@ static void bitmapRelease( void *element ); /* local prototype */ char *gdttfchar(gdImage *im, int fg, font_t *font, int x, int y, TT_F26Dot6 x1, TT_F26Dot6 y1, TT_F26Dot6 *advance, TT_BBox **bbox, char **next); -#ifndef HAVE_GDIMAGECOLORRESOLVE - -int gdImageColorResolve(gdImagePtr im, int r, int g, int b); - -/********************************************************************/ -/* gdImageColorResolve is a replacement for the old fragment: */ -/* */ -/* if ((color=gdImageColorExact(im,R,G,B)) < 0) */ -/* if ((color=gdImageColorAllocate(im,R,G,B)) < 0) */ -/* color=gdImageColorClosest(im,R,G,B); */ -/* */ -/* in a single function */ - -static int -gdImageColorResolve(gdImagePtr im, int r, int g, int b) -{ - int c; - int ct = -1; - int op = -1; - long rd, gd, bd, dist; - long mindist = 3*255*255; /* init to max poss dist */ - - for (c = 0; c < im->colorsTotal; c++) { - if (im->open[c]) { - op = c; /* Save open slot */ - continue; /* Color not in use */ - } - rd = (long)(im->red [c] - r); - gd = (long)(im->green[c] - g); - bd = (long)(im->blue [c] - b); - dist = rd * rd + gd * gd + bd * bd; - if (dist < mindist) { - if (dist == 0) { - return c; /* Return exact match color */ - } - mindist = dist; - ct = c; - } - } - /* no exact match. We now know closest, but first try to allocate exact */ - if (op == -1) { - op = im->colorsTotal; - if (op == gdMaxColors) { /* No room for more colors */ - return ct; /* Return closest available color */ - } - im->colorsTotal++; - } - im->red [op] = r; - im->green[op] = g; - im->blue [op] = b; - im->open [op] = 0; - return op; /* Return newly allocated color */ -} -#endif - /******************************************************************** * gdTcl_UtfToUniChar is borrowed from ... */ diff --git a/ext/gd/php3_gd.h b/ext/gd/php3_gd.h index a6d349e252..2d97c53009 100644 --- a/ext/gd/php3_gd.h +++ b/ext/gd/php3_gd.h @@ -57,7 +57,9 @@ PHP_MINFO_FUNCTION(gd); extern PHP_MINIT_FUNCTION(gd); extern PHP_MSHUTDOWN_FUNCTION(gd); +#ifndef HAVE_GDIMAGECOLORRESOLVE extern int gdImageColorResolve(gdImagePtr, int, int, int); +#endif PHP_FUNCTION(imagearc); PHP_FUNCTION(imagechar); PHP_FUNCTION(imagecharup); @@ -102,6 +104,7 @@ PHP_FUNCTION(imagedashedline); PHP_FUNCTION(imagettfbbox); PHP_FUNCTION(imagettftext); #endif +PHPAPI int phpi_get_le_gd(void); #else #define phpext_gd_ptr NULL diff --git a/ext/mysql/php_mysql.c b/ext/mysql/php_mysql.c index cb198be677..aa9bb2757b 100644 --- a/ext/mysql/php_mysql.c +++ b/ext/mysql/php_mysql.c @@ -24,8 +24,12 @@ * ? Safe mode implementation */ -#if COMPILE_DL -#include "dl/phpdl.h" +#ifdef PIC +# define COMPILE_DL 1 +#endif + +#ifdef COMPILE_DL +# include "dl/phpdl.h" #endif #include "php.h" diff --git a/ext/mysql/php_mysql.h b/ext/mysql/php_mysql.h index 80bd0d6793..e998f8e56c 100644 --- a/ext/mysql/php_mysql.h +++ b/ext/mysql/php_mysql.h @@ -22,9 +22,9 @@ #ifndef _PHP_MYSQL_H #define _PHP_MYSQL_H -#if COMPILE_DL -#undef HAVE_MYSQL -#define HAVE_MYSQL 1 +#ifdef COMPILE_DL +# undef HAVE_MYSQL +# define HAVE_MYSQL 1 #endif #if WIN32||WINNT diff --git a/ext/standard/php_output.h b/ext/standard/php_output.h index 00fd789078..9eeb17c80b 100644 --- a/ext/standard/php_output.h +++ b/ext/standard/php_output.h @@ -22,10 +22,10 @@ #include "php.h" -PHPAPI void php_output_startup(); +PHPAPI void php_output_startup(void); PHPAPI int php_body_write(const char *str, uint str_length); PHPAPI int php_header_write(const char *str, uint str_length); -PHPAPI void php_start_ob_buffering(); +PHPAPI void php_start_ob_buffering(void); PHPAPI void php_end_ob_buffering(int send_buffer); extern zend_module_entry output_module_entry; diff --git a/main/SAPI.h b/main/SAPI.h index 0433cca55b..bed0661573 100644 --- a/main/SAPI.h +++ b/main/SAPI.h @@ -96,7 +96,7 @@ typedef struct { # define SLS_FETCH() sapi_globals_struct *sapi_globals = ts_resource(sapi_globals_id) SAPI_API extern int sapi_globals_id; #else -# define SLS_D +# define SLS_D void # define SLS_DC # define SLS_C # define SLS_CC @@ -117,7 +117,7 @@ SAPI_API void sapi_activate(SLS_D); SAPI_API void sapi_deactivate(SLS_D); SAPI_API int sapi_add_header(char *header_line, uint header_line_len); -SAPI_API int sapi_send_headers(); +SAPI_API int sapi_send_headers(void); SAPI_API int sapi_register_post_readers(sapi_post_content_type_reader *post_content_type_readers); SAPI_API int sapi_register_post_reader(sapi_post_content_type_reader *post_content_type_reader); diff --git a/main/php_ini.h b/main/php_ini.h index 1aa64c3da5..05d7efde75 100644 --- a/main/php_ini.h +++ b/main/php_ini.h @@ -51,13 +51,13 @@ struct _php_ini_entry { }; -int php_ini_mstartup(); -int php_ini_mshutdown(); -int php_ini_rshutdown(); +int php_ini_mstartup(void); +int php_ini_mshutdown(void); +int php_ini_rshutdown(void); PHPAPI int php_register_ini_entries(php_ini_entry *ini_entry, int module_number); PHPAPI void php_unregister_ini_entries(int module_number); -PHPAPI void php_ini_refresh_caches(); +PHPAPI void php_ini_refresh_caches(void); PHPAPI int php_alter_ini_entry(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type); PHPAPI int php_restore_ini_entry(char *name, uint name_length); PHPAPI void display_ini_entries(zend_module_entry *module); diff --git a/main/php_output.h b/main/php_output.h index 00fd789078..9eeb17c80b 100644 --- a/main/php_output.h +++ b/main/php_output.h @@ -22,10 +22,10 @@ #include "php.h" -PHPAPI void php_output_startup(); +PHPAPI void php_output_startup(void); PHPAPI int php_body_write(const char *str, uint str_length); PHPAPI int php_header_write(const char *str, uint str_length); -PHPAPI void php_start_ob_buffering(); +PHPAPI void php_start_ob_buffering(void); PHPAPI void php_end_ob_buffering(int send_buffer); extern zend_module_entry output_module_entry; diff --git a/pear/README b/pear/README index 39c5a04eb6..059480a69f 100644 --- a/pear/README +++ b/pear/README @@ -1,5 +1,6 @@ PEAR - PHP Extension and Add-on Repository - ------------------------------------------ + ========================================== + Dedicated to Malin Bakken, born 1999-11-21 WHAT IS PEAR? -- 2.40.0