diff options
Diffstat (limited to 'ext')
| -rw-r--r-- | ext/gd/gd.c | 10 | ||||
| -rw-r--r-- | ext/gd/gdttf.c | 59 | ||||
| -rw-r--r-- | ext/gd/php3_gd.h | 3 | ||||
| -rw-r--r-- | ext/mysql/php_mysql.c | 8 | ||||
| -rw-r--r-- | ext/mysql/php_mysql.h | 6 | ||||
| -rw-r--r-- | ext/standard/php_output.h | 4 |
6 files changed, 23 insertions, 67 deletions
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 <math.h> @@ -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 <freetype.h> #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; |
