CVS update: php3/functions
| From: | thies | Date: | Tue, 15 Dec 1998 08:54:59 +0000 |
| Subject: | CVS update: php3/functions | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-2806@lists.php.net to get a copy of this message | ||
Date: Tuesday December 15, 1998 @ 3:54
Author: thies
Update of /repository/php3/functions
In directory asf:/u/temp/cvs-serv12772/functions
Modified Files:
iptc.c
Log Message:
iptcparse() now returns false on error or if no data was found.
Index: php3/functions/iptc.c
diff -c php3/functions/iptc.c:1.4 php3/functions/iptc.c:1.5
*** php3/functions/iptc.c:1.4 Mon Dec 14 14:14:57 1998
--- php3/functions/iptc.c Tue Dec 15 03:54:58 1998
***************
*** 27,33 ****
+----------------------------------------------------------------------+
*/
! /* $Id: iptc.c,v 1.4 1998/12/14 19:14:57 thies Exp $ */
/*
* Functions to parse & compse IPTC data.
--- 27,33 ----
+----------------------------------------------------------------------+
*/
! /* $Id: iptc.c,v 1.5 1998/12/15 08:54:58 thies Exp $ */
/*
* Functions to parse & compse IPTC data.
***************
*** 47,53 ****
void php3_iptcparse(INTERNAL_FUNCTION_PARAMETERS)
{
! unsigned int length,inx,len,inheader;
unsigned char *buffer;
unsigned char recnum, dataset;
unsigned char key[ 16 ];
--- 47,53 ----
void php3_iptcparse(INTERNAL_FUNCTION_PARAMETERS)
{
! unsigned int length, inx, len, inheader, tagsfound;
unsigned char *buffer;
unsigned char recnum, dataset;
unsigned char key[ 16 ];
***************
*** 58,73 ****
}
convert_to_string(str);
- if (array_init(return_value) == FAILURE) {
- php3_error(E_ERROR, "Unable to initialize array");
- return;
- }
inx = 0;
length = str->value.str.len;
buffer = str->value.str.val;
inheader = 0; /* have we already found the IPTC-Header??? */
while (inx < length) {
if (buffer[ inx++ ] != 0x1c) { /* skip all junk */
--- 58,70 ----
}
convert_to_string(str);
inx = 0;
length = str->value.str.len;
buffer = str->value.str.val;
inheader = 0; /* have we already found the IPTC-Header??? */
+ tagsfound = 0; /* number of tags already found */
while (inx < length) {
if (buffer[ inx++ ] != 0x1c) { /* skip all junk */
***************
*** 100,108 ****
if ((inx + len) > length)
break;
if (_php3_hash_find(return_value->value.ht,key,strlen(key) + 1,(void **) &element) ==
FAILURE) {
if (array_init(&values) == FAILURE) {
! return;
}
_php3_hash_update(return_value->value.ht, key, strlen(key)+1, (void *) &values,
sizeof(pval), (void **) &element);
--- 97,113 ----
if ((inx + len) > length)
break;
+ if (tagsfound == 0) { /* found the 1st tag - initialize the return array */
+ if (array_init(return_value) == FAILURE) {
+ php3_error(E_ERROR, "Unable to initialize array");
+ RETURN_FALSE;
+ }
+ }
+
if (_php3_hash_find(return_value->value.ht,key,strlen(key) + 1,(void **) &element) ==
FAILURE) {
if (array_init(&values) == FAILURE) {
! php3_error(E_ERROR, "Unable to initialize array");
! RETURN_FALSE;
}
_php3_hash_update(return_value->value.ht, key, strlen(key)+1, (void *) &values,
sizeof(pval), (void **) &element);
***************
*** 111,116 ****
--- 116,127 ----
add_next_index_stringl(element,buffer+inx,len,1);
inx += len;
+
+ tagsfound++;
+ }
+
+ if (! tagsfound) {
+ RETURN_FALSE;
}
}
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net