1 --- php-5.2/ext/exif/exif.c 2006/10/10 22:22:43 1.173.2.5.2.4
2 +++ php-5.2/ext/exif/exif.c 2007/01/09 11:37:17 1.173.2.5.2.9
4 +----------------------------------------------------------------------+
6 +----------------------------------------------------------------------+
7 - | Copyright (c) 1997-2006 The PHP Group |
8 + | Copyright (c) 1997-2007 The PHP Group |
9 +----------------------------------------------------------------------+
10 | This source file is subject to version 3.01 of the PHP license, |
11 | that is bundled with this package in the file LICENSE, and is |
13 +----------------------------------------------------------------------+
25 -#define EXIF_VERSION "1.4 $Id$"
26 +#define EXIF_VERSION "1.4 $Id$"
28 /* {{{ PHP_MINFO_FUNCTION
31 image_info->info_list[section_index].list = list;
33 info_data = &image_info->info_list[section_index].list[image_info->info_list[section_index].count];
34 + memset(info_data, 0, sizeof(image_info_data));
36 info_data->format = format;
37 info_data->length = length;
39 exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "%s THUMBNAIL @0x%04X + 0x%04X", ImageInfo->Thumbnail.data ? "Ignore" : "Read", ImageInfo->Thumbnail.offset, ImageInfo->Thumbnail.size);
41 if (!ImageInfo->Thumbnail.data) {
42 - ImageInfo->Thumbnail.data = emalloc(ImageInfo->Thumbnail.size);
43 + ImageInfo->Thumbnail.data = safe_emalloc(ImageInfo->Thumbnail.size, 1, 0);
44 php_stream_seek(ImageInfo->infile, ImageInfo->Thumbnail.offset, SEEK_SET);
45 fgot = php_stream_read(ImageInfo->infile, ImageInfo->Thumbnail.data, ImageInfo->Thumbnail.size);
46 if (fgot < ImageInfo->Thumbnail.size) {
48 exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "%s THUMBNAIL @0x%04X + 0x%04X", ImageInfo->Thumbnail.data ? "Ignore" : "Read", ImageInfo->Thumbnail.offset, ImageInfo->Thumbnail.size);
50 if (!ImageInfo->Thumbnail.data && ImageInfo->Thumbnail.offset && ImageInfo->Thumbnail.size && ImageInfo->read_thumbnail) {
51 - ImageInfo->Thumbnail.data = emalloc(ImageInfo->Thumbnail.size);
52 + ImageInfo->Thumbnail.data = safe_emalloc(ImageInfo->Thumbnail.size, 1, 0);
53 php_stream_seek(ImageInfo->infile, ImageInfo->Thumbnail.offset, SEEK_SET);
54 fgot = php_stream_read(ImageInfo->infile, ImageInfo->Thumbnail.data, ImageInfo->Thumbnail.size);
55 if (fgot < ImageInfo->Thumbnail.size) {
57 exif_iif_add_int(&ImageInfo, SECTION_COMPUTED, "ByteOrderMotorola", ImageInfo.motorola_intel TSRMLS_CC);
59 if (ImageInfo.FocalLength) {
60 - exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "FocalLength" TSRMLS_CC, "%4.1fmm", ImageInfo.FocalLength);
61 + exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "FocalLength" TSRMLS_CC, "%4.1Fmm", ImageInfo.FocalLength);
62 if(ImageInfo.CCDWidth) {
63 exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "35mmFocalLength" TSRMLS_CC, "%dmm", (int)(ImageInfo.FocalLength/ImageInfo.CCDWidth*35+0.5));
65 @@ -3924,19 +3925,19 @@
67 if(ImageInfo.ExposureTime>0) {
68 if(ImageInfo.ExposureTime <= 0.5) {
69 - exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "ExposureTime" TSRMLS_CC, "%0.3f s (1/%d)", ImageInfo.ExposureTime, (int)(0.5 + 1/ImageInfo.ExposureTime));
70 + exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "ExposureTime" TSRMLS_CC, "%0.3F s (1/%d)", ImageInfo.ExposureTime, (int)(0.5 + 1/ImageInfo.ExposureTime));
72 - exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "ExposureTime" TSRMLS_CC, "%0.3f s", ImageInfo.ExposureTime);
73 + exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "ExposureTime" TSRMLS_CC, "%0.3F s", ImageInfo.ExposureTime);
76 if(ImageInfo.ApertureFNumber) {
77 - exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "ApertureFNumber" TSRMLS_CC, "f/%.1f", ImageInfo.ApertureFNumber);
78 + exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "ApertureFNumber" TSRMLS_CC, "f/%.1F", ImageInfo.ApertureFNumber);
80 if(ImageInfo.Distance) {
81 if(ImageInfo.Distance<0) {
82 exif_iif_add_str(&ImageInfo, SECTION_COMPUTED, "FocusDistance", "Infinite" TSRMLS_CC);
84 - exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "FocusDistance" TSRMLS_CC, "%0.2fm", ImageInfo.Distance);
85 + exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "FocusDistance" TSRMLS_CC, "%0.2Fm", ImageInfo.Distance);
88 if (ImageInfo.UserComment) {
90 Reads the embedded thumbnail */
91 PHP_FUNCTION(exif_thumbnail)
93 - zval *p_width, *p_height, *p_imagetype;
94 + zval *p_width = 0, *p_height = 0, *p_imagetype = 0;
96 int p_name_len, ret, arg_c = ZEND_NUM_ARGS();
97 image_info_type ImageInfo;