php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #58211
Patch php-ps-64bit.patch revision 2012-07-13 06:51 UTC by ttkaminski at gmail dot com

Patch php-ps-64bit.patch for ps Bug #58211

Patch version 2012-07-13 06:51 UTC

Return to Bug #58211 | Download this patch
Patch Revisions:

Developer: ttkaminski@gmail.com

--- a/ps.c	2007-11-27 03:40:14.000000000 -0600
+++ b/ps.c	2012-07-13 01:35:16.815241282 -0500
@@ -518,7 +518,8 @@
 {
 	zval *zps;
 	char *text;
-	int text_len, len;
+	int text_len;
+        long len;
 	PSDoc *ps;
 
 	if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsl", &zps, &text, &text_len, &len)) {
@@ -527,7 +528,7 @@
 
 	PSDOC_FROM_ZVAL(ps, &zps);
 
-	PS_show2(ps, text, len);
+	PS_show2(ps, text, (int)len);
 
 	RETURN_TRUE;
 }
@@ -561,7 +562,8 @@
 {
 	zval *zps;
 	char *text;
-	int text_len, len;
+	int text_len;
+        long len;
 	double x, y;
 	PSDoc *ps;
 
@@ -571,7 +573,7 @@
 
 	PSDOC_FROM_ZVAL(ps, &zps);
 
-	PS_show_xy2(ps, text, len, (float) x, (float) y);
+	PS_show_xy2(ps, text, (int)len, (float) x, (float) y);
 
 	RETURN_TRUE;
 }
@@ -611,7 +613,7 @@
 PHP_FUNCTION(ps_setfont) {
 	zval *zps;
 	double fontsize;
-	int font;
+	long font;
 	PSDoc *ps;
 
 	if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rld", &zps, &font, &fontsize)) {
@@ -620,7 +622,7 @@
 
 	PSDOC_FROM_ZVAL(ps, &zps);
 
-	PS_setfont(ps, font, (float) fontsize);
+	PS_setfont(ps, (int)font, (float) fontsize);
 
 	RETURN_TRUE;
 }
@@ -691,7 +693,7 @@
 PHP_FUNCTION(ps_setoverprintmode)
 {
 	zval *zps;
-	int mode;
+	long mode;
 	PSDoc *ps;
 
 	if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &zps, &mode)) {
@@ -700,7 +702,7 @@
 
 	PSDOC_FROM_ZVAL(ps, &zps);
 
-	PS_setoverprintmode(ps, mode);
+	PS_setoverprintmode(ps, (int)mode);
 
 	RETURN_TRUE;
 }
@@ -944,7 +946,7 @@
 PHP_FUNCTION(ps_setlinejoin) 
 {
 	zval *zps;
-	int value;
+	long value;
 	PSDoc *ps;
 
 	if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &zps, &value)) {
@@ -953,7 +955,7 @@
 
 	PSDOC_FROM_ZVAL(ps, &zps);
 
-	PS_setlinejoin(ps, value);
+	PS_setlinejoin(ps, (int)value);
 
 	RETURN_TRUE;
 }
@@ -964,7 +966,7 @@
 PHP_FUNCTION(ps_setlinecap) 
 {
 	zval *zps;
-	int value;
+	long value;
 	PSDoc *ps;
 
 	if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &zps, &value)) {
@@ -973,7 +975,7 @@
 
 	PSDOC_FROM_ZVAL(ps, &zps);
 
-	PS_setlinecap(ps, value);
+	PS_setlinecap(ps, (int)value);
 
 	RETURN_TRUE;
 }
@@ -1091,7 +1093,7 @@
 	char *text;
 	int text_len;
 	double width, size = 0.0;
-	int font = 0;
+	long font = 0;
 	PSDoc *ps;
 
 	if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|ld", &zps, &text, &text_len, &font, &size)) {
@@ -1100,7 +1102,7 @@
 
 	PSDOC_FROM_ZVAL(ps, &zps);
 
-	width = (double) PS_stringwidth2(ps, text, text_len, font, (float)size);
+	width = (double) PS_stringwidth2(ps, text, text_len, (int)font, (float)size);
 
 	RETURN_DOUBLE((double) width);
 }
@@ -1114,7 +1116,7 @@
 	char *text;
 	int text_len;
 	double width, size = 0.0;
-	int font = 0;
+	long font = 0;
 	float dimension[3];
 	PSDoc *ps;
 
@@ -1124,7 +1126,7 @@
 
 	PSDOC_FROM_ZVAL(ps, &zps);
 
-	width = (double) PS_string_geometry(ps, text, text_len, font, (float) size, dimension);
+	width = (double) PS_string_geometry(ps, text, text_len, (int)font, (float) size, dimension);
 
 	array_init(return_value);
 	add_assoc_double(return_value, "width", (double) dimension[0]);
@@ -1279,7 +1281,7 @@
 	zval *zps;
 	char *text;
 	int text_len;
-	int parentid = 0, open = 0, id;
+	long parentid = 0, open = 0, id;
 	PSDoc *ps;
 
 	if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|ll", &zps, &text, &text_len, &parentid, &open)) {
@@ -1289,7 +1291,7 @@
 	PSDOC_FROM_ZVAL(ps, &zps);
 
 	/* will never return 0 */
-	id = PS_add_bookmark(ps, text, parentid, open);
+	id = PS_add_bookmark(ps, text, (int)parentid, (int)open);
 
 	RETURN_LONG(id);
 }
@@ -1302,7 +1304,7 @@
 	zval *zps;
 	char *type, *filename, *image, *stringparam = NULL;
 	int type_len, filename_len, stringparam_len;
-	int imageid, intparam = 0;
+	long imageid, intparam = 0;
 	PSDoc *ps;
 
 	if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rss|sl", &zps, &type, &type_len, &filename, &filename_len, &stringparam, &stringparam_len, &intparam)) {
@@ -1317,7 +1319,7 @@
 	image = filename;
 #endif
 
-	imageid = PS_open_image_file(ps, type, image, stringparam, intparam);
+	imageid = PS_open_image_file(ps, type, image, stringparam, (int)intparam);
 
 	if (imageid == 0) {
 		RETURN_FALSE;
@@ -1399,7 +1401,7 @@
 PHP_FUNCTION(ps_close_image)
 {
 	zval *zps;
-	int imageid;
+	long imageid;
 	PSDoc *ps;
 
 	if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &zps, &imageid)) {
@@ -1408,7 +1410,7 @@
 
 	PSDOC_FROM_ZVAL(ps, &zps);
 
-	PS_close_image(ps, imageid);
+	PS_close_image(ps, (int)imageid);
 }
 /* }}} */
 
@@ -1417,7 +1419,7 @@
 PHP_FUNCTION(ps_place_image)
 {
 	zval *zps;
-	int imageid;
+	long imageid;
 	double x, y, scale;
 	PSDoc *ps;
 
@@ -1427,7 +1429,7 @@
 
 	PSDOC_FROM_ZVAL(ps, &zps);
 
-	PS_place_image(ps, imageid, (float) x, (float) y, (float) scale);
+	PS_place_image(ps, (int)imageid, (float) x, (float) y, (float) scale);
 
 	RETURN_TRUE;
 }
@@ -1461,7 +1463,7 @@
 PHP_FUNCTION(ps_shfill)
 {
 	zval *zps;
-	int shadingid;
+	long shadingid;
 	PSDoc *ps;
 
 	if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &zps, &shadingid)) {
@@ -1470,7 +1472,7 @@
 
 	PSDOC_FROM_ZVAL(ps, &zps);
 
-	PS_shfill(ps, shadingid);
+	PS_shfill(ps, (int)shadingid);
 
 	RETURN_TRUE;
 }
@@ -1481,7 +1483,7 @@
 PHP_FUNCTION(ps_shading_pattern)
 {
 	zval *zps;
-	int patternid, shadingid;
+	long patternid, shadingid;
 	char *optlist;
 	int olen;
 	PSDoc *ps;
@@ -1492,7 +1494,7 @@
 
 	PSDOC_FROM_ZVAL(ps, &zps);
 
-	patternid = PS_shading_pattern(ps, shadingid, optlist);
+	patternid = PS_shading_pattern(ps, (int)shadingid, optlist);
 
 	RETURN_LONG(patternid);
 }
@@ -1528,7 +1530,7 @@
 	double llx, lly, urx, ury;
 	char *filename, *dest;
 	int filename_len, dest_len;
-	int page;
+	long page;
 	PSDoc *ps;
 
 	if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rddddsls", &zps, &llx, &lly, &urx, &ury, &filename, &filename_len, &page, &dest, &dest_len)) {
@@ -1537,7 +1539,7 @@
 
 	PSDOC_FROM_ZVAL(ps, &zps);
 
-	PS_add_pdflink(ps, (float) llx, (float) lly, (float) urx, (float) ury, filename, page, dest);
+	PS_add_pdflink(ps, (float) llx, (float) lly, (float) urx, (float) ury, filename, (int)page, dest);
 
 	RETURN_TRUE;
 }
@@ -1818,8 +1820,8 @@
 	zval *zps;
 	char *type, *params, *source, *data;
 	int type_len, params_len, source_len, data_len;
-	int length, width, height, components, bpc;
-	int imageid;
+	long length, width, height, components, bpc;
+	long imageid;
 	char *image;
 	PSDoc *ps;
 
@@ -1835,7 +1837,7 @@
 	image = data;
 #endif
 
-	imageid = PS_open_image(ps, type, source, image, length, width, height, components, bpc, params);
+	imageid = PS_open_image(ps, type, source, image, (int)length, (int)width, (int)height, (int)components, (int)bpc, params);
 
 	RETURN_LONG(imageid);
 }
@@ -1900,7 +1902,7 @@
 	double llx, lly, urx, ury;
 	char *contents, *title, *icon;
 	int contents_len, title_len, icon_len;
-	int open;
+	long open;
 	PSDoc *ps;
 
 	if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rddddsssl", &zps, &llx, &lly, &urx, &ury, &contents, &contents_len, &title, &title_len, &icon, &icon_len, &open)) {
@@ -1909,7 +1911,7 @@
 
 	PSDOC_FROM_ZVAL(ps, &zps);
 
-	PS_add_note(ps, (float) llx, (float) lly, (float) urx, (float) ury, contents, title, icon, open);
+	PS_add_note(ps, (float) llx, (float) lly, (float) urx, (float) ury, contents, title, icon, (int)open);
 
 	RETURN_TRUE;
 }
@@ -1922,7 +1924,7 @@
 	double llx, lly, urx, ury;
 	char *dest;
 	int dest_len;
-	int page;
+	long page;
 	PSDoc *ps;
 
 	if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rddddls", &zps, &llx, &lly, &urx, &ury, &page, &dest, &dest_len)) {
@@ -1931,7 +1933,7 @@
 
 	PSDOC_FROM_ZVAL(ps, &zps);
 
-	PS_add_locallink(ps, (float) llx, (float) lly, (float) urx, (float) ury, page, dest);
+	PS_add_locallink(ps, (float) llx, (float) lly, (float) urx, (float) ury, (int)page, dest);
 
 	RETURN_TRUE;
 }
@@ -1985,7 +1987,7 @@
 	char *spotname;
 	int spotname_len;
 	int spot;
-	int reserved = 0;
+	long reserved = 0;
 	PSDoc *ps;
 
 	if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|l", &zps, &spotname, &spotname_len, &reserved)) {
@@ -1994,7 +1996,7 @@
 
 	PSDOC_FROM_ZVAL(ps, &zps);
 
-	spot = PS_makespotcolor(ps, spotname, reserved);
+	spot = PS_makespotcolor(ps, spotname, (int)reserved);
 
 	RETURN_LONG(spot);
 } /* }}} */
@@ -2039,7 +2041,7 @@
  * Add an existing image as thumbnail for the current page. */
 PHP_FUNCTION(ps_add_thumbnail) {
 	zval *zps;
-	int imageid;
+	long imageid;
 	PSDoc *ps;
 
 	if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &zps, &imageid)) {
@@ -2048,7 +2050,7 @@
 
 	PSDOC_FROM_ZVAL(ps, &zps);
 
-	PS_add_thumbnail(ps, imageid);
+	PS_add_thumbnail(ps, (int)imageid);
 
 	RETURN_TRUE;
 } /* }}} */
@@ -2078,7 +2080,7 @@
 {
 	zval *zps;
 	double width, height, xstep, ystep;
-	int painttype;
+	long painttype;
 	PSDoc *ps;
 	int patid;
 
@@ -2263,8 +2265,8 @@
 	PSDoc *ps;
 	char *glyphname1, *glyphname2;
 	int glen1, glen2;
-	int font = 0;
-	int kern = 0;
+	long font = 0;
+	long kern = 0;
 
 	if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rssl|l", &zps, &glyphname1, &glen1, &glyphname2, &glen2, &kern, &font)) {
 		return;
@@ -2272,7 +2274,7 @@
 
 	PSDOC_FROM_ZVAL(ps, &zps);
 
-	PS_add_kerning(ps, font, glyphname1, glyphname2, kern);
+	PS_add_kerning(ps, (int)font, glyphname1, glyphname2, (int)kern);
 
 	RETURN_TRUE;
 }
@@ -2286,7 +2288,7 @@
 	PSDoc *ps;
 	char *glyphname1, *glyphname2, *glyphname3;
 	int glen1, glen2, glen3;
-	int font = 0;
+	long font = 0;
 
 	if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsss|l", &zps, &glyphname1, &glen1, &glyphname2, &glen2, &glyphname3, &glen3, &font)) {
 		return;
@@ -2294,7 +2296,7 @@
 
 	PSDOC_FROM_ZVAL(ps, &zps);
 
-	PS_add_ligature(ps, font, glyphname1, glyphname2, glyphname3);
+	PS_add_ligature(ps, (int)font, glyphname1, glyphname2, glyphname3);
 
 	RETURN_TRUE;
 }
@@ -2340,7 +2342,7 @@
    Output single char by its value in the font encoding */
 PHP_FUNCTION(ps_symbol) {
 	zval *zps;
-	int ord;
+	long ord;
 	PSDoc *ps;
 
 	if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &zps, &ord)) {
@@ -2360,9 +2362,9 @@
 PHP_FUNCTION(ps_symbol_width)
 {
 	zval *zps;
-	int ord;
+	long ord;
 	double width, size = 0.0;
-	int font = 0;
+	long font = 0;
 	PSDoc *ps;
 
 	if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|ld", &zps, &ord, &font, &size)) {
@@ -2371,7 +2373,7 @@
 
 	PSDOC_FROM_ZVAL(ps, &zps);
 
-	width = (double) PS_symbol_width(ps, (unsigned char) ord, font, (float) size);
+	width = (double) PS_symbol_width(ps, (unsigned char) ord, (int)font, (float) size);
 
 	RETURN_DOUBLE(width);
 }
@@ -2382,8 +2384,8 @@
 PHP_FUNCTION(ps_symbol_name)
 {
 	zval *zps;
-	int ord;
-	int font = 0;
+	long ord;
+	long font = 0;
 	char glyphname[50];
 	PSDoc *ps;
 
@@ -2393,7 +2395,7 @@
 
 	PSDOC_FROM_ZVAL(ps, &zps);
 
-	PS_symbol_name(ps, (unsigned char) ord, font, glyphname, 50);
+	PS_symbol_name(ps, (unsigned char) ord, (int)font, glyphname, 50);
 
 	RETURN_STRING(glyphname, 1);
 }
@@ -2426,7 +2428,7 @@
 	int text_len;
 	double width;
 	PSDoc *ps;
-	int font;
+	long font;
 	double size;
 
 	if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|ld", &zps, &text, &text_len, &font, &size)) {
@@ -2435,7 +2437,7 @@
 
 	PSDOC_FROM_ZVAL(ps, &zps);
 
-	width = PS_glyph_width(ps, text, font, size);
+	width = PS_glyph_width(ps, text, (int)font, size);
 
 	RETURN_DOUBLE(width);
 
@@ -2446,7 +2448,7 @@
 PHP_FUNCTION(ps_glyph_list) {
 	zval *zps;
 	PSDoc *ps;
-	int font;
+	long font;
 	char **glyphlist;
 	int i, listlen;
 
@@ -2456,7 +2458,7 @@
 
 	PSDOC_FROM_ZVAL(ps, &zps);
 
-	if(PS_glyph_list(ps, font, &glyphlist, &listlen)) {
+	if(PS_glyph_list(ps, (int)font, &glyphlist, &listlen)) {
 		array_init(return_value);
 		for(i=0; i<listlen; i++) {
 			add_index_string(return_value, i, glyphlist[i], 0);
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 23:01:29 2024 UTC