[PHP-CVS] cvs: php4(PHP_4_3) /ext/exif exif.c
helly Fri May 30 13:50:06 2003 EDT Modified files: (Branch: PHP_4_3) /php4/ext/exif exif.c Log: MFH: Fix handling of ini settings Index: php4/ext/exif/exif.c diff -u php4/ext/exif/exif.c:1.118.2.20 php4/ext/exif/exif.c:1.118.2.21 --- php4/ext/exif/exif.c:1.118.2.20 Thu May 29 10:12:08 2003 +++ php4/ext/exif/exif.cFri May 30 13:50:06 2003 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: exif.c,v 1.118.2.20 2003/05/29 14:12:08 helly Exp $ */ +/* $Id: exif.c,v 1.118.2.21 2003/05/30 17:50:06 helly Exp $ */ /* ToDos * @@ -99,7 +99,7 @@ }; /* }}} */ -#define EXIF_VERSION 1.4 $Id: exif.c,v 1.118.2.20 2003/05/29 14:12:08 helly Exp $ +#define EXIF_VERSION 1.4 $Id: exif.c,v 1.118.2.21 2003/05/30 17:50:06 helly Exp $ /* {{{ PHP_MINFO_FUNCTION */ @@ -3669,6 +3669,16 @@ } /* }}} */ +/* {{{ estrdupx */ +static inline char * estrdupx(const char* str) +{ + if (str) { + return estrdup(str); + } + return estrdup(); +} +/* }}} */ + /* {{{ exif_read_file */ static int exif_read_file(image_info_type *ImageInfo, char *FileName, int read_thumbnail, int read_all TSRMLS_DC) @@ -3692,12 +3702,12 @@ ImageInfo-read_all = read_all; ImageInfo-Thumbnail.filetype = IMAGE_FILETYPE_UNKNOWN; - ImageInfo-encode_unicode= estrdup(EXIF_G(encode_unicode)); - ImageInfo-decode_unicode_be = estrdup(EXIF_G(decode_unicode_be)); - ImageInfo-decode_unicode_le = estrdup(EXIF_G(decode_unicode_le)); - ImageInfo-encode_jis= estrdup(EXIF_G(encode_jis)); - ImageInfo-decode_jis_be = estrdup(EXIF_G(decode_jis_be)); - ImageInfo-decode_jis_le = estrdup(EXIF_G(decode_jis_le)); + ImageInfo-encode_unicode= estrdupx(EXIF_G(encode_unicode)); + ImageInfo-decode_unicode_be = estrdupx(EXIF_G(decode_unicode_be)); + ImageInfo-decode_unicode_le = estrdupx(EXIF_G(decode_unicode_le)); + ImageInfo-encode_jis= estrdupx(EXIF_G(encode_jis)); + ImageInfo-decode_jis_be = estrdupx(EXIF_G(decode_jis_be)); + ImageInfo-decode_jis_le = estrdupx(EXIF_G(decode_jis_le)); if (php_stream_is(ImageInfo-infile, PHP_STREAM_IS_STDIO)) { if (VCWD_STAT(FileName, st) = 0) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4(PHP_4_3) /ext/exif exif.c
helly Sat May 31 06:24:16 2003 EDT Modified files: (Branch: PHP_4_3) /php4/ext/exif exif.c Log: MFH: make use of safe_estrdup Index: php4/ext/exif/exif.c diff -u php4/ext/exif/exif.c:1.118.2.21 php4/ext/exif/exif.c:1.118.2.22 --- php4/ext/exif/exif.c:1.118.2.21 Fri May 30 13:50:06 2003 +++ php4/ext/exif/exif.cSat May 31 06:24:15 2003 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: exif.c,v 1.118.2.21 2003/05/30 17:50:06 helly Exp $ */ +/* $Id: exif.c,v 1.118.2.22 2003/05/31 10:24:15 helly Exp $ */ /* ToDos * @@ -99,7 +99,7 @@ }; /* }}} */ -#define EXIF_VERSION 1.4 $Id: exif.c,v 1.118.2.21 2003/05/30 17:50:06 helly Exp $ +#define EXIF_VERSION 1.4 $Id: exif.c,v 1.118.2.22 2003/05/31 10:24:15 helly Exp $ /* {{{ PHP_MINFO_FUNCTION */ @@ -3669,16 +3669,6 @@ } /* }}} */ -/* {{{ estrdupx */ -static inline char * estrdupx(const char* str) -{ - if (str) { - return estrdup(str); - } - return estrdup(); -} -/* }}} */ - /* {{{ exif_read_file */ static int exif_read_file(image_info_type *ImageInfo, char *FileName, int read_thumbnail, int read_all TSRMLS_DC) @@ -3702,12 +3692,12 @@ ImageInfo-read_all = read_all; ImageInfo-Thumbnail.filetype = IMAGE_FILETYPE_UNKNOWN; - ImageInfo-encode_unicode= estrdupx(EXIF_G(encode_unicode)); - ImageInfo-decode_unicode_be = estrdupx(EXIF_G(decode_unicode_be)); - ImageInfo-decode_unicode_le = estrdupx(EXIF_G(decode_unicode_le)); - ImageInfo-encode_jis= estrdupx(EXIF_G(encode_jis)); - ImageInfo-decode_jis_be = estrdupx(EXIF_G(decode_jis_be)); - ImageInfo-decode_jis_le = estrdupx(EXIF_G(decode_jis_le)); + ImageInfo-encode_unicode= safe_estrdup(EXIF_G(encode_unicode)); + ImageInfo-decode_unicode_be = safe_estrdup(EXIF_G(decode_unicode_be)); + ImageInfo-decode_unicode_le = safe_estrdup(EXIF_G(decode_unicode_le)); + ImageInfo-encode_jis= safe_estrdup(EXIF_G(encode_jis)); + ImageInfo-decode_jis_be = safe_estrdup(EXIF_G(decode_jis_be)); + ImageInfo-decode_jis_le = safe_estrdup(EXIF_G(decode_jis_le)); if (php_stream_is(ImageInfo-infile, PHP_STREAM_IS_STDIO)) { if (VCWD_STAT(FileName, st) = 0) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4(PHP_4_3) /ext/exif exif.c
helly Thu May 29 10:12:08 2003 EDT Modified files: (Branch: PHP_4_3) /php4/ext/exif exif.c Log: MFH @Changed exif extension to consider php.ini option magic_quotes_runtime. (Marcus) Index: php4/ext/exif/exif.c diff -u php4/ext/exif/exif.c:1.118.2.19 php4/ext/exif/exif.c:1.118.2.20 --- php4/ext/exif/exif.c:1.118.2.19 Wed Apr 16 14:25:35 2003 +++ php4/ext/exif/exif.cThu May 29 10:12:08 2003 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: exif.c,v 1.118.2.19 2003/04/16 18:25:35 helly Exp $ */ +/* $Id: exif.c,v 1.118.2.20 2003/05/29 14:12:08 helly Exp $ */ /* ToDos * @@ -70,6 +70,10 @@ typedef unsigned char uchar; +#ifndef safe_emalloc +# define safe_emalloc(a,b,c) emalloc((a)*(b)+(c)) +#endif + #ifndef TRUE # define TRUE 1 # define FALSE 0 @@ -95,7 +99,7 @@ }; /* }}} */ -#define EXIF_VERSION 1.4 $Id: exif.c,v 1.118.2.19 2003/04/16 18:25:35 helly Exp $ +#define EXIF_VERSION 1.4 $Id: exif.c,v 1.118.2.20 2003/05/29 14:12:08 helly Exp $ /* {{{ PHP_MINFO_FUNCTION */ @@ -134,7 +138,7 @@ { #if EXIF_USE_MBSTRING if (new_value strlen(new_value) !php_mb_check_encoding_list(new_value TSRMLS_CC)) { - php_error_docref( NULL TSRMLS_CC, E_WARNING, Illegal encoding ignored: '%s', new_value); + php_error_docref(NULL TSRMLS_CC, E_WARNING, Illegal encoding ignored: '%s', new_value); return FAILURE; } #endif @@ -145,7 +149,7 @@ { #if EXIF_USE_MBSTRING if (!php_mb_check_encoding_list(new_value TSRMLS_CC)) { - php_error_docref( NULL TSRMLS_CC, E_WARNING, Illegal encoding ignored: '%s', new_value); + php_error_docref(NULL TSRMLS_CC, E_WARNING, Illegal encoding ignored: '%s', new_value); return FAILURE; } #endif @@ -234,13 +238,11 @@ /* {{{ error messages */ -static const char * EXIF_ERROR_EALLOC= Cannot allocate memory for all data; static const char * EXIF_ERROR_FILEEOF = Unexpected end of file reached; static const char * EXIF_ERROR_CORRUPT = File structure corrupted; static const char * EXIF_ERROR_THUMBEOF = Thumbnail goes IFD boundary or end of file reached; static const char * EXIF_ERROR_FSREALLOC = Illegal reallocating of undefined file section; -#define EXIF_ERRLOG_EALLOC php_error_docref(NULL TSRMLS_CC, E_ERROR, EXIF_ERROR_EALLOC); #define EXIF_ERRLOG_FILEEOFphp_error_docref(NULL TSRMLS_CC, E_WARNING, EXIF_ERROR_FILEEOF); #define EXIF_ERRLOG_CORRUPTphp_error_docref(NULL TSRMLS_CC, E_WARNING, EXIF_ERROR_CORRUPT); #define EXIF_ERRLOG_THUMBEOF php_error_docref(NULL TSRMLS_CC, E_WARNING, EXIF_ERROR_THUMBEOF); @@ -993,11 +995,11 @@ p += sprintf(buf+p, \n%08X: , i+offset); } if (ilen) { - c = *addr++; + c = *addr++; p += sprintf(buf+p, %02X , c); tmp[i%16] = c=32 ? c : '.'; tmp[(i%16)+1] = '\0'; - } else { + } else { p += sprintf(buf+p,); } if (i%16==15) { @@ -1137,12 +1139,12 @@ /* Not sure if this is correct (never seen float used in Exif format) */ case TAG_FMT_SINGLE: #ifdef EXIF_DEBUG - php_error_docref( NULL TSRMLS_CC, E_NOTICE, Found value of type single); + php_error_docref(NULL TSRMLS_CC, E_NOTICE, Found value of type single); #endif return (double)*(float *)value; case TAG_FMT_DOUBLE: #ifdef EXIF_DEBUG - php_error_docref( NULL TSRMLS_CC, E_NOTICE, Found value of type double); + php_error_docref(NULL TSRMLS_CC, E_NOTICE, Found value of type double); #endif return *(double *)value; } @@ -1186,12 +1188,12 @@ /* Not sure if this is correct (never seen float used in Exif format) */ case TAG_FMT_SINGLE: #ifdef EXIF_DEBUG - php_error_docref( NULL TSRMLS_CC, E_NOTICE, Found value of type single); + php_error_docref(NULL TSRMLS_CC, E_NOTICE, Found value of type single); #endif return (size_t)*(float *)value; case TAG_FMT_DOUBLE: #ifdef EXIF_DEBUG - php_error_docref( NULL TSRMLS_CC, E_NOTICE, Found value of type double); + php_error_docref(NULL TSRMLS_CC, E_NOTICE, Found value of type double); #endif return (size_t)*(double *)value; } @@ -1332,10 +1334,6 @@ len += strlen(exif_get_sectionname(i))+2; } sections = safe_emalloc(len, 1, 1); -
[PHP-CVS] cvs: php4(PHP_4_3) /ext/exif exif.c
rasmus Thu Apr 3 10:57:31 2003 EDT Modified files: (Branch: PHP_4_3) /php4/ext/exif exif.c Log: Clean up the parameter handling here Index: php4/ext/exif/exif.c diff -u php4/ext/exif/exif.c:1.118.2.15 php4/ext/exif/exif.c:1.118.2.16 --- php4/ext/exif/exif.c:1.118.2.15 Wed Apr 2 17:06:46 2003 +++ php4/ext/exif/exif.cThu Apr 3 10:57:30 2003 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: exif.c,v 1.118.2.15 2003/04/02 22:06:46 rasmus Exp $ */ +/* $Id: exif.c,v 1.118.2.16 2003/04/03 15:57:30 rasmus Exp $ */ /* ToDos * @@ -95,7 +95,7 @@ }; /* }}} */ -#define EXIF_VERSION 1.4 $Id: exif.c,v 1.118.2.15 2003/04/02 22:06:46 rasmus Exp $ +#define EXIF_VERSION 1.4 $Id: exif.c,v 1.118.2.16 2003/04/03 15:57:30 rasmus Exp $ /* {{{ PHP_MINFO_FUNCTION */ @@ -4001,19 +4001,22 @@ 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; } @@ -4035,11 +4038,14 @@ 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 @@ -4049,7 +4055,7 @@ 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 } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php4(PHP_4_3) /ext/exif exif.c
Waiting to see if anybody was going to comment on it or make silly whitespace changes first. On Thu, 3 Apr 2003, Jani Taskinen wrote: Shouldn't you MFB this? --Jani On Thu, 3 Apr 2003, Rasmus Lerdorf wrote: rasmus Thu Apr 3 10:57:31 2003 EDT Modified files: (Branch: PHP_4_3) /php4/ext/exif exif.c Log: Clean up the parameter handling here Index: php4/ext/exif/exif.c diff -u php4/ext/exif/exif.c:1.118.2.15 php4/ext/exif/exif.c:1.118.2.16 --- php4/ext/exif/exif.c:1.118.2.15 Wed Apr 2 17:06:46 2003 +++ php4/ext/exif/exif.c Thu Apr 3 10:57:30 2003 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: exif.c,v 1.118.2.15 2003/04/02 22:06:46 rasmus Exp $ */ +/* $Id: exif.c,v 1.118.2.16 2003/04/03 15:57:30 rasmus Exp $ */ /* ToDos * @@ -95,7 +95,7 @@ }; /* }}} */ -#define EXIF_VERSION 1.4 $Id: exif.c,v 1.118.2.15 2003/04/02 22:06:46 rasmus Exp $ +#define EXIF_VERSION 1.4 $Id: exif.c,v 1.118.2.16 2003/04/03 15:57:30 rasmus Exp $ /* {{{ PHP_MINFO_FUNCTION */ @@ -4001,19 +4001,22 @@ 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; } @@ -4035,11 +4038,14 @@ 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 @@ -4049,7 +4055,7 @@ 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 } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4(PHP_4_3) /ext/exif exif.c
rasmus Wed Apr 2 17:06:47 2003 EDT Modified files: (Branch: PHP_4_3) /php4/ext/exif exif.c Log: Get rid of bogus dtors Index: php4/ext/exif/exif.c diff -u php4/ext/exif/exif.c:1.118.2.14 php4/ext/exif/exif.c:1.118.2.15 --- php4/ext/exif/exif.c:1.118.2.14 Tue Apr 1 13:47:01 2003 +++ php4/ext/exif/exif.cWed Apr 2 17:06:46 2003 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: exif.c,v 1.118.2.14 2003/04/01 18:47:01 rasmus Exp $ */ +/* $Id: exif.c,v 1.118.2.15 2003/04/02 22:06:46 rasmus Exp $ */ /* ToDos * @@ -95,7 +95,7 @@ }; /* }}} */ -#define EXIF_VERSION 1.4 $Id: exif.c,v 1.118.2.14 2003/04/01 18:47:01 rasmus Exp $ +#define EXIF_VERSION 1.4 $Id: exif.c,v 1.118.2.15 2003/04/02 22:06:46 rasmus Exp $ /* {{{ PHP_MINFO_FUNCTION */ @@ -4035,13 +4035,10 @@ if (!ImageInfo.Thumbnail.width || !ImageInfo.Thumbnail.height) { exif_scan_thumbnail(ImageInfo TSRMLS_CC); } - 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_dtor(*p_imagetype); ZVAL_LONG(*p_imagetype, ImageInfo.Thumbnail.filetype); } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4(PHP_4_3) /ext/exif exif.c
helly Mon Dec 16 12:53:15 2002 EDT Modified files: (Branch: PHP_4_3) /php4/ext/exif exif.c Log: MFH Index: php4/ext/exif/exif.c diff -u php4/ext/exif/exif.c:1.118.2.10 php4/ext/exif/exif.c:1.118.2.11 --- php4/ext/exif/exif.c:1.118.2.10 Mon Dec 16 10:54:04 2002 +++ php4/ext/exif/exif.cMon Dec 16 12:53:15 2002 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: exif.c,v 1.118.2.10 2002/12/16 15:54:04 helly Exp $ */ +/* $Id: exif.c,v 1.118.2.11 2002/12/16 17:53:15 helly Exp $ */ /* ToDos * @@ -95,7 +95,7 @@ }; /* }}} */ -#define EXIF_VERSION 1.4 $Id: exif.c,v 1.118.2.10 2002/12/16 15:54:04 helly Exp $ +#define EXIF_VERSION 1.4 $Id: exif.c,v 1.118.2.11 2002/12/16 17:53:15 helly Exp $ /* {{{ PHP_MINFO_FUNCTION */ @@ -2514,7 +2514,7 @@ /* {{{ exif_process_string_raw * Copy a string in Exif header to a character string returns length of allocated buffer if any. */ -#ifndef EXIF_USE_MBSTRING +#if !EXIF_USE_MBSTRING static int exif_process_string_raw(char **result, char *value, size_t byte_count) { /* we cannot use strlcpy - here the problem is that we have to copy NUL * chars up to byte_count, we also have to add a single NUL character to -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4(PHP_4_3) /ext/exif exif.c
helly Sat Dec 14 12:50:57 2002 EDT Modified files: (Branch: PHP_4_3) /php4/ext/exif exif.c Log: MFH: bugfix: #21010 Index: php4/ext/exif/exif.c diff -u php4/ext/exif/exif.c:1.118.2.6 php4/ext/exif/exif.c:1.118.2.7 --- php4/ext/exif/exif.c:1.118.2.6 Tue Dec 10 13:01:33 2002 +++ php4/ext/exif/exif.cSat Dec 14 12:50:57 2002 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: exif.c,v 1.118.2.6 2002/12/10 18:01:33 iliaa Exp $ */ +/* $Id: exif.c,v 1.118.2.7 2002/12/14 17:50:57 helly Exp $ */ /* ToDos * @@ -89,7 +89,7 @@ }; /* }}} */ -#define EXIF_VERSION 1.4 $Id: exif.c,v 1.118.2.6 2002/12/10 18:01:33 iliaa Exp $ +#define EXIF_VERSION 1.4 $Id: exif.c,v 1.118.2.7 2002/12/14 17:50:57 helly Exp $ /* {{{ PHP_MINFO_FUNCTION */ @@ -427,7 +427,7 @@ /* 0x920B - 0x920D */ /* 0x9211 - 0x9216 */ #define TAG_SUBJECT_AREA0x9214 -#define TAG_MARKER_NOTE 0x927C +#define TAG_MAKER_NOTE 0x927C #define TAG_USERCOMMENT 0x9286 #define TAG_SUB_SEC_TIME0x9290 #define TAG_SUB_SEC_TIME_ORIGINAL 0x9291 @@ -904,7 +904,7 @@ typedef enum mn_offset_mode_t { MN_OFFSET_NORMAL, - MN_OFFSET_MARKER, + MN_OFFSET_MAKER, MN_OFFSET_GUESS } mn_offset_mode_t; @@ -917,13 +917,13 @@ int offset; mn_byte_order_t byte_order; mn_offset_mode_t offset_mode; -} marker_note_type; +} maker_note_type; -static const marker_note_type marker_note_array[] = { +static const maker_note_type maker_note_array[] = { { tag_table_VND_CANON, Canon, NULL, NULL, 0, 0, MN_ORDER_INTEL,MN_OFFSET_GUESS}, /* { tag_table_VND_CANON, Canon, NULL, NULL, 0, 0, MN_ORDER_NORMAL, MN_OFFSET_NORMAL},*/ { tag_table_VND_CASIO, CASIO, NULL, NULL, 0, 0, MN_ORDER_MOTOROLA, MN_OFFSET_NORMAL}, - { tag_table_VND_FUJI, FUJIFILM,NULL, FUJIFILM\x0C\x00\x00\x00, 12, 12, MN_ORDER_INTEL,MN_OFFSET_MARKER}, + { tag_table_VND_FUJI, FUJIFILM,NULL, +FUJIFILM\x0C\x00\x00\x00, 12, 12, MN_ORDER_INTEL,MN_OFFSET_MAKER}, { tag_table_VND_NIKON, NIKON, NULL, Nikon\x00\x01\x00, 8, 8, MN_ORDER_NORMAL, MN_OFFSET_NORMAL}, { tag_table_VND_NIKON_990, NIKON, NULL, NULL, 0, 0, MN_ORDER_NORMAL, MN_OFFSET_NORMAL}, { tag_table_VND_OLYMPUS, OLYMPUS OPTICAL CO.,LTD, NULL, OLYMP\x00\x01\x00, 8, 8, MN_ORDER_NORMAL, MN_OFFSET_NORMAL}, @@ -1253,7 +1253,7 @@ #define SECTION_INTEROP 10 #define SECTION_APP12 11 #define SECTION_WINXP 12 -#define SECTION_MARKERNOTE 13 +#define SECTION_MAKERNOTE 13 #define SECTION_COUNT 14 #define FOUND_FILE (1SECTION_FILE) @@ -1269,7 +1269,7 @@ #define FOUND_INTEROP (1SECTION_INTEROP) #define FOUND_APP12 (1SECTION_APP12) #define FOUND_WINXP (1SECTION_WINXP) -#define FOUND_MARKERNOTE(1SECTION_MARKERNOTE) +#define FOUND_MAKERNOTE (1SECTION_MAKERNOTE) static char *exif_get_sectionname(int section) { @@ -1287,7 +1287,7 @@ case SECTION_INTEROP: return INTEROP; case SECTION_APP12: return APP12; case SECTION_WINXP: return WINXP; - case SECTION_MARKERNOTE:return MARKERNOTE; + case SECTION_MAKERNOTE: return MAKERNOTE; } return ; } @@ -2640,40 +2640,40 @@ } /* }}} */ -/* {{{ exif_process_IFD_in_MARKERNOTE - * Process nested IFDs directories in Marker Note. */ -static int exif_process_IFD_in_MARKERNOTE(image_info_type *ImageInfo, char * value_ptr, int value_len, char *offset_base, size_t IFDlength, size_t displacement TSRMLS_DC) +/* {{{ exif_process_IFD_in_MAKERNOTE + * Process nested IFDs directories in Maker Note. */ +static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * +value_ptr, int value_len, char *offset_base, size_t IFDlength, size_t displacement +TSRMLS_DC) { - int de, i=0, section_index = SECTION_MARKERNOTE; + int de, i=0, section_index = SECTION_MAKERNOTE; int NumDirEntries, old_motorola_intel, offset_diff; - const marker_note_type *marker_note; + const maker_note_type *maker_note; char *dir_start; - for (i=0; i=sizeof(marker_note_array)/sizeof(marker_note_type); i++) { - if (i==sizeof(marker_note_array)/sizeof(marker_note_type)) + for (i=0; i=sizeof(maker_note_array)/sizeof(maker_note_type); i++) { + if (i==sizeof(maker_note_array)/sizeof(maker_note_type)) return FALSE; - marker_note = marker_note_array+i; + maker_note = maker_note_array+i;
[PHP-CVS] cvs: php4(PHP_4_3) /ext/exif exif.c
helly Sat Dec 14 14:53:52 2002 EDT Modified files: (Branch: PHP_4_3) /php4/ext/exif exif.c Log: MFH Index: php4/ext/exif/exif.c diff -u php4/ext/exif/exif.c:1.118.2.7 php4/ext/exif/exif.c:1.118.2.8 --- php4/ext/exif/exif.c:1.118.2.7 Sat Dec 14 12:50:57 2002 +++ php4/ext/exif/exif.cSat Dec 14 14:53:52 2002 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: exif.c,v 1.118.2.7 2002/12/14 17:50:57 helly Exp $ */ +/* $Id: exif.c,v 1.118.2.8 2002/12/14 19:53:52 helly Exp $ */ /* ToDos * @@ -58,7 +58,11 @@ #include ext/standard/php_image.h #include ext/standard/info.h -#ifdef HAVE_MBSTRING +#if defined(HAVE_MBSTRING) !defined(COMPILE_DL_MBSTRING) +#define EXIF_USE_MBSTRING 1 +#endif + +#ifdef EXIF_USE_MBSTRING #include ext/mbstring/mbstring.h #endif @@ -89,7 +93,7 @@ }; /* }}} */ -#define EXIF_VERSION 1.4 $Id: exif.c,v 1.118.2.7 2002/12/14 17:50:57 helly Exp $ +#define EXIF_VERSION 1.4 $Id: exif.c,v 1.118.2.8 2002/12/14 19:53:52 helly Exp $ /* {{{ PHP_MINFO_FUNCTION */ @@ -126,7 +130,7 @@ ZEND_API ZEND_INI_MH(OnUpdateEncode) { -#ifdef HAVE_MBSTRING +#ifdef EXIF_USE_MBSTRING if (new_value strlen(new_value) !php_mb_check_encoding_list(new_value TSRMLS_CC)) { php_error_docref( NULL TSRMLS_CC, E_WARNING, Illegal encoding ignored: '%s', new_value); return FAILURE; @@ -137,7 +141,7 @@ ZEND_API ZEND_INI_MH(OnUpdateDecode) { -#ifdef HAVE_MBSTRING +#ifdef EXIF_USE_MBSTRING if (!php_mb_check_encoding_list(new_value TSRMLS_CC)) { php_error_docref( NULL TSRMLS_CC, E_WARNING, Illegal encoding ignored: '%s', new_value); return FAILURE; @@ -2507,7 +2511,7 @@ /* {{{ exif_process_string_raw * Copy a string in Exif header to a character string returns length of allocated buffer if any. */ -#ifndef HAVE_MBSTRING +#ifndef EXIF_USE_MBSTRING static int exif_process_string_raw(char **result, char *value, size_t byte_count) { /* we cannot use strlcpy - here the problem is that we have to copy NUL * chars up to byte_count, we also have to add a single NUL character to @@ -2553,7 +2557,7 @@ { int a; -#ifdef HAVE_MBSTRING +#ifdef EXIF_USE_MBSTRING size_t len;; #endif @@ -2564,7 +2568,7 @@ *pszEncoding = estrdup((const char*)szValuePtr); szValuePtr = szValuePtr+8; ByteCount -= 8; -#ifdef HAVE_MBSTRING +#ifdef EXIF_USE_MBSTRING if (ImageInfo-motorola_intel) { *pszInfoPtr = php_mb_convert_encoding(szValuePtr, ByteCount, ImageInfo-encode_unicode, ImageInfo-decode_unicode_be, len TSRMLS_CC); } else { @@ -2585,7 +2589,7 @@ *pszEncoding = estrdup((const char*)szValuePtr); szValuePtr = szValuePtr+8; ByteCount -= 8; -#ifdef HAVE_MBSTRING +#ifdef EXIF_USE_MBSTRING if (ImageInfo-motorola_intel) { *pszInfoPtr = php_mb_convert_encoding(szValuePtr, ByteCount, ImageInfo-encode_jis, ImageInfo-decode_jis_be, len TSRMLS_CC); } else { @@ -2624,7 +2628,7 @@ xp_field-tag = tag; /* Copy the comment */ -#ifdef HAVE_MBSTRING +#ifdef EXIF_USE_MBSTRING /* What if MS supports big-endian with XP? */ /* if (ImageInfo-motorola_intel) { xp_field-value = php_mb_convert_encoding(szValuePtr, ByteCount, ImageInfo-encode_unicode, ImageInfo-decode_unicode_be, xp_field-size TSRMLS_CC); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4(PHP_4_3) /ext/exif exif.c
iliaa Tue Dec 10 13:01:33 2002 EDT Modified files: (Branch: PHP_4_3) /php4/ext/exif exif.c Log: MFH Index: php4/ext/exif/exif.c diff -u php4/ext/exif/exif.c:1.118.2.5 php4/ext/exif/exif.c:1.118.2.6 --- php4/ext/exif/exif.c:1.118.2.5 Tue Dec 10 09:35:36 2002 +++ php4/ext/exif/exif.cTue Dec 10 13:01:33 2002 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: exif.c,v 1.118.2.5 2002/12/10 14:35:36 helly Exp $ */ +/* $Id: exif.c,v 1.118.2.6 2002/12/10 18:01:33 iliaa Exp $ */ /* ToDos * @@ -89,7 +89,7 @@ }; /* }}} */ -#define EXIF_VERSION 1.4 $Id: exif.c,v 1.118.2.5 2002/12/10 14:35:36 helly Exp $ +#define EXIF_VERSION 1.4 $Id: exif.c,v 1.118.2.6 2002/12/10 18:01:33 iliaa Exp $ /* {{{ PHP_MINFO_FUNCTION */ @@ -1613,7 +1613,7 @@ } else { info_value = info_data-value; } - for (index=0,vptr=value; indexlength; index++,vptr+=php_tiff_bytes_per_format[format]) { + for (index=0,vptr=value; indexlength; +index++,(int)vptr+=php_tiff_bytes_per_format[format]) { if (length1) { info_value = info_data-value.list[index]; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4(PHP_4_3) /ext/exif exif.c
iliaa Mon Dec 9 19:10:37 2002 EDT Modified files: (Branch: PHP_4_3) /php4/ext/exif exif.c Log: MFH Index: php4/ext/exif/exif.c diff -u php4/ext/exif/exif.c:1.118.2.3 php4/ext/exif/exif.c:1.118.2.4 --- php4/ext/exif/exif.c:1.118.2.3 Tue Nov 26 21:43:21 2002 +++ php4/ext/exif/exif.cMon Dec 9 19:10:37 2002 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: exif.c,v 1.118.2.3 2002/11/27 02:43:21 helly Exp $ */ +/* $Id: exif.c,v 1.118.2.4 2002/12/10 00:10:37 iliaa Exp $ */ /* ToDos * @@ -89,7 +89,7 @@ }; /* }}} */ -#define EXIF_VERSION 1.4 $Id: exif.c,v 1.118.2.3 2002/11/27 02:43:21 helly Exp $ +#define EXIF_VERSION 1.4 $Id: exif.c,v 1.118.2.4 2002/12/10 00:10:37 iliaa Exp $ /* {{{ PHP_MINFO_FUNCTION */ @@ -765,8 +765,8 @@ { 0x, GPSVersion}, { 0x0001, GPSLatitudeRef}, { 0x0002, GPSLatitude}, - { 0x0003, GPSLongitude}, - { 0x0004, GPSLongitudeRef}, + { 0x0003, GPSLongitudeRef}, + { 0x0004, GPSLongitude}, { 0x0005, GPSAltitudeRef}, { 0x0006, GPSAltitude}, { 0x0007, GPSTimeStamp}, @@ -1520,6 +1520,7 @@ 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) { size_t index; + void *vptr; image_info_value *info_value; image_info_data *info_data; image_info_data *list; @@ -1604,35 +1605,35 @@ } else { info_value = info_data-value; } - for (index=0; indexlength; index++) { + for (index=0,vptr=value; indexlength; +index++,vptr+=php_tiff_bytes_per_format[format]) { if (length1) { info_value = info_data-value.list[index]; } switch (format) { case TAG_FMT_USHORT: - info_value-u = php_ifd_get16u(value, motorola_intel); + info_value-u = php_ifd_get16u(vptr, +motorola_intel); break; case TAG_FMT_ULONG: - info_value-u = php_ifd_get32u(value, motorola_intel); + info_value-u = php_ifd_get32u(vptr, +motorola_intel); break; case TAG_FMT_URATIONAL: - info_value-ur.num = php_ifd_get32u(value, motorola_intel); - info_value-ur.den = php_ifd_get32u(4+(char *)value, motorola_intel); + info_value-ur.num = +php_ifd_get32u(vptr, motorola_intel); + info_value-ur.den = +php_ifd_get32u(4+(char *)vptr, motorola_intel); break; case TAG_FMT_SSHORT: - info_value-i = php_ifd_get16s(value, motorola_intel); + info_value-i = php_ifd_get16s(vptr, +motorola_intel); break; case TAG_FMT_SLONG: - info_value-i = php_ifd_get32s(value, motorola_intel); + info_value-i = php_ifd_get32s(vptr, +motorola_intel); break; case TAG_FMT_SRATIONAL: - info_value-sr.num = php_ifd_get32u(value, motorola_intel); - info_value-sr.den = php_ifd_get32u(4+(char *)value, motorola_intel); + info_value-sr.num = +php_ifd_get32u(vptr, motorola_intel); + info_value-sr.den = +php_ifd_get32u(4+(char *)vptr, motorola_intel); break; case TAG_FMT_SINGLE: -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4(PHP_4_3) /ext/exif exif.c
helly Tue Nov 26 21:38:37 2002 EDT Modified files: (Branch: PHP_4_3) /php4/ext/exif exif.c Log: MFH: Canon fix Index: php4/ext/exif/exif.c diff -u php4/ext/exif/exif.c:1.118.2.1 php4/ext/exif/exif.c:1.118.2.2 --- php4/ext/exif/exif.c:1.118.2.1 Fri Nov 22 16:52:59 2002 +++ php4/ext/exif/exif.cTue Nov 26 21:38:37 2002 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: exif.c,v 1.118.2.1 2002/11/22 21:52:59 iliaa Exp $ */ +/* $Id: exif.c,v 1.118.2.2 2002/11/27 02:38:37 helly Exp $ */ /* ToDos * @@ -109,7 +109,7 @@ }; /* }}} */ -#define EXIF_VERSION 1.4 $Id: exif.c,v 1.118.2.1 2002/11/22 21:52:59 iliaa Exp $ +#define EXIF_VERSION 1.4 $Id: exif.c,v 1.118.2.2 2002/11/27 02:38:37 helly Exp $ /* {{{ PHP_MINFO_FUNCTION */ @@ -924,7 +924,8 @@ typedef enum mn_offset_mode_t { MN_OFFSET_NORMAL, - MN_OFFSET_MARKER + MN_OFFSET_MARKER, + MN_OFFSET_GUESS } mn_offset_mode_t; typedef struct { @@ -939,7 +940,8 @@ } marker_note_type; static const marker_note_type marker_note_array[] = { - { tag_table_VND_CANON, Canon, NULL, NULL, 0, 0, MN_ORDER_NORMAL, MN_OFFSET_NORMAL}, + { tag_table_VND_CANON, Canon, NULL, NULL, + 0, 0, MN_ORDER_INTEL,MN_OFFSET_GUESS}, +/* { tag_table_VND_CANON, Canon, NULL, NULL, + 0, 0, MN_ORDER_NORMAL, MN_OFFSET_NORMAL},*/ { tag_table_VND_CASIO, CASIO, NULL, NULL, 0, 0, MN_ORDER_MOTOROLA, MN_OFFSET_NORMAL}, { tag_table_VND_FUJI, FUJIFILM,NULL, FUJIFILM\x0C\x00\x00\x00, 12, 12, MN_ORDER_INTEL,MN_OFFSET_MARKER}, { tag_table_VND_NIKON, NIKON, NULL, Nikon\x00\x01\x00, 8, 8, MN_ORDER_NORMAL, MN_OFFSET_NORMAL}, @@ -991,27 +993,35 @@ /* {{{ exif_char_dump * Do not use! This is a debug function... */ #ifdef EXIF_DEBUG -static unsigned char* exif_char_dump(unsigned char * addr, int len, int hex) +static unsigned char* exif_char_dump(unsigned char * addr, int len, int offset) { - static unsigned char buf[1024+1]; - int c, i, p=0, n = hex ? 5 : 3; - - for(i=0; ilen p+n=sizeof(buf); i++) { - if (i%64==0) - buf[p++] = '\n'; + static unsigned char buf[4096+1]; + static unsigned char tmp[20]; + int c, i, p=0, n = 5+31; + + p += sprintf(buf+p, \nDump Len: %08X (%d), len, len); + if (len) { + for(i=0; ilen+15 p+n=sizeof(buf); i++) { + if (i%16==0) { + p += sprintf(buf+p, \n%08X: , i+offset); + } + if (ilen) { c = *addr++; - if (hex) { - sprintf(buf+p, %02X , c); - p += 3; + p += sprintf(buf+p, %02X , c); + tmp[i%16] = c=32 ? c : '.'; + tmp[(i%16)+1] = '\0'; } else { - if (c=32) { - buf[p++] = c; - } else { - buf[p++] = '?'; + p += sprintf(buf+p,); + } + if (i%16==15) { + p += sprintf(buf+p, %s, tmp); + if (i=len) { + break; + } } } } - buf[sizeof(buf)-1]=0; + buf[sizeof(buf)-1] = '\0'; return buf; } #endif @@ -2642,7 +2652,7 @@ static int exif_process_IFD_in_MARKERNOTE(image_info_type *ImageInfo, char * value_ptr, int value_len, char *offset_base, size_t IFDlength, size_t displacement TSRMLS_DC) { int de, i=0, section_index = SECTION_MARKERNOTE; - int NumDirEntries, old_motorola_intel; + int NumDirEntries, old_motorola_intel, offset_diff; const marker_note_type *marker_note; char *dir_start; @@ -2664,7 +2674,7 @@ dir_start = value_ptr + marker_note-offset; #ifdef EXIF_DEBUG - exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, process %s @x%04X + 0x%04X=%d: %s, exif_get_sectionname(section_index), (int)dir_start-(int)offset_base+marker_note-offset+displacement, value_len, value_len, exif_char_dump(value_ptr, value_len, 1)); + exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, process %s @x%04X + +0x%04X=%d: %s, exif_get_sectionname(section_index), +(int)dir_start-(int)offset_base+marker_note-offset+displacement, value_len, +value_len, exif_char_dump(value_ptr, value_len, +(int)dir_start-(int)offset_base+marker_note-offset+displacement)); #endif
[PHP-CVS] cvs: php4(PHP_4_3) /ext/exif exif.c
helly Tue Nov 26 21:43:21 2002 EDT Modified files: (Branch: PHP_4_3) /php4/ext/exif exif.c Log: MFH: remove comment Index: php4/ext/exif/exif.c diff -u php4/ext/exif/exif.c:1.118.2.2 php4/ext/exif/exif.c:1.118.2.3 --- php4/ext/exif/exif.c:1.118.2.2 Tue Nov 26 21:38:37 2002 +++ php4/ext/exif/exif.cTue Nov 26 21:43:21 2002 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: exif.c,v 1.118.2.2 2002/11/27 02:38:37 helly Exp $ */ +/* $Id: exif.c,v 1.118.2.3 2002/11/27 02:43:21 helly Exp $ */ /* ToDos * @@ -33,26 +33,6 @@ * attacker could generate an image with recursive ifd pointers...(Marcus) */ -/* Fragments of the code in this module were borrowed from the public domain - * jhead.c package with the author's consent. - * - * The original header from the jhead.c file was: - * - * -- - * Program to pull the information out of various types of EFIF digital - * camera files and show it in a reasonably consistent way - * - * Version 0.9 - * - * Compiles with MSVC on Windows, or with GCC on Linux - * - * Compileing under linux: Must include math library. - * Use: cc -lm -O3 -o jhead jhead.c - * - * Matthias Wandel, Dec 1999 - April 2000 - * -- - */ - #ifdef HAVE_CONFIG_H #include config.h #endif @@ -109,7 +89,7 @@ }; /* }}} */ -#define EXIF_VERSION 1.4 $Id: exif.c,v 1.118.2.2 2002/11/27 02:38:37 helly Exp $ +#define EXIF_VERSION 1.4 $Id: exif.c,v 1.118.2.3 2002/11/27 02:43:21 helly Exp $ /* {{{ PHP_MINFO_FUNCTION */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4(PHP_4_3) /ext/exif exif.c
iliaa Fri Nov 22 16:53:01 2002 EDT Modified files: (Branch: PHP_4_3) /php4/ext/exif exif.c Log: MFH Index: php4/ext/exif/exif.c diff -u php4/ext/exif/exif.c:1.118 php4/ext/exif/exif.c:1.118.2.1 --- php4/ext/exif/exif.c:1.118 Thu Nov 7 20:08:01 2002 +++ php4/ext/exif/exif.cFri Nov 22 16:52:59 2002 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: exif.c,v 1.118 2002/11/08 01:08:01 iliaa Exp $ */ +/* $Id: exif.c,v 1.118.2.1 2002/11/22 21:52:59 iliaa Exp $ */ /* ToDos * @@ -109,7 +109,7 @@ }; /* }}} */ -#define EXIF_VERSION 1.4 $Id: exif.c,v 1.118 2002/11/08 01:08:01 iliaa Exp $ +#define EXIF_VERSION 1.4 $Id: exif.c,v 1.118.2.1 2002/11/22 21:52:59 iliaa Exp $ /* {{{ PHP_MINFO_FUNCTION */ @@ -3958,7 +3958,7 @@ add_assoc_image_info(return_value, sub_arrays, ImageInfo, SECTION_ANY_TAG TSRMLS_CC); add_assoc_image_info(return_value, sub_arrays, ImageInfo, SECTION_IFD0 TSRMLS_CC); add_assoc_image_info(return_value, 1, ImageInfo, SECTION_THUMBNAIL TSRMLS_CC); - add_assoc_image_info(return_value, sub_arrays, ImageInfo, SECTION_COMMENT TSRMLS_CC); + add_assoc_image_info(return_value, 1, ImageInfo, SECTION_COMMENT +TSRMLS_CC); add_assoc_image_info(return_value, sub_arrays, ImageInfo, SECTION_EXIF TSRMLS_CC); add_assoc_image_info(return_value, sub_arrays, ImageInfo, SECTION_GPS TSRMLS_CC); add_assoc_image_info(return_value, sub_arrays, ImageInfo, SECTION_INTEROP TSRMLS_CC); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php