cvs: php4 /ext/exif exif.c

From: Date: Tue, 02 Jul 2002 22:38:38 +0000
Subject: cvs: php4 /ext/exif exif.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-12672@lists.php.net to get a copy of this message
helly Tue Jul 2 18:38:38 2002 EDT Modified files: /php4/ext/exif exif.c Log: -fix datatypes for some vriables -fix comment for function exif_process_CME -force return parameters to be passed by reference #this should kill warnings on win systems as found by Edin Index: php4/ext/exif/exif.c diff -u php4/ext/exif/exif.c:1.98 php4/ext/exif/exif.c:1.99 --- php4/ext/exif/exif.c:1.98 Sat Jun 29 13:40:28 2002 +++ php4/ext/exif/exif.c Tue Jul 2 18:38:37 2002 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: exif.c,v 1.98 2002/06/29 17:40:28 derick Exp $ */ +/* $Id: exif.c,v 1.99 2002/07/02 22:38:37 helly Exp $ */ /* ToDos * @@ -95,19 +95,21 @@ #define EFREE_IF(ptr) if (ptr) efree(ptr) +static unsigned char exif_thumbnail_force_ref[] = {2, BYREF_NONE, BYREF_FORCE_REST}; + /* {{{ exif_functions[] */ function_entry exif_functions[] = { PHP_FE(exif_read_data, NULL) PHP_FALIAS(read_exif_data, exif_read_data, NULL) PHP_FE(exif_tagname, NULL) - PHP_FE(exif_thumbnail, NULL) + PHP_FE(exif_thumbnail, exif_thumbnail_force_ref) PHP_FE(exif_imagetype, NULL) {NULL, NULL, NULL} }; /* }}} */ -#define EXIF_VERSION "1.4 $Id: exif.c,v 1.98 2002/06/29 17:40:28 derick Exp $" +#define EXIF_VERSION "1.4 $Id: exif.c,v 1.99 2002/07/02 22:38:37 helly Exp $" /* {{{ PHP_MINFO_FUNCTION */ @@ -812,10 +814,10 @@ /* Not sure if this is correct (never seen float used in Exif format) */ case TAG_FMT_SINGLE: php_error(E_NOTICE, "%s(): Found value of type single", get_active_function_name(TSRMLS_C)); - return *(float *)value; + return (size_t)*(float *)value; case TAG_FMT_DOUBLE: php_error(E_NOTICE, "%s(): Found value of type double", get_active_function_name(TSRMLS_C)); - return *(double *)value; + return (size_t)*(double *)value; } return 0; } @@ -1118,7 +1120,7 @@ /* {{{ exif_iif_add_value Add a value to image_info */ -static void exif_iif_add_value(image_info_type *image_info, int section_index, char *name, int tag, int format, int length, void* value, int motorola_intel TSRMLS_DC) +static void exif_iif_add_value(image_info_type *image_info, int section_index, char *name, int tag, int format, size_t length, void* value, int motorola_intel TSRMLS_DC) { int index; image_info_value *info_value; @@ -1247,7 +1249,7 @@ case TAG_FMT_SINGLE: php_error(E_WARNING, "%s(): Found value of type single", get_active_function_name(TSRMLS_C)); - info_value->f = (double)*(float *)value; + info_value->f = *(float *)value; case TAG_FMT_DOUBLE: php_error(E_WARNING, "%s(): Found value of type double", get_active_function_name(TSRMLS_C)); @@ -1264,7 +1266,7 @@ /* {{{ exif_iif_add_tag Add a tag from IFD to image_info */ -static void exif_iif_add_tag(image_info_type *image_info, int section_index, char *name, int tag, int format, int length, void* value TSRMLS_DC) +static void exif_iif_add_tag(image_info_type *image_info, int section_index, char *name, int tag, int format, size_t length, void* value TSRMLS_DC) { exif_iif_add_value(image_info, section_index, name, tag, format, length, value, image_info->motorola_intel TSRMLS_CC); } @@ -1707,19 +1709,19 @@ We want to print out the marker contents as legible text; we must guard against random junk and varying newline representations. */ -static void exif_process_COM (image_info_type *image_info, uchar *value, int length TSRMLS_DC) +static void exif_process_COM (image_info_type *image_info, uchar *value, size_t length TSRMLS_DC) { exif_iif_add_tag(image_info, SECTION_COMMENT, "Comment", TAG_COMPUTED_VALUE, TAG_FMT_STRING, length-2, value+2 TSRMLS_CC); } /* }}} */ -/* {{{ exif_process_COM - Process a COM marker. +/* {{{ exif_process_CME + Process a CME marker. We want to print out the marker contents as legible text; we must guard against random junk and varying newline representations. */ #ifdef EXIF_JPEG2000 -static void exif_process_CME (image_info_type *image_info, uchar *value, int length TSRMLS_DC) +static void exif_process_CME (image_info_type *image_info, uchar *value, size_t length TSRMLS_DC) { if (length>3) { switch(value[2]) { @@ -2221,7 +2223,7 @@ * Process one of the nested IFDs directories. */ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, char *offset_base, size_t IFDlength, int section_index, int ReadNextIFD TSRMLS_DC) { - int l; + size_t length; int tag, format, components; char *value_ptr, tagname[64], cbuf[32], *outside=NULL; size_t byte_count, offset_val, fpos, fgot; @@ -2346,16 +2348,16 @@ switch(tag) { case TAG_COPYRIGHT: /* check for "<photographer> NUL <editor> NUL" */ - if (byte_count>1 && (l=php_strnlen(value_ptr, byte_count)) > 0) { - if (l<byte_count-1) { + if (byte_count>1 && (length=php_strnlen(value_ptr, byte_count)) > 0) { + if (length<byte_count-1) { /* When there are any characters after the first NUL */ ImageInfo->CopyrightPhotographer = estrdup(value_ptr); - ImageInfo->CopyrightEditor = estrdup(value_ptr+l+1); - ImageInfo->Copyright = emalloc(strlen(value_ptr)+strlen(value_ptr+l+1)+3); + ImageInfo->CopyrightEditor = estrdup(value_ptr+length+1); + ImageInfo->Copyright = emalloc(strlen(value_ptr)+strlen(value_ptr+length+1)+3); if (!ImageInfo->Copyright) { EXIF_ERRLOG_EALLOC } else { - sprintf(ImageInfo->Copyright, "%s, %s", value_ptr, value_ptr+l+1); + sprintf(ImageInfo->Copyright, "%s, %s", value_ptr, value_ptr+length+1); } /* format = TAG_FMT_UNDEFINED; this musn't be ASCII */ /* but we are not supposed to change this */ @@ -2364,7 +2366,7 @@ ImageInfo->Copyright = estrdup(value_ptr); } } - break; + break; case TAG_USERCOMMENT: ImageInfo->UserCommentLength = exif_process_user_comment(ImageInfo, &(ImageInfo->UserComment), &(ImageInfo->UserCommentEncoding), value_ptr, byte_count TSRMLS_CC); @@ -2615,9 +2617,9 @@ /* {{{ exif_process_APP12 Process an JPEG APP12 block marker used by OLYMPUS */ -static void exif_process_APP12(image_info_type *ImageInfo, char *buffer, unsigned int length TSRMLS_DC) +static void exif_process_APP12(image_info_type *ImageInfo, char *buffer, size_t length TSRMLS_DC) { - int l1, l2=0; + size_t l1, l2=0; if ((l1 = php_strnlen(buffer+2, length-2)) > 0) { exif_iif_add_tag(ImageInfo, SECTION_APP12, "Company", TAG_NONE, TAG_FMT_STRING, l1, buffer+2 TSRMLS_CC);

« previous php.cvs (#12672) next »