Browse Source

More cleanup...

PHP-4.0.5
Zeev Suraski 27 years ago
parent
commit
bb3ca12629
  1. 69
      ext/gd/gd.c
  2. 28
      ext/gd/gdt1.c
  3. 3
      ext/gd/php_gd.h
  4. 6
      ext/gettext/gettext.c
  5. 4
      ext/gettext/php_gettext.h
  6. 20
      ext/hyperwave/hw.c
  7. 4
      ext/hyperwave/php_hyperwave.h

69
ext/gd/gd.c

@ -58,7 +58,7 @@
#endif
#ifdef ENABLE_GD_TTF
static void php3_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int);
static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int);
#endif
#ifdef THREAD_SAFE
@ -143,6 +143,14 @@ DLEXPORT zend_module_entry *get_module(void) { return &gd_module_entry; }
#define PolyMaxPoints 256
static void php_free_gd_font(gdFontPtr fp)
{
if (fp->data) {
efree(fp->data);
}
efree(fp);
}
PHP_MINIT_FUNCTION(gd)
{
@ -165,7 +173,7 @@ PHP_MINIT_FUNCTION(gd)
}
#endif
GD_GLOBAL(le_gd) = register_list_destructors(gdImageDestroy, NULL);
GD_GLOBAL(le_gd_font) = register_list_destructors(php3_free_gd_font, NULL);
GD_GLOBAL(le_gd_font) = register_list_destructors(php_free_gd_font, NULL);
return SUCCESS;
}
@ -220,7 +228,8 @@ PHP_MSHUTDOWN_FUNCTION(gd)
}
/* Need this for cpdf. See also comment in file.c php3i_get_le_fp() */
PHPAPI int phpi_get_le_gd(void){
PHPAPI int phpi_get_le_gd(void)
{
GD_TLS_VARS;
return GD_GLOBAL(le_gd);
}
@ -279,14 +288,6 @@ gdImageColorResolve(gdImagePtr im, int r, int g, int b)
#endif
void php3_free_gd_font(gdFontPtr fp)
{
if (fp->data) {
efree(fp->data);
}
efree(fp);
}
/* {{{ proto int imageloadfont(string filename)
Load a new font */
PHP_FUNCTION(imageloadfont) {
@ -396,7 +397,8 @@ PHP_FUNCTION(imagecreate)
/* {{{ proto int imagecreatefrompng(string filename)
Create a new image from file or URL */
void php3_imagecreatefrompng (INTERNAL_FUNCTION_PARAMETERS) {
PHP_FUNCTION(imagecreatefrompng)
{
pval *file;
int ind;
gdImagePtr im;
@ -430,7 +432,8 @@ void php3_imagecreatefrompng (INTERNAL_FUNCTION_PARAMETERS) {
/* {{{ proto int imagepng(int im [, string filename])
Output image to browser or file */
void php3_imagepng (INTERNAL_FUNCTION_PARAMETERS) {
PHP_FUNCTION(imagepng)
{
pval *imgind, *file;
gdImagePtr im;
char *fn=NULL;
@ -1381,7 +1384,7 @@ PHP_FUNCTION(imageinterlace)
/* arg = 0 normal polygon
arg = 1 filled polygon */
/* im, points, num_points, col */
static void _php3_imagepolygon(INTERNAL_FUNCTION_PARAMETERS, int filled) {
static void php_imagepolygon(INTERNAL_FUNCTION_PARAMETERS, int filled) {
pval *IM, *POINTS, *NPOINTS, *COL, **var;
gdImagePtr im;
gdPoint points[PolyMaxPoints];
@ -1469,7 +1472,7 @@ static void _php3_imagepolygon(INTERNAL_FUNCTION_PARAMETERS, int filled) {
Draw a polygon */
PHP_FUNCTION(imagepolygon)
{
_php3_imagepolygon(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
php_imagepolygon(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
}
/* }}} */
@ -1477,12 +1480,12 @@ PHP_FUNCTION(imagepolygon)
Draw a filled polygon */
PHP_FUNCTION(imagefilledpolygon)
{
_php3_imagepolygon(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
php_imagepolygon(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
}
/* }}} */
static gdFontPtr _php3_find_gd_font(int size)
static gdFontPtr php_find_gd_font(int size)
{
gdFontPtr font;
int ind_type;
@ -1524,7 +1527,7 @@ static gdFontPtr _php3_find_gd_font(int size)
* arg = 0 ImageFontWidth
* arg = 1 ImageFontHeight
*/
static void _php3_imagefontsize(INTERNAL_FUNCTION_PARAMETERS, int arg)
static void php_imagefontsize(INTERNAL_FUNCTION_PARAMETERS, int arg)
{
pval *SIZE;
gdFontPtr font;
@ -1533,7 +1536,7 @@ static void _php3_imagefontsize(INTERNAL_FUNCTION_PARAMETERS, int arg)
WRONG_PARAM_COUNT;
}
convert_to_long(SIZE);
font = _php3_find_gd_font(SIZE->value.lval);
font = php_find_gd_font(SIZE->value.lval);
RETURN_LONG(arg ? font->h : font->w);
}
@ -1542,7 +1545,7 @@ static void _php3_imagefontsize(INTERNAL_FUNCTION_PARAMETERS, int arg)
Get font width */
PHP_FUNCTION(imagefontwidth)
{
_php3_imagefontsize(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
php_imagefontsize(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
}
/* }}} */
@ -1550,13 +1553,13 @@ PHP_FUNCTION(imagefontwidth)
Get font height */
PHP_FUNCTION(imagefontheight)
{
_php3_imagefontsize(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
php_imagefontsize(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
}
/* }}} */
/* workaround for a bug in gd 1.2 */
void _php3_gdimagecharup(gdImagePtr im, gdFontPtr f, int x, int y, int c,
void php_gdimagecharup(gdImagePtr im, gdFontPtr f, int x, int y, int c,
int color)
{
int cx, cy, px, py, fline;
@ -1584,7 +1587,7 @@ void _php3_gdimagecharup(gdImagePtr im, gdFontPtr f, int x, int y, int c,
* arg = 2 ImageString
* arg = 3 ImageStringUp
*/
static void _php3_imagechar(INTERNAL_FUNCTION_PARAMETERS, int mode) {
static void php_imagechar(INTERNAL_FUNCTION_PARAMETERS, int mode) {
pval *IM, *SIZE, *X, *Y, *C, *COL;
gdImagePtr im;
int ch = 0, col, x, y, size, i, l = 0;
@ -1627,14 +1630,14 @@ static void _php3_imagechar(INTERNAL_FUNCTION_PARAMETERS, int mode) {
RETURN_FALSE;
}
font = _php3_find_gd_font(size);
font = php_find_gd_font(size);
switch(mode) {
case 0:
gdImageChar(im, font, x, y, ch, col);
break;
case 1:
_php3_gdimagecharup(im, font, x, y, ch, col);
php_gdimagecharup(im, font, x, y, ch, col);
break;
case 2:
for (i = 0; (i < l); i++) {
@ -1645,7 +1648,7 @@ static void _php3_imagechar(INTERNAL_FUNCTION_PARAMETERS, int mode) {
break;
case 3: {
for (i = 0; (i < l); i++) {
/* _php3_gdimagecharup(im, font, x, y, (int)string[i], col); */
/* php_gdimagecharup(im, font, x, y, (int)string[i], col); */
gdImageCharUp(im, font, x, y, (int)string[i], col);
y -= font->w;
}
@ -1661,28 +1664,28 @@ static void _php3_imagechar(INTERNAL_FUNCTION_PARAMETERS, int mode) {
/* {{{ proto int imagechar(int im, int font, int x, int y, string c, int col)
Draw a character */
PHP_FUNCTION(imagechar) {
_php3_imagechar(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
php_imagechar(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
}
/* }}} */
/* {{{ proto int imagecharup(int im, int font, int x, int y, string c, int col)
Draw a character rotated 90 degrees counter-clockwise */
PHP_FUNCTION(imagecharup) {
_php3_imagechar(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
php_imagechar(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
}
/* }}} */
/* {{{ proto int imagestring(int im, int font, int x, int y, string str, int col)
Draw a string horizontally */
PHP_FUNCTION(imagestring) {
_php3_imagechar(INTERNAL_FUNCTION_PARAM_PASSTHRU, 2);
php_imagechar(INTERNAL_FUNCTION_PARAM_PASSTHRU, 2);
}
/* }}} */
/* {{{ proto int imagestringup(int im, int font, int x, int y, string str, int col)
Draw a string vertically - rotated 90 degrees counter-clockwise */
PHP_FUNCTION(imagestringup) {
_php3_imagechar(INTERNAL_FUNCTION_PARAM_PASSTHRU, 3);
php_imagechar(INTERNAL_FUNCTION_PARAM_PASSTHRU, 3);
}
/* }}} */
@ -1846,7 +1849,7 @@ PHP_FUNCTION(imagesy)
Give the bounding box of a text using TrueType fonts */
PHP_FUNCTION(imagettfbbox)
{
php3_imagettftext_common(INTERNAL_FUNCTION_PARAM_PASSTHRU, TTFTEXT_BBOX);
php_imagettftext_common(INTERNAL_FUNCTION_PARAM_PASSTHRU, TTFTEXT_BBOX);
}
/* }}} */
@ -1854,12 +1857,12 @@ PHP_FUNCTION(imagettfbbox)
Write text to the image using a TrueType font */
PHP_FUNCTION(imagettftext)
{
php3_imagettftext_common(INTERNAL_FUNCTION_PARAM_PASSTHRU, TTFTEXT_DRAW);
php_imagettftext_common(INTERNAL_FUNCTION_PARAM_PASSTHRU, TTFTEXT_DRAW);
}
/* }}} */
static
void php3_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode)
void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode)
{
pval *IM, *PTSIZE, *ANGLE, *X, *Y, *C, *FONTNAME, *COL;
gdImagePtr im;

28
ext/gd/gdt1.c

@ -19,20 +19,21 @@
/* $Id$ */
void _php3_free_ps_font(gd_ps_font *f_ind)
void php_free_ps_font(gd_ps_font *f_ind)
{
T1_DeleteFont(f_ind->font_id);
efree(f_ind);
}
void _php3_free_ps_enc(char **enc)
void php_free_ps_enc(char **enc)
{
T1_DeleteEncoding(enc);
}
/* {{{ proto int imagepsloadfont(string pathname)
Load a new font from specified file */
void php3_imagepsloadfont(INTERNAL_FUNCTION_PARAMETERS) {
PHP_FUNCTION(imagepsloadfont)
{
pval *file;
int l_ind;
gd_ps_font *f_ind;
@ -77,7 +78,8 @@ void php3_imagepsloadfont(INTERNAL_FUNCTION_PARAMETERS) {
proto int imagepscopyfont(int font_index)
Make a copy of a font for purposes like extending or reenconding */
/*
void php3_imagepscopyfont(INTERNAL_FUNCTION_PARAMETERS) {
PHP_FUNCTION(imagepscopyfont)
{
pval *fnt;
int l_ind, type;
gd_ps_font *nf_ind, *of_ind;
@ -130,7 +132,8 @@ void php3_imagepscopyfont(INTERNAL_FUNCTION_PARAMETERS) {
/* {{{ proto bool imagepsfreefont(int font_index)
Free memory used by a font */
void php3_imagepsfreefont(INTERNAL_FUNCTION_PARAMETERS) {
PHP_FUNCTION(imagepsfreefont)
{
pval *fnt;
int type;
@ -154,7 +157,8 @@ void php3_imagepsfreefont(INTERNAL_FUNCTION_PARAMETERS) {
/* {{{ proto bool imagepsencodefont(int font_index, string filename)
To change a fonts character encoding vector */
void php3_imagepsencodefont(INTERNAL_FUNCTION_PARAMETERS) {
PHP_FUNCTION(imagepsencodefont)
{
pval *fnt, *enc;
char **enc_vector;
int type;
@ -192,7 +196,8 @@ void php3_imagepsencodefont(INTERNAL_FUNCTION_PARAMETERS) {
/* {{{ proto bool imagepsextendfont(int font_index, double extend)
Extend or or condense (if extend < 1) a font */
void php3_imagepsextendfont(INTERNAL_FUNCTION_PARAMETERS) {
PHP_FUNCTION(imagepsextendfont)
{
pval *fnt, *ext;
int type;
gd_ps_font *f_ind;
@ -219,7 +224,8 @@ void php3_imagepsextendfont(INTERNAL_FUNCTION_PARAMETERS) {
/* {{{ proto bool imagepsslantfont(int font_index, double slant)
Slant a font */
void php3_imagepsslantfont(INTERNAL_FUNCTION_PARAMETERS) {
PHP_FUNCTION(imagepsslantfont)
{
pval *fnt, *slt;
int type;
gd_ps_font*f_ind;
@ -245,7 +251,8 @@ void php3_imagepsslantfont(INTERNAL_FUNCTION_PARAMETERS) {
/* {{{ proto array imagepstext(int image, string text, int font, int size, int xcoord, int ycoord [, int space, int tightness, double angle, int antialias])
Rasterize a string over an image */
void php3_imagepstext(INTERNAL_FUNCTION_PARAMETERS) {
PHP_FUNCTION(imagepstext)
{
pval *img, *str, *fnt, *sz, *fg, *bg, *sp, *px, *py, *aas, *wd, *ang;
int i, j, x, y;
int space, type;
@ -413,7 +420,8 @@ void php3_imagepstext(INTERNAL_FUNCTION_PARAMETERS) {
/* {{{ proto array imagepsbbox(string text, int font, int size[, int space, int tightness, int angle])
Return the bounding box needed by a string if rasterized */
void php3_imagepsbbox(INTERNAL_FUNCTION_PARAMETERS) {
PHP_FUNCTION(imagepsbbox)
{
pval *str, *fnt, *sz, *sp, *wd, *ang;
int i, space, add_width, char_width, amount_kern, type;
int cur_x, cur_y, dx, dy;

3
ext/gd/php_gd.h

@ -97,8 +97,7 @@ PHP_FUNCTION(imagesx);
PHP_FUNCTION(imagesy);
PHP_FUNCTION(imagecreatefrompng);
PHP_FUNCTION(imagepng);
void php3_free_gd_font(gdFontPtr);
void _php3_gdimagecharup(gdImagePtr, gdFontPtr, int, int, int, int);
void php_gdimagecharup(gdImagePtr, gdFontPtr, int, int, int, int);
PHP_FUNCTION(imagedashedline);
#ifdef ENABLE_GD_TTF
PHP_FUNCTION(imagettfbbox);

6
ext/gettext/gettext.c

@ -26,7 +26,7 @@
#include <libintl.h>
function_entry php3_gettext_functions[] = {
function_entry php_gettext_functions[] = {
PHP_FE(textdomain, NULL)
PHP_FE(gettext, NULL)
PHP_FALIAS(_, gettext, NULL)
@ -36,8 +36,8 @@ function_entry php3_gettext_functions[] = {
{NULL, NULL, NULL}
};
zend_module_entry php3_gettext_module_entry = {
"gettext", php3_gettext_functions, NULL, NULL, NULL, NULL, PHP_MINFO(gettext), STANDARD_MODULE_PROPERTIES
zend_module_entry php_gettext_module_entry = {
"gettext", php_gettext_functions, NULL, NULL, NULL, NULL, PHP_MINFO(gettext), STANDARD_MODULE_PROPERTIES
};
PHP_MINFO_FUNCTION(gettext)

4
ext/gettext/php_gettext.h

@ -37,8 +37,8 @@
#include "modules.h"
#endif
extern zend_module_entry php3_gettext_module_entry;
#define gettext_module_ptr &php3_gettext_module_entry
extern zend_module_entry php_gettext_module_entry;
#define gettext_module_ptr &php_gettext_module_entry
PHP_MINFO_FUNCTION(gettext);

20
ext/hyperwave/hw.c

@ -42,7 +42,7 @@
#include "php_ini.h"
#include "php_hyperwave.h"
//hw_module php3_hw_module;
//hw_module php_hw_module;
#define HW_ATTR_NONE 1
#define HW_ATTR_LANG 2
@ -633,7 +633,7 @@ static int * make_ints_from_array(HashTable *lht) {
}
#define BUFFERLEN 30
static void php3_hw_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
static void php_hw_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
{
pval *argv[4];
int argc;
@ -897,7 +897,7 @@ static void php3_hw_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
Connect to the Hyperwave server */
PHP_FUNCTION(hw_connect)
{
php3_hw_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,0);
php_hw_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,0);
}
/* }}} */
@ -905,7 +905,7 @@ PHP_FUNCTION(hw_connect)
Connect to the Hyperwave server persistent */
PHP_FUNCTION(hw_pconnect)
{
php3_hw_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,1);
php_hw_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,1);
}
/* }}} */
@ -1095,7 +1095,7 @@ PHP_FUNCTION(hw_root)
}
/* }}} */
char *php3_hw_command(INTERNAL_FUNCTION_PARAMETERS, int comm) {
char *php_hw_command(INTERNAL_FUNCTION_PARAMETERS, int comm) {
pval **arg1;
int link, type;
hw_connection *ptr;
@ -1126,7 +1126,7 @@ char *php3_hw_command(INTERNAL_FUNCTION_PARAMETERS, int comm) {
PHP_FUNCTION(hw_stat) {
char *object;
object = php3_hw_command(INTERNAL_FUNCTION_PARAM_PASSTHRU, STAT_COMMAND);
object = php_hw_command(INTERNAL_FUNCTION_PARAM_PASSTHRU, STAT_COMMAND);
if(object == NULL)
RETURN_FALSE;
@ -1144,7 +1144,7 @@ PHP_FUNCTION(hw_who) {
int i;
char *strtok_buf;
object = php3_hw_command(INTERNAL_FUNCTION_PARAM_PASSTHRU, WHO_COMMAND);
object = php_hw_command(INTERNAL_FUNCTION_PARAM_PASSTHRU, WHO_COMMAND);
if(object == NULL)
RETURN_FALSE;
@ -1813,7 +1813,7 @@ PHP_FUNCTION(hw_modifyobject) {
#undef BUFFERLEN
/* }}} */
void php3_hw_mvcp(INTERNAL_FUNCTION_PARAMETERS, int mvcp) {
void php_hw_mvcp(INTERNAL_FUNCTION_PARAMETERS, int mvcp) {
pval *arg1, *arg2, *arg3, *arg4;
int link, type, dest=0, from=0, count;
HashTable *src_arr;
@ -1907,14 +1907,14 @@ void php3_hw_mvcp(INTERNAL_FUNCTION_PARAMETERS, int mvcp) {
/* {{{ proto void hw_mv(int link, array objrec, int from, int dest)
Moves object */
PHP_FUNCTION(hw_mv) {
php3_hw_mvcp(INTERNAL_FUNCTION_PARAM_PASSTHRU, MOVE);
php_hw_mvcp(INTERNAL_FUNCTION_PARAM_PASSTHRU, MOVE);
}
/* }}} */
/* {{{ proto void hw_cp(int link, array objrec, int dest)
Copies object */
PHP_FUNCTION(hw_cp) {
php3_hw_mvcp(INTERNAL_FUNCTION_PARAM_PASSTHRU, COPY);
php_hw_mvcp(INTERNAL_FUNCTION_PARAM_PASSTHRU, COPY);
}
/* }}} */

4
ext/hyperwave/php_hyperwave.h

@ -79,7 +79,7 @@ typedef struct {
extern PHP_HW_API php_hw_globals hw_globals;
#endif
//extern hw_module php3_hw_module;
//extern hw_module php_hw_module;
typedef struct {
int size;
@ -88,8 +88,6 @@ typedef struct {
char *bodytag;
} hw_document;
extern hw_connection php3_hw_connection;
extern PHP_MINIT_FUNCTION(hw);
extern PHP_MSHUTDOWN_FUNCTION(hw);
PHP_MINFO_FUNCTION(hw);

Loading…
Cancel
Save