1999-04-17 08:37:12 +08:00
|
|
|
/*
|
|
|
|
+----------------------------------------------------------------------+
|
2004-01-08 16:18:22 +08:00
|
|
|
| PHP Version 5 |
|
1999-04-17 08:37:12 +08:00
|
|
|
+----------------------------------------------------------------------+
|
2011-01-01 10:17:06 +08:00
|
|
|
| Copyright (c) 1997-2011 The PHP Group |
|
1999-04-17 08:37:12 +08:00
|
|
|
+----------------------------------------------------------------------+
|
2006-01-01 20:51:34 +08:00
|
|
|
| This source file is subject to version 3.01 of the PHP license, |
|
1999-07-16 21:13:16 +08:00
|
|
|
| that is bundled with this package in the file LICENSE, and is |
|
2003-06-11 04:04:29 +08:00
|
|
|
| available through the world-wide-web at the following url: |
|
2006-01-01 20:51:34 +08:00
|
|
|
| http://www.php.net/license/3_01.txt |
|
1999-07-16 21:13:16 +08:00
|
|
|
| If you did not receive a copy of the PHP license and are unable to |
|
|
|
|
| obtain it through the world-wide-web, please send a note to |
|
|
|
|
| license@php.net so we can mail you a copy immediately. |
|
1999-04-17 08:37:12 +08:00
|
|
|
+----------------------------------------------------------------------+
|
2002-02-28 16:29:35 +08:00
|
|
|
| Author: Thies C. Arntzen <thies@thieso.net> |
|
1999-04-17 08:37:12 +08:00
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* $Id$ */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Functions to parse & compse IPTC data.
|
|
|
|
* PhotoShop >= 3.0 can read and write textual data to JPEG files.
|
|
|
|
* ... more to come .....
|
1999-07-05 15:42:07 +08:00
|
|
|
*
|
|
|
|
* i know, parts of this is now duplicated in image.c
|
|
|
|
* but in this case i think it's okay!
|
1999-04-17 08:37:12 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* TODO:
|
|
|
|
* - add IPTC translation table
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "php.h"
|
1999-12-05 03:19:57 +08:00
|
|
|
#include "php_iptc.h"
|
1999-07-05 15:42:07 +08:00
|
|
|
#include "ext/standard/head.h"
|
1999-04-17 08:37:12 +08:00
|
|
|
|
1999-07-05 15:42:07 +08:00
|
|
|
#include <sys/stat.h>
|
|
|
|
|
|
|
|
|
|
|
|
/* some defines for the different JPEG block types */
|
|
|
|
#define M_SOF0 0xC0 /* Start Of Frame N */
|
|
|
|
#define M_SOF1 0xC1 /* N indicates which compression process */
|
|
|
|
#define M_SOF2 0xC2 /* Only SOF0-SOF2 are now in common use */
|
|
|
|
#define M_SOF3 0xC3
|
|
|
|
#define M_SOF5 0xC5 /* NB: codes C4 and CC are NOT SOF markers */
|
|
|
|
#define M_SOF6 0xC6
|
|
|
|
#define M_SOF7 0xC7
|
|
|
|
#define M_SOF9 0xC9
|
|
|
|
#define M_SOF10 0xCA
|
|
|
|
#define M_SOF11 0xCB
|
|
|
|
#define M_SOF13 0xCD
|
|
|
|
#define M_SOF14 0xCE
|
|
|
|
#define M_SOF15 0xCF
|
|
|
|
#define M_SOI 0xD8
|
|
|
|
#define M_EOI 0xD9 /* End Of Image (end of datastream) */
|
|
|
|
#define M_SOS 0xDA /* Start Of Scan (begins compressed data) */
|
|
|
|
#define M_APP0 0xe0
|
|
|
|
#define M_APP1 0xe1
|
|
|
|
#define M_APP2 0xe2
|
|
|
|
#define M_APP3 0xe3
|
|
|
|
#define M_APP4 0xe4
|
|
|
|
#define M_APP5 0xe5
|
|
|
|
#define M_APP6 0xe6
|
|
|
|
#define M_APP7 0xe7
|
|
|
|
#define M_APP8 0xe8
|
|
|
|
#define M_APP9 0xe9
|
|
|
|
#define M_APP10 0xea
|
|
|
|
#define M_APP11 0xeb
|
|
|
|
#define M_APP12 0xec
|
|
|
|
#define M_APP13 0xed
|
|
|
|
#define M_APP14 0xee
|
|
|
|
#define M_APP15 0xef
|
|
|
|
|
2001-06-06 21:06:12 +08:00
|
|
|
/* {{{ php_iptc_put1
|
|
|
|
*/
|
2001-08-12 01:03:37 +08:00
|
|
|
static int php_iptc_put1(FILE *fp, int spool, unsigned char c, unsigned char **spoolbuf TSRMLS_DC)
|
1999-07-05 15:42:07 +08:00
|
|
|
{
|
|
|
|
if (spool > 0)
|
|
|
|
PUTC(c);
|
|
|
|
|
|
|
|
if (spoolbuf) *(*spoolbuf)++ = c;
|
|
|
|
|
|
|
|
return c;
|
|
|
|
}
|
2001-06-06 21:06:12 +08:00
|
|
|
/* }}} */
|
1999-07-05 15:42:07 +08:00
|
|
|
|
2001-06-06 21:06:12 +08:00
|
|
|
/* {{{ php_iptc_get1
|
|
|
|
*/
|
2001-08-12 01:03:37 +08:00
|
|
|
static int php_iptc_get1(FILE *fp, int spool, unsigned char **spoolbuf TSRMLS_DC)
|
1999-07-05 15:42:07 +08:00
|
|
|
{
|
|
|
|
int c;
|
|
|
|
char cc;
|
|
|
|
|
|
|
|
c = getc(fp);
|
|
|
|
|
|
|
|
if (c == EOF) return EOF;
|
|
|
|
|
|
|
|
if (spool > 0) {
|
|
|
|
cc = c;
|
|
|
|
PUTC(cc);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (spoolbuf) *(*spoolbuf)++ = c;
|
|
|
|
|
|
|
|
return c;
|
|
|
|
}
|
2001-06-06 21:06:12 +08:00
|
|
|
/* }}} */
|
1999-07-05 15:42:07 +08:00
|
|
|
|
2001-06-06 21:06:12 +08:00
|
|
|
/* {{{ php_iptc_read_remaining
|
|
|
|
*/
|
2001-08-12 01:03:37 +08:00
|
|
|
static int php_iptc_read_remaining(FILE *fp, int spool, unsigned char **spoolbuf TSRMLS_DC)
|
1999-07-05 15:42:07 +08:00
|
|
|
{
|
2002-05-05 01:41:51 +08:00
|
|
|
while (php_iptc_get1(fp, spool, spoolbuf TSRMLS_CC) != EOF) continue;
|
1999-07-05 15:42:07 +08:00
|
|
|
|
|
|
|
return M_EOI;
|
|
|
|
}
|
2001-06-06 21:06:12 +08:00
|
|
|
/* }}} */
|
1999-07-05 15:42:07 +08:00
|
|
|
|
2001-06-06 21:06:12 +08:00
|
|
|
/* {{{ php_iptc_skip_variable
|
|
|
|
*/
|
2001-08-12 01:03:37 +08:00
|
|
|
static int php_iptc_skip_variable(FILE *fp, int spool, unsigned char **spoolbuf TSRMLS_DC)
|
1999-07-05 15:42:07 +08:00
|
|
|
{
|
|
|
|
unsigned int length;
|
2001-08-12 01:03:37 +08:00
|
|
|
int c1, c2;
|
1999-07-05 15:42:07 +08:00
|
|
|
|
2001-08-12 01:03:37 +08:00
|
|
|
if ((c1 = php_iptc_get1(fp, spool, spoolbuf TSRMLS_CC)) == EOF) return M_EOI;
|
1999-07-05 15:42:07 +08:00
|
|
|
|
2001-08-12 01:03:37 +08:00
|
|
|
if ((c2 = php_iptc_get1(fp, spool, spoolbuf TSRMLS_CC)) == EOF) return M_EOI;
|
1999-07-05 15:42:07 +08:00
|
|
|
|
|
|
|
length = (((unsigned char) c1) << 8) + ((unsigned char) c2);
|
|
|
|
|
|
|
|
length -= 2;
|
|
|
|
|
|
|
|
while (length--)
|
2001-08-12 01:03:37 +08:00
|
|
|
if (php_iptc_get1(fp, spool, spoolbuf TSRMLS_CC) == EOF) return M_EOI;
|
1999-07-05 15:42:07 +08:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2001-06-06 21:06:12 +08:00
|
|
|
/* }}} */
|
1999-07-05 15:42:07 +08:00
|
|
|
|
2001-06-06 21:06:12 +08:00
|
|
|
/* {{{ php_iptc_next_marker
|
|
|
|
*/
|
2001-08-12 01:03:37 +08:00
|
|
|
static int php_iptc_next_marker(FILE *fp, int spool, unsigned char **spoolbuf TSRMLS_DC)
|
1999-07-05 15:42:07 +08:00
|
|
|
{
|
|
|
|
int c;
|
|
|
|
|
|
|
|
/* skip unimportant stuff */
|
|
|
|
|
2001-08-12 01:03:37 +08:00
|
|
|
c = php_iptc_get1(fp, spool, spoolbuf TSRMLS_CC);
|
1999-07-05 15:42:07 +08:00
|
|
|
|
|
|
|
if (c == EOF) return M_EOI;
|
|
|
|
|
|
|
|
while (c != 0xff) {
|
2001-08-12 01:03:37 +08:00
|
|
|
if ((c = php_iptc_get1(fp, spool, spoolbuf TSRMLS_CC)) == EOF)
|
1999-07-05 15:42:07 +08:00
|
|
|
return M_EOI; /* we hit EOF */
|
|
|
|
}
|
|
|
|
|
|
|
|
/* get marker byte, swallowing possible padding */
|
|
|
|
do {
|
2001-08-12 01:03:37 +08:00
|
|
|
c = php_iptc_get1(fp, 0, 0 TSRMLS_CC);
|
1999-07-05 15:42:07 +08:00
|
|
|
if (c == EOF)
|
|
|
|
return M_EOI; /* we hit EOF */
|
|
|
|
else
|
|
|
|
if (c == 0xff)
|
2001-08-12 01:03:37 +08:00
|
|
|
php_iptc_put1(fp, spool, (unsigned char)c, spoolbuf TSRMLS_CC);
|
1999-07-05 15:42:07 +08:00
|
|
|
} while (c == 0xff);
|
|
|
|
|
|
|
|
return (unsigned int) c;
|
|
|
|
}
|
2001-06-06 21:06:12 +08:00
|
|
|
/* }}} */
|
1999-07-05 15:42:07 +08:00
|
|
|
|
|
|
|
static char psheader[] = "\xFF\xED\0\0Photoshop 3.0\08BIM\x04\x04\0\0\0\0";
|
|
|
|
|
2000-02-24 16:39:02 +08:00
|
|
|
/* {{{ proto array iptcembed(string iptcdata, string jpeg_file_name [, int spool])
|
1999-07-05 15:42:07 +08:00
|
|
|
Embed binary IPTC data into a JPEG image. */
|
|
|
|
PHP_FUNCTION(iptcembed)
|
|
|
|
{
|
2007-02-13 04:40:11 +08:00
|
|
|
char *iptcdata, *jpeg_file;
|
|
|
|
int iptcdata_len, jpeg_file_len;
|
|
|
|
long spool = 0;
|
|
|
|
FILE *fp;
|
2010-09-23 11:45:36 +08:00
|
|
|
unsigned int marker, done = 0;
|
|
|
|
int inx;
|
2007-02-13 04:40:11 +08:00
|
|
|
unsigned char *spoolbuf = NULL, *poi = NULL;
|
1999-07-05 15:42:07 +08:00
|
|
|
struct stat sb;
|
2007-02-13 04:30:52 +08:00
|
|
|
zend_bool written = 0;
|
1999-07-05 15:42:07 +08:00
|
|
|
|
2007-02-13 04:40:11 +08:00
|
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", &iptcdata, &iptcdata_len, &jpeg_file, &jpeg_file_len, &spool) != SUCCESS) {
|
|
|
|
return;
|
|
|
|
}
|
1999-07-05 15:42:07 +08:00
|
|
|
|
2007-02-13 04:40:11 +08:00
|
|
|
if (php_check_open_basedir(jpeg_file TSRMLS_CC)) {
|
1999-07-05 15:42:07 +08:00
|
|
|
RETURN_FALSE;
|
2001-07-31 14:28:05 +08:00
|
|
|
}
|
1999-07-05 15:42:07 +08:00
|
|
|
|
2007-02-13 04:40:11 +08:00
|
|
|
if ((fp = VCWD_FOPEN(jpeg_file, "rb")) == 0) {
|
|
|
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to open %s", jpeg_file);
|
|
|
|
RETURN_FALSE;
|
|
|
|
}
|
1999-07-05 15:42:07 +08:00
|
|
|
|
|
|
|
if (spool < 2) {
|
2001-08-12 01:03:37 +08:00
|
|
|
fstat(fileno(fp), &sb);
|
1999-07-05 15:42:07 +08:00
|
|
|
|
2007-02-13 04:40:11 +08:00
|
|
|
poi = spoolbuf = safe_emalloc(1, iptcdata_len + sizeof(psheader) + sb.st_size + 1024, 1);
|
|
|
|
memset(poi, 0, iptcdata_len + sizeof(psheader) + sb.st_size + 1024 + 1);
|
1999-07-05 15:42:07 +08:00
|
|
|
}
|
|
|
|
|
2001-08-12 01:03:37 +08:00
|
|
|
if (php_iptc_get1(fp, spool, poi?&poi:0 TSRMLS_CC) != 0xFF) {
|
1999-07-05 15:42:07 +08:00
|
|
|
fclose(fp);
|
2007-05-10 20:23:25 +08:00
|
|
|
if (spoolbuf) {
|
|
|
|
efree(spoolbuf);
|
2006-08-31 00:30:14 +08:00
|
|
|
}
|
1999-07-05 15:42:07 +08:00
|
|
|
RETURN_FALSE;
|
|
|
|
}
|
|
|
|
|
2001-08-12 01:03:37 +08:00
|
|
|
if (php_iptc_get1(fp, spool, poi?&poi:0 TSRMLS_CC) != 0xD8) {
|
1999-07-05 15:42:07 +08:00
|
|
|
fclose(fp);
|
2007-05-10 20:23:25 +08:00
|
|
|
if (spoolbuf) {
|
|
|
|
efree(spoolbuf);
|
2006-08-31 00:30:14 +08:00
|
|
|
}
|
1999-07-05 15:42:07 +08:00
|
|
|
RETURN_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
while (!done) {
|
2001-08-12 01:03:37 +08:00
|
|
|
marker = php_iptc_next_marker(fp, spool, poi?&poi:0 TSRMLS_CC);
|
1999-07-05 15:42:07 +08:00
|
|
|
|
|
|
|
if (marker == M_EOI) { /* EOF */
|
|
|
|
break;
|
|
|
|
} else if (marker != M_APP13) {
|
2001-08-12 01:03:37 +08:00
|
|
|
php_iptc_put1(fp, spool, (unsigned char)marker, poi?&poi:0 TSRMLS_CC);
|
1999-07-05 15:42:07 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
switch (marker) {
|
|
|
|
case M_APP13:
|
|
|
|
/* we are going to write a new APP13 marker, so don't output the old one */
|
2001-08-12 01:03:37 +08:00
|
|
|
php_iptc_skip_variable(fp, 0, 0 TSRMLS_CC);
|
|
|
|
php_iptc_read_remaining(fp, spool, poi?&poi:0 TSRMLS_CC);
|
1999-07-05 15:42:07 +08:00
|
|
|
done = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case M_APP0:
|
|
|
|
/* APP0 is in each and every JPEG, so when we hit APP0 we insert our new APP13! */
|
2007-02-13 04:30:52 +08:00
|
|
|
case M_APP1:
|
|
|
|
if (written) {
|
|
|
|
/* don't try to write the data twice */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
written = 1;
|
|
|
|
|
2001-08-12 01:03:37 +08:00
|
|
|
php_iptc_skip_variable(fp, spool, poi?&poi:0 TSRMLS_CC);
|
1999-07-05 15:42:07 +08:00
|
|
|
|
2007-02-13 04:40:11 +08:00
|
|
|
if (iptcdata_len & 1) {
|
|
|
|
iptcdata_len++; /* make the length even */
|
|
|
|
}
|
1999-07-05 15:42:07 +08:00
|
|
|
|
2007-02-13 04:40:11 +08:00
|
|
|
psheader[ 2 ] = (iptcdata_len+28)>>8;
|
|
|
|
psheader[ 3 ] = (iptcdata_len+28)&0xff;
|
1999-07-05 15:42:07 +08:00
|
|
|
|
2007-02-13 04:40:11 +08:00
|
|
|
for (inx = 0; inx < 28; inx++) {
|
2001-08-12 01:03:37 +08:00
|
|
|
php_iptc_put1(fp, spool, psheader[inx], poi?&poi:0 TSRMLS_CC);
|
2007-02-13 04:40:11 +08:00
|
|
|
}
|
1999-07-05 15:42:07 +08:00
|
|
|
|
2007-02-13 04:40:11 +08:00
|
|
|
php_iptc_put1(fp, spool, (unsigned char)(iptcdata_len>>8), poi?&poi:0 TSRMLS_CC);
|
|
|
|
php_iptc_put1(fp, spool, (unsigned char)(iptcdata_len&0xff), poi?&poi:0 TSRMLS_CC);
|
|
|
|
|
|
|
|
for (inx = 0; inx < iptcdata_len; inx++) {
|
|
|
|
php_iptc_put1(fp, spool, iptcdata[inx], poi?&poi:0 TSRMLS_CC);
|
|
|
|
}
|
1999-07-05 15:42:07 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case M_SOS:
|
|
|
|
/* we hit data, no more marker-inserting can be done! */
|
2001-08-12 01:03:37 +08:00
|
|
|
php_iptc_read_remaining(fp, spool, poi?&poi:0 TSRMLS_CC);
|
1999-07-05 15:42:07 +08:00
|
|
|
done = 1;
|
|
|
|
break;
|
2007-02-13 04:40:11 +08:00
|
|
|
|
1999-07-05 15:42:07 +08:00
|
|
|
default:
|
2001-08-12 01:03:37 +08:00
|
|
|
php_iptc_skip_variable(fp, spool, poi?&poi:0 TSRMLS_CC);
|
1999-07-05 15:42:07 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fclose(fp);
|
|
|
|
|
|
|
|
if (spool < 2) {
|
2001-08-12 01:03:37 +08:00
|
|
|
RETVAL_STRINGL(spoolbuf, poi - spoolbuf, 0);
|
1999-07-05 15:42:07 +08:00
|
|
|
} else {
|
|
|
|
RETURN_TRUE;
|
|
|
|
}
|
|
|
|
}
|
2001-06-05 21:12:10 +08:00
|
|
|
/* }}} */
|
1999-07-05 15:42:07 +08:00
|
|
|
|
|
|
|
/* {{{ proto array iptcparse(string iptcdata)
|
2000-02-24 16:39:02 +08:00
|
|
|
Parse binary IPTC-data into associative array */
|
1999-05-16 19:19:26 +08:00
|
|
|
PHP_FUNCTION(iptcparse)
|
1999-04-17 08:37:12 +08:00
|
|
|
{
|
2010-09-23 11:45:36 +08:00
|
|
|
int inx = 0, len;
|
|
|
|
unsigned int tagsfound = 0;
|
2007-02-13 04:40:11 +08:00
|
|
|
unsigned char *buffer, recnum, dataset, key[ 16 ];
|
|
|
|
char *str;
|
|
|
|
int str_len;
|
|
|
|
zval *values, **element;
|
|
|
|
|
|
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) != SUCCESS) {
|
|
|
|
return;
|
1999-04-17 08:37:12 +08:00
|
|
|
}
|
|
|
|
|
2007-02-13 04:40:11 +08:00
|
|
|
buffer = (unsigned char *)str;
|
1999-04-17 08:37:12 +08:00
|
|
|
|
2007-02-13 04:40:11 +08:00
|
|
|
while (inx < str_len) { /* find 1st tag */
|
2004-03-07 01:31:51 +08:00
|
|
|
if ((buffer[inx] == 0x1c) && ((buffer[inx+1] == 0x01) || (buffer[inx+1] == 0x02))){
|
1999-07-05 15:42:07 +08:00
|
|
|
break;
|
1999-04-17 08:37:12 +08:00
|
|
|
} else {
|
1999-07-05 15:42:07 +08:00
|
|
|
inx++;
|
1999-04-17 08:37:12 +08:00
|
|
|
}
|
1999-07-05 15:42:07 +08:00
|
|
|
}
|
|
|
|
|
2007-02-13 04:40:11 +08:00
|
|
|
while (inx < str_len) {
|
1999-07-05 15:42:07 +08:00
|
|
|
if (buffer[ inx++ ] != 0x1c) {
|
|
|
|
break; /* we ran against some data which does not conform to IPTC - stop parsing! */
|
|
|
|
}
|
1999-04-17 08:37:12 +08:00
|
|
|
|
2007-02-13 04:40:11 +08:00
|
|
|
if ((inx + 4) >= str_len)
|
1999-04-17 08:37:12 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
dataset = buffer[ inx++ ];
|
|
|
|
recnum = buffer[ inx++ ];
|
|
|
|
|
1999-07-05 15:42:07 +08:00
|
|
|
if (buffer[ inx ] & (unsigned char) 0x80) { /* long tag */
|
1999-04-17 08:37:12 +08:00
|
|
|
len = (((long) buffer[ inx + 2 ]) << 24) + (((long) buffer[ inx + 3 ]) << 16) +
|
|
|
|
(((long) buffer[ inx + 4 ]) << 8) + (((long) buffer[ inx + 5 ]));
|
|
|
|
inx += 6;
|
1999-07-05 15:42:07 +08:00
|
|
|
} else { /* short tag */
|
1999-04-17 08:37:12 +08:00
|
|
|
len = (((unsigned short) buffer[ inx ])<<8) | (unsigned short)buffer[ inx+1 ];
|
|
|
|
inx += 2;
|
|
|
|
}
|
|
|
|
|
2004-06-23 04:27:46 +08:00
|
|
|
snprintf(key, sizeof(key), "%d#%03d", (unsigned int) dataset, (unsigned int) recnum);
|
1999-04-17 08:37:12 +08:00
|
|
|
|
2007-02-13 04:40:11 +08:00
|
|
|
if ((len > str_len) || (inx + len) > str_len) {
|
1999-04-17 08:37:12 +08:00
|
|
|
break;
|
2007-02-13 04:40:11 +08:00
|
|
|
}
|
1999-04-17 08:37:12 +08:00
|
|
|
|
|
|
|
if (tagsfound == 0) { /* found the 1st tag - initialize the return array */
|
2002-12-06 06:28:02 +08:00
|
|
|
array_init(return_value);
|
1999-04-17 08:37:12 +08:00
|
|
|
}
|
|
|
|
|
2001-09-26 05:58:48 +08:00
|
|
|
if (zend_hash_find(Z_ARRVAL_P(return_value), key, strlen(key) + 1, (void **) &element) == FAILURE) {
|
2007-02-13 04:40:11 +08:00
|
|
|
MAKE_STD_ZVAL(values);
|
2002-12-06 06:28:02 +08:00
|
|
|
array_init(values);
|
1999-04-17 08:37:12 +08:00
|
|
|
|
2007-02-13 04:40:11 +08:00
|
|
|
zend_hash_update(Z_ARRVAL_P(return_value), key, strlen(key) + 1, (void *) &values, sizeof(zval*), (void **) &element);
|
1999-04-17 08:37:12 +08:00
|
|
|
}
|
|
|
|
|
2001-08-12 01:03:37 +08:00
|
|
|
add_next_index_stringl(*element, buffer+inx, len, 1);
|
1999-04-17 08:37:12 +08:00
|
|
|
inx += len;
|
|
|
|
tagsfound++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (! tagsfound) {
|
|
|
|
RETURN_FALSE;
|
|
|
|
}
|
|
|
|
}
|
1999-07-05 15:42:07 +08:00
|
|
|
/* }}} */
|
1999-04-17 08:37:12 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Local variables:
|
|
|
|
* tab-width: 4
|
|
|
|
* c-basic-offset: 4
|
|
|
|
* End:
|
2001-09-09 21:29:31 +08:00
|
|
|
* vim600: sw=4 ts=4 fdm=marker
|
|
|
|
* vim<600: sw=4 ts=4
|
1999-04-17 08:37:12 +08:00
|
|
|
*/
|