From: Marcus Boerger Date: Thu, 21 Mar 2002 13:16:03 +0000 (+0000) Subject: #ws X-Git-Tag: php-4.3.0dev-ZendEngine2-Preview1~1160 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=671829bff4bfa99a6078d8ddc55f2820cab193c6;p=php #ws --- diff --git a/ext/exif/exif.c b/ext/exif/exif.c index 86aab27497..a0f79b2c1f 100644 --- a/ext/exif/exif.c +++ b/ext/exif/exif.c @@ -534,28 +534,27 @@ static char * exif_get_tagname(int tag_num, char *ret, int len) #ifdef EXIF_DEBUG static unsigned char* exif_char_dump( unsigned char * addr, int len, int hex) { - static unsigned char buf[1024+1]; - int c, i, p=0, n = hex ? 5 : 3; - - for(i=0; i=32) - { - buf[p++] = c; - } else { - buf[p++] = '?'; - } - } - } - buf[sizeof(buf)-1]=0; - return buf; + static unsigned char buf[1024+1]; + int c, i, p=0, n = hex ? 5 : 3; + + for(i=0; i=32) { + buf[p++] = c; + } else { + buf[p++] = '?'; + } + } + } + buf[sizeof(buf)-1]=0; + return buf; } #endif /* }}} */ @@ -792,12 +791,12 @@ typedef struct { #define SECTION_THUMBNAIL 4 #define SECTION_COMMENT 5 #define SECTION_APP0 6 -#define SECTION_EXIF 7 -#define SECTION_FPIX 8 +#define SECTION_EXIF 7 +#define SECTION_FPIX 8 #define SECTION_GPS 9 #define SECTION_INTEROP 10 #define SECTION_APP12 11 -#define SECTION_COUNT 12 +#define SECTION_COUNT 12 #define FOUND_FILE (1<2) sections[len-2] = '\0'; + if (len>2) + sections[len-2] = '\0'; return sections; } /* }}} */ @@ -866,18 +868,18 @@ static char *exif_get_sectionlist(int sectionlist) */ typedef struct { - int type; - size_t size; - uchar *data; + int type; + size_t size; + uchar *data; } file_section; typedef struct { - int count; - file_section *list; + int count; + file_section *list; } file_section_list; typedef struct { - image_filetype filetype; + image_filetype filetype; size_t width, height; size_t size; size_t offset; @@ -891,7 +893,7 @@ typedef struct { char *FileName; time_t FileDateTime; size_t FileSize; - image_filetype FileType; + image_filetype FileType; int Height, Width; int IsColor; @@ -927,7 +929,7 @@ typedef struct { /* {{{ jpeg_sof_info */ typedef struct { - int bits_per_sample; + int bits_per_sample; size_t width; size_t height; int num_components; @@ -940,8 +942,8 @@ typedef struct { */ int exif_file_sections_add(image_info_type *ImageInfo, int type, size_t size, uchar *data) { - file_section *tmp; - int count = ImageInfo->file.count; + file_section *tmp; + int count = ImageInfo->file.count; tmp = erealloc(ImageInfo->file.list,(count+1)*sizeof(file_section)); if ( tmp == NULL) return 0; @@ -1003,7 +1005,7 @@ void exif_iif_add_value( image_info_type *image_info, int section_index, char *n } image_info->info_list[section_index].list = list; - info_data = &image_info->info_list[section_index].list[image_info->info_list[section_index].count]; + info_data = &image_info->info_list[section_index].list[image_info->info_list[section_index].count]; info_data->tag = tag; info_data->format = format; info_data->length = length; @@ -1158,7 +1160,7 @@ void exif_iif_add_int( image_info_type *image_info, int section_index, char *nam } image_info->info_list[section_index].list = list; - info_data = &image_info->info_list[section_index].list[image_info->info_list[section_index].count]; + info_data = &image_info->info_list[section_index].list[image_info->info_list[section_index].count]; info_data->tag = TAG_NONE; info_data->format = TAG_FMT_SLONG; info_data->length = 1; @@ -1183,20 +1185,18 @@ void exif_iif_add_str( image_info_type *image_info, int section_index, char *nam char tmp[1024]; va_list arglist; - va_start( arglist, value ); - if ( value) vsnprintf( tmp, sizeof(tmp), value, arglist); - va_end( arglist); + va_start( arglist, value ); + if ( value) vsnprintf( tmp, sizeof(tmp), value, arglist); + va_end( arglist); if ( value) { - - list = erealloc(image_info->info_list[section_index].list,(image_info->info_list[section_index].count+1)*sizeof(image_info_data)); + list = erealloc(image_info->info_list[section_index].list,(image_info->info_list[section_index].count+1)*sizeof(image_info_data)); if ( !list) { EXIF_ERRLOG_EALLOC return; } image_info->info_list[section_index].list = list; - - info_data = &image_info->info_list[section_index].list[image_info->info_list[section_index].count]; + info_data = &image_info->info_list[section_index].list[image_info->info_list[section_index].count]; info_data->tag = TAG_NONE; info_data->format = TAG_FMT_STRING; info_data->length = 1; @@ -1546,7 +1546,7 @@ void add_assoc_image_info( pval *value, int sub_array, image_info_type *image_in */ static void exif_process_COM (image_info_type *image_info, uchar *value, int length) { - exif_iif_add_tag( image_info, SECTION_COMMENT, "Comment", TAG_COMPUTED_VALUE, TAG_FMT_STRING, length-2, value+2); + exif_iif_add_tag( image_info, SECTION_COMMENT, "Comment", TAG_COMPUTED_VALUE, TAG_FMT_STRING, length-2, value+2); } /* }}} */