cvs: ZendEngine2 / zend_language_scanner.l

From: Date: Thu, 04 May 2006 21:44:54 +0000
Subject: cvs: ZendEngine2 / zend_language_scanner.l
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-4835@lists.php.net to get a copy of this message
andrei Thu May 4 21:44:54 2006 UTC Modified files: /ZendEngine2 zend_language_scanner.l Log: Don't use fixed size buffer in zend_uchar_from_uname(); http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_language_scanner.l?r1=1.152&r2=1.153&diff_format=u Index: ZendEngine2/zend_language_scanner.l diff -u ZendEngine2/zend_language_scanner.l:1.152 ZendEngine2/zend_language_scanner.l:1.153 --- ZendEngine2/zend_language_scanner.l:1.152 Thu Apr 13 13:48:40 2006 +++ ZendEngine2/zend_language_scanner.l Thu May 4 21:44:54 2006 @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_language_scanner.l,v 1.152 2006/04/13 13:48:40 dmitry Exp $ */ +/* $Id: zend_language_scanner.l,v 1.153 2006/05/04 21:44:54 andrei Exp $ */ #define yyleng SCNG(yy_leng) #define yytext SCNG(yy_text) @@ -370,15 +370,16 @@ } } -static inline int zend_uchar_from_uname(UChar *name, int name_len, UChar32 *c) +static inline int zend_uchar_from_uname(UChar *name, int name_len, UChar32 *c TSRMLS_DC) { UChar32 codepoint = 0; UErrorCode status = U_ZERO_ERROR; - char buf[128]; + char *buf; - u_UCharsToChars(name, buf, name_len); - buf[name_len] = 0; + buf = zend_unicode_to_ascii(name, name_len TSRMLS_CC); + if (!buf) return 0; codepoint = u_charFromName(U_UNICODE_CHAR_NAME, buf, &status); + efree(buf); if (U_SUCCESS(status)) { *c = codepoint; return 1; @@ -387,7 +388,7 @@ } } -static inline int zend_parse_charname_sequence(UChar **s, UChar *end, UChar32 *c) +static inline int zend_parse_charname_sequence(UChar **s, UChar *end, UChar32 *c TSRMLS_DC) { UChar *start; @@ -395,7 +396,7 @@ start = ++(*s); while ((*s)++ != end) { if (**s == '}') { - if (zend_uchar_from_uname(start, *s - start, c)) { + if (zend_uchar_from_uname(start, *s - start, c TSRMLS_CC)) { return 1; } else { /* safe, since *s points to '}' */ @@ -1073,7 +1074,7 @@ case 0x43: /*'C'*/ { UChar *p = s+1; - if (p < end && zend_parse_charname_sequence(&p, end, &codepoint)) { + if (p < end && zend_parse_charname_sequence(&p, end, &codepoint TSRMLS_CC)) { Z_USTRLEN_P(zendlval) -= p - s + 1; s = p; if (U_IS_BMP(codepoint)) { @@ -1195,7 +1196,7 @@ case 0x43: /*'C'*/ { UChar *p = s+1; - if (p < end && zend_parse_charname_sequence(&p, end, &codepoint)) { + if (p < end && zend_parse_charname_sequence(&p, end, &codepoint TSRMLS_CC)) { Z_USTRLEN_P(zendlval) -= p - s + 1; s = p; if (U_IS_BMP(codepoint)) {

« previous php.zend-engine.cvs (#4835) next »