From 7461f1f45adf4c2e56b2b0f8bd334e96a35e0397 Mon Sep 17 00:00:00 2001 From: Rasmus Lerdorf Date: Thu, 3 Apr 2003 22:45:25 +0000 Subject: [PATCH] MFB --- ext/exif/exif.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/ext/exif/exif.c b/ext/exif/exif.c index ea03b4476d..409f085588 100644 --- a/ext/exif/exif.c +++ b/ext/exif/exif.c @@ -3909,19 +3909,22 @@ PHP_FUNCTION(exif_read_data) Reads the embedded thumbnail */ PHP_FUNCTION(exif_thumbnail) { - zval **p_name, **p_width, **p_height, **p_imagetype; - int ret, arg_c = ZEND_NUM_ARGS(); + zval *p_width, *p_height, *p_imagetype; + char *p_name; + int p_name_len, ret, arg_c = ZEND_NUM_ARGS(); image_info_type ImageInfo; memset(&ImageInfo, 0, sizeof(ImageInfo)); - if ((arg_c!=1 && arg_c!=3 && arg_c!=4) || zend_get_parameters_ex(arg_c, &p_name, &p_width, &p_height, &p_imagetype) == FAILURE) { + if (arg_c!=1 && arg_c!=3 && arg_c!=4) { WRONG_PARAM_COUNT; } - convert_to_string_ex(p_name); + if (zend_parse_parameters(arg_c TSRMLS_CC, "s|z/z/z/", &p_name, &p_name_len, &p_width, &p_height, &p_imagetype) == FAILURE) { + return; + } - ret = exif_read_file(&ImageInfo, Z_STRVAL_PP(p_name), 1, 0 TSRMLS_CC); + ret = exif_read_file(&ImageInfo, p_name, 1, 0 TSRMLS_CC); if (ret==FALSE) { RETURN_FALSE; } @@ -3943,11 +3946,14 @@ PHP_FUNCTION(exif_thumbnail) if (!ImageInfo.Thumbnail.width || !ImageInfo.Thumbnail.height) { exif_scan_thumbnail(&ImageInfo TSRMLS_CC); } - ZVAL_LONG(*p_width, ImageInfo.Thumbnail.width); - ZVAL_LONG(*p_height, ImageInfo.Thumbnail.height); + zval_dtor(p_width); + zval_dtor(p_height); + ZVAL_LONG(p_width, ImageInfo.Thumbnail.width); + ZVAL_LONG(p_height, ImageInfo.Thumbnail.height); } if (arg_c >= 4) { - ZVAL_LONG(*p_imagetype, ImageInfo.Thumbnail.filetype); + zval_dtor(p_imagetype); + ZVAL_LONG(p_imagetype, ImageInfo.Thumbnail.filetype); } #ifdef EXIF_DEBUG @@ -3957,7 +3963,7 @@ PHP_FUNCTION(exif_thumbnail) exif_discard_imageinfo(&ImageInfo); #ifdef EXIF_DEBUG - php_error_docref1(NULL TSRMLS_CC, Z_STRVAL_PP(p_name), E_NOTICE, "done"); + php_error_docref1(NULL TSRMLS_CC, p_name, E_NOTICE, "done"); #endif } /* }}} */ -- 2.40.0