Re: add_assoc_stringl WAS:beginner question....
| From: | Thies C. Arntzen | Date: | Fri, 09 Oct 1998 16:47:37 +0000 |
| Subject: | Re: add_assoc_stringl WAS:beginner question.... | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-1768@lists.php.net to get a copy of this message | ||
hi again (sorry for wasting bandwidth)
if i run configure without the --enable-debug switch i don't get the error
message...
but anyhow, if i use add_assoc_stringl who take care of freeing up the
key-buffer???
regards,
tc
"Thies C. Arntzen" wrote:
> hi,
> i'm just implementing an native iptc-reader...
> works fine so far, but when i run it i get:
>
> Freeing e9078 (6 bytes), allocated in ../php3/php3_hash.c on line
> 955<br>
> Freeing e9050 (6 bytes), allocated in ../php3/php3_hash.c on line
> 955<br>
> Freeing e9028 (6 bytes), allocated in ../php3/php3_hash.c on line
> 955<br>
> Freeing e9000 (6 bytes), allocated in ../php3/php3_hash.c on line
> 955<br>
> Freeing e8fd8 (6 bytes), allocated in ../php3/php3_hash.c on line
> 955<br>
> Freeing e8fb0 (6 bytes), allocated in ../php3/php3_hash.c on line
> 955<br>
> Freeing e8f88 (6 bytes), allocated in ../php3/php3_hash.c on line
> 955<br>
> ....
>
> the code looks like that:
>
> could somebody of you "wizzards" please tell me my mistake????
>
> regards,
> tc
>
> image.c:
>
> static void php3_read_iptc(FILE *fp,pval *info)
> /* read IPTC-info */
> {
> unsigned short length;
> unsigned char *buffer;
> unsigned char key[ 8 ];
>
> unsigned char recnum, dataset;
>
> int inx, len;
>
> length = php3_read2(fp);
> length -= 2; /* length includes itself */
>
> buffer = emalloc(length);
>
> if (fread(buffer,length,1,fp) != 1) {
> return;
> }
>
> pval_destructor(info _INLINE_TLS);
> if (array_init(info) == FAILURE) {
> return;
> }
>
> inx = 0;
>
> while (inx < length) {
> if (buffer[ inx++ ] != 0x1c) { /* it's not our magic...*/
> continue;
> }
>
> if ((inx + 4) >= length)
> break;
>
> dataset = buffer[ inx++ ];
> recnum = buffer[ inx++ ];
> len = (((unsigned short) buffer[ inx ])<<8) | (unsigned
> short)buffer[ inx+1 ];
> inx += 2;
>
> sprintf(key,"%d#%03d",(int) dataset,(int) recnum);
>
> if ((inx + len) >= length)
> break;
>
> add_assoc_stringl(info,key,buffer+inx,len,1);
>
> inx += len;
> }
>
> efree(buffer);
> }
>
> --
> 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
--
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