ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> php-cvs
php-cvs
[PHP-CVS] cvs: php4(PHP_4_2_0) /ext/exif exif.c /ext/exif/tests 002.phpt
by Marcus Börger other posts by this author
Aug 23 2002 7:59PM messages near this date
[PHP-CVS] cvs: php4(PHP_4_2_0) /ext/standard/tests/array data.inc | Re: [PHP-CVS] cvs: php4(PHP_4_2_0) /ext/exif exif.c /ext/exif/tests 002.phpt
helly		Fri Aug 23 15:59:00 2002 EDT

  Modified files:              (Branch: PHP_4_2_0)
    /php4/ext/exif/tests	002.phpt 
    /php4/ext/exif	exif.c 
  Log:
  fixes magically mentioned in NEWS before being commited
  
  
Index: php4/ext/exif/tests/002.phpt
diff -u php4/ext/exif/tests/002.phpt:1.1.2.1 php4/ext/exif/tests/002.phpt:1.1.2.2
--- php4/ext/exif/tests/002.phpt:1.1.2.1	Mon Apr  1 08:27:47 2002
+++ php4/ext/exif/tests/002.phpt	Fri Aug 23 15:58:59 2002
@@ -11,16 +11,20 @@
   test2.jpg is the same image but contains Exif/Comment information and a
             copy of test1.jpg as a thumbnail.
 */
-$istat= stat('./ext/exif/tests/test1.jpg');
-$fp    = fopen('./ext/exif/tests/test1.jpg','r');
-$image = fread($fp,$istat[7]);
-echo substr($image,490,5).'_'.$istat[7];
+ini_set('magic_quotes_runtime',0);
+if (function_exists("ob_end_clean")) ob_end_clean();
+$infile= './ext/exif/tests/test1.jpg';
+$fp    = fopen($infile,'rb');
+$image = fread($fp,filesize($infile));
+//$image = stripslashes($image);
+echo md5($image).'_'.filesize($infile);
 fclose($fp);
 $thumb = exif_thumbnail('./ext/exif/tests/test2.jpg');
-echo strcmp($image,$thumb) ? 'different' : '_identical_';
-echo strlen($thumb);
-echo '_'.substr($thumb,490,5);
+echo strcmp($image,$thumb) ? '_different_' : '_identical_';
+echo strlen($thumb).'_'.md5($thumb);
+echo "\n";
 /* 7GWgw_523_identical_523_7GWgw */
 ?> 
 --EXPECT--
-7GWgw_523_identical_523_7GWgw
\ No newline at end of file
+27bbfd9fc10e1e663d749f5225447905_523_identical_523_27bbfd9fc10e1e663d749f5225447905
+
Index: php4/ext/exif/exif.c
diff -u php4/ext/exif/exif.c:1.52.2.8 php4/ext/exif/exif.c:1.52.2.9
--- php4/ext/exif/exif.c:1.52.2.8	Sat May 18 20:03:34 2002
+++ php4/ext/exif/exif.c	Fri Aug 23 15:59:00 2002
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: exif.c,v 1.52.2.8 2002/05/19 00:03:34 sniper Exp $ */
+/* $Id: exif.c,v 1.52.2.9 2002/08/23 19:59:00 helly Exp $ */
 
 /*	ToDos
  *
@@ -720,6 +720,7 @@
 	int  motorola_intel; /* 1 Motorola; 0 Intel */
 
 	char *UserComment;
+	int  UserCommentLen;
 	char UserCommentEncoding[12];
 
 	char *Thumbnail;
@@ -808,6 +809,7 @@
 		case TAG_FMT_UNDEFINED:
 			if ( value) {
 				info_value-> value.s = estrndup(value,length);
+				info_value-> length = length;
 			} else {
 				info_value-> length = 0;
 				info_value-> value.s = estrdup("");
@@ -834,7 +836,7 @@
 
 		case TAG_FMT_SINGLE:
 			php_error(E_WARNING, "Found value of type single");
-			info_value-> value.f = (double)*(float *)value;
+			info_value-> value.f = *(float *)value;
 
 		case TAG_FMT_DOUBLE:
 			php_error(E_WARNING, "Found value of type double");
@@ -1280,7 +1282,7 @@
 	}
 
 	/* Olympus has this padded with trailing spaces.  Remove these first. */
-	if (a) for (a=ByteCount-1;a && szValuePtr[a]==' ';a--) (szValuePtr)[a] = '\0';
+	if (ByteCount) for (a=ByteCount-1;a && szValuePtr[a]==' ';a--) (szValuePtr)[a] = '\0';
 
 	/* normal text without encoding */
 	return exif_process_string(pszInfoPtr, szValuePtr, ByteCount);
@@ -1421,7 +1423,7 @@
 		switch(tag) {
 			case TAG_COPYRIGHT:
 				if (byte_count> 1 && (l=php_strnlen(value_ptr,byte_count)) > 0) {
-					if ( l<byte_count-1) {
+					if ( (size_t)l<byte_count-1) {
 						/* When there are any characters after the first NUL */
 						exif_add_image_info( ImageInfo, SECTION_COMPUTED, "Copyright.Photographer", TAG_COPYR
IGHT, TAG_FMT_STRING, l, value_ptr);
 						exif_add_image_info( ImageInfo, SECTION_COMPUTED, "Copyright.Editor",       TAG_COPYR
IGHT, TAG_FMT_STRING, byte_count-l-1, value_ptr+l+1);
@@ -1433,7 +1435,9 @@
 				break;
 
 			case TAG_USERCOMMENT:
-				exif_process_user_comment(&(ImageInfo-> UserComment),ImageInfo->UserCommentEncoding,valu
e_ptr,byte_count);
+				ImageInfo-> UserCommentLen = exif_process_user_comment(&(ImageInfo->UserComment),ImageIn
fo-> UserCommentEncoding,value_ptr,byte_count);
+				if (ImageInfo-> UserCommentLen)
+					ImageInfo-> UserCommentLen--; /* We want number of characters not allocation size */
 				break;
 
 			/* this is only a comment if type is string! */
@@ -1661,7 +1665,7 @@
 
 	if ( (l1 = php_strnlen(buffer+2,length-2)) >  0) {
 		exif_add_image_info( ImageInfo, SECTION_APP12, "Company", TAG_NONE, TAG_FMT_STRING, l1, b
uffer+2);
-		if ( length >  2+l1+1) {
+		if ( length >  2+(unsigned int)l1+1) {
 			l2 = php_strnlen(buffer+2+l1+1,length-2-l1+1);
 			exif_add_image_info( ImageInfo, SECTION_APP12, "Info", TAG_NONE, TAG_FMT_STRING, l2, buf
fer+2+l1+1);
 		}
@@ -2270,7 +2274,8 @@
 		exif_add_image_info( &ImageInfo, SECTION_COMPUTED, "FocusDistance", TAG_NONE, TAG_FMT_STR
ING, strlen(tmp), tmp);
 	}
 	if (ImageInfo.UserComment) {
-		exif_add_image_info( &ImageInfo, SECTION_COMPUTED, "UserComment", TAG_NONE, TAG_FMT_STRIN
G, strlen(ImageInfo.UserComment), ImageInfo.UserComment);
+		/*exif_iif_add_int( &ImageInfo, SECTION_COMPUTED, "UserCommentLen",  ImageInfo.UserCommen
tLen);*/
+		exif_add_image_info( &ImageInfo, SECTION_COMPUTED, "UserComment", TAG_NONE, TAG_FMT_UNDEF
INED, ImageInfo.UserCommentLen, ImageInfo.UserComment);
 		if ( (len=strlen(ImageInfo.UserCommentEncoding))) {
 			exif_add_image_info( &ImageInfo, SECTION_COMPUTED, "UserCommentEncoding", TAG_NONE, TAG_
FMT_STRING, len, ImageInfo.UserCommentEncoding);
 		}
@@ -2341,7 +2346,7 @@
 	php_error(E_NOTICE,"Returning thumbnail(%d)", ImageInfo.ThumbnailSize);
 	#endif
 
-	ZVAL_STRINGL( return_value, ImageInfo.Thumbnail, ImageInfo.ThumbnailSize, 1);
+	RETVAL_STRINGL(ImageInfo.Thumbnail, ImageInfo.ThumbnailSize, 1);
 
 	#ifdef EXIF_DEBUG
 	php_error(E_NOTICE,"Discarding info");



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Thread:
Marcus Börger
Marcus =?iso-8859-1?Q?B=F6rger?=
Marcus =?iso-8859-1?Q?B=F6rger?=

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved