From: Takeshi Abe Date: Fri, 15 Jan 2010 17:09:14 +0000 (+0000) Subject: fix wrong type and useless assignments X-Git-Tag: php-5.2.13RC1~28 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bc88aaf103bbcbf3a20b1468c4b20350fbdcf4e0;p=php fix wrong type and useless assignments --- diff --git a/ext/gd/gd.c b/ext/gd/gd.c index 7dbd84da68..ccbe3c136a 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -4238,7 +4238,7 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int long col = -1, x = -1, y = -1; int str_len, fontname_len, i, brect[8]; double ptsize, angle; - unsigned char *str = NULL, *fontname = NULL; + char *str = NULL, *fontname = NULL; char *error = NULL; int argc = ZEND_NUM_ARGS(); #if HAVE_GD_STRINGFTEX @@ -4300,28 +4300,24 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int { char tmp_font_path[MAXPATHLEN]; - if (VCWD_REALPATH((char *)fontname, tmp_font_path)) { - fontname = (unsigned char *) fontname; - } else { + if (!VCWD_REALPATH(fontname, tmp_font_path)) { fontname = NULL; } } -#else - fontname = (unsigned char *) fontname; #endif - PHP_GD_CHECK_OPEN_BASEDIR((char *)fontname, "Invalid font filename"); + PHP_GD_CHECK_OPEN_BASEDIR(fontname, "Invalid font filename"); #ifdef USE_GD_IMGSTRTTF # if HAVE_GD_STRINGFTEX if (extended) { - error = gdImageStringFTEx(im, brect, col, (char *)fontname, ptsize, angle, x, y, (char *)str, &strex); + error = gdImageStringFTEx(im, brect, col, fontname, ptsize, angle, x, y, str, &strex); } else # endif # if HAVE_GD_STRINGFT - error = gdImageStringFT(im, brect, col, (char *)fontname, ptsize, angle, x, y, (char *)str); + error = gdImageStringFT(im, brect, col, fontname, ptsize, angle, x, y, str); # elif HAVE_GD_STRINGTTF error = gdImageStringTTF(im, brect, col, fontname, ptsize, angle, x, y, str); # endif