RE: [PHP-DEV] Re: cvs: php-src /ext/com_dotnet com_misc.c /ext/dom attr.c cdatasection.ccharacterdata.c comment.c document.c documentfragment.c
dom_iterators.c domexception.cdomimplementation.c element.c entityreference.c namednodemap.c node.c nodelist.c
| From: | Dmitry Stogov | Date: | Mon, 13 Feb 2006 15:36:30 +0000 |
| Subject: | RE: [PHP-DEV] Re: cvs: php-src /ext/com_dotnet com_misc.c /ext/dom attr.c cdatasection.ccharacterdata.c comment.c document.c documentfragment.c dom_iterators.c domexception.cdomimplementation.c element.c entityreference.c namednodemap.c node.c nodelist.c |
||
| References: | 1 | Groups: | php.cvs php.internals |
| Request: | Send a blank email to internals+get-21859@lists.php.net to get a copy of this message | ||
Ops. :)
Thank you for catching the bug.
I've committed fixed version.
Thanks. Dmitry.
> -----Original Message-----
> From: Michael Wallner [mailto:mike@php.net]
> Sent: Monday, February 13, 2006 4:10 PM
> To: Dmitry Stogov
> Cc: php-cvs@lists.php.net; internals@lists.php.net
> Subject: [PHP-DEV] Re: cvs: php-src /ext/com_dotnet
> com_misc.c /ext/dom attr.c cdatasection.ccharacterdata.c
> comment.c document.c documentfragment.c dom_iterators.c
> domexception.cdomimplementation.c element.c entityreference.c
> namednodemap.c node.c nodelist.cphp_
>
>
> Dmitry Stogov wrote:
> > dmitry Mon Feb 13 10:24:00 2006 UTC
>
> > --- ZendEngine2/zend_hash.c:1.129 Mon Feb 6 20:36:51 2006
> > +++ ZendEngine2/zend_hash.c Mon Feb 13 10:23:57 2006
> > @@ -17,7 +17,7 @@
> >
> >
> +-------------------------------------------------------------
> ---------+
> > */
> >
> > -/* $Id: zend_hash.c,v 1.129 2006/02/06 20:36:51 tony2001 Exp $ */
> > +/* $Id: zend_hash.c,v 1.130 2006/02/13 10:23:57 dmitry Exp $ */
> >
> > #include "zend.h"
> > #include "zend_operators.h"
> > @@ -49,16 +49,16 @@
> >
> > #define UNICODE_KEY(ht, type, arKey, nKeyLength, tmp) \
> > if (ht->unicode && type == IS_STRING) { \
> > - UErrorCode status = U_ZERO_ERROR; \
> > + UErrorCode status = U_ZERO_ERROR; \
> > UChar *u = NULL; \
> > int32_t u_len; \
> > TSRMLS_FETCH(); \
> >
> zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_c
> onv)), &u, &u_len, (char*)arKey, nKeyLength-1, &status); \
> > - if (U_FAILURE(status)) { \
> > + if (U_FAILURE(status)) { \
> > /* UTODO: */ \
> > - } \
> > - type = IS_UNICODE; \
> > - tmp = arKey = u; \
> > + } \
> > + type = IS_UNICODE; \
> > + tmp = arKey = u; \
> > }
> >
> >
> > @@ -1781,6 +1781,57 @@
> > p = p->pListLast;
> > }
> > }
> > +
> > +ZEND_API void zend_hash_to_unicode(HashTable *ht, apply_func_t
> > +apply_func TSRMLS_DC) {
> > + Bucket **p;
> > + uint nIndex;
> > +
> > + IS_CONSISTENT(ht);
> > + if (ht->unicode) {
> > + return;
> > + }
> > +
> > + ht->unicode = 1;
> > + memset(ht->arBuckets, 0, ht->nTableSize * sizeof(Bucket *));
> > + p = &ht->pListHead;
> > + while ((*p) != NULL) {
> > + if ((*p)->key.type == IS_STRING) {
> > + UErrorCode status = U_ZERO_ERROR;
> > + UChar *u = NULL;
> > + int32_t u_len;
> > + Bucket *q;
> > +
> > +
> >
> +zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)),
> > +&u, &u_len, (char*)(*p)->key.u.string, (*p)->nKeyLength-1,
> &status);
> > +
> > + q = (Bucket *)
> pemalloc(sizeof(Bucket)-sizeof(q->key.u)+((u_len+1)*2),
> ht->persistent);
> > + memcpy(q, *p, sizeof(Bucket)-sizeof(q->key.u));
> > + memcpy(q->key.u.unicode, u, (u_len+1)*2);
> > + q->key.type = IS_UNICODE;
> > + q->nKeyLength = u_len+1;
> > + q->h =
> zend_u_inline_hash_func(IS_UNICODE, (void*)q->key.u.unicode,
> q->nKeyLength);
> > + if ((*p)->pData == &(*p)->pDataPtr) {
> > + q->pData = &q->pDataPtr;
> > + }
> > + efree(u);
> > + pefree(*p, ht->persistent);
> > + *p = q;
> > + if (q->pListNext) {
> > + q->pListNext->pListLast = q;
> > + } else {
> > + ht->pListTail = q;
> > + }
> > + }
> > + nIndex = (*p)->h & ht->nTableMask;
> > + CONNECT_TO_BUCKET_DLLIST(*p, ht->arBuckets[nIndex]);
> > + ht->arBuckets[nIndex] = *p;
> > + if (apply_func) {
> > + apply_func((*p)->pData TSRMLS_CC);
> > + }
> > + p = &(*p)->pListNext;
> > + }
> > +}
> > +
> > #endif
>
> Hi, ^^^^^ above endif is misplaced, and prevents build
> without --enable-debug.
>
> Regards,
> --
> Michael - <mike(@)php.net>
> http://dev.iworks.at/ext-http/http-functions.html.gz
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>