cvs: php-src /ext/gd/libgd gdft.c

From: Date: Wed, 23 Aug 2006 20:21:35 +0000
Subject: cvs: php-src /ext/gd/libgd gdft.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-40077@lists.php.net to get a copy of this message
pajoye Wed Aug 23 20:21:35 2006 UTC Modified files: /php-src/ext/gd/libgd gdft.c Log: - add support for entities in hexadecimal format, like &copy; can be passed as &#169 or &#xA9; http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gdft.c?r1=1.36&r2=1.37&diff_format=u Index: php-src/ext/gd/libgd/gdft.c diff -u php-src/ext/gd/libgd/gdft.c:1.36 php-src/ext/gd/libgd/gdft.c:1.37 --- php-src/ext/gd/libgd/gdft.c:1.36 Sat Nov 20 13:09:45 2004 +++ php-src/ext/gd/libgd/gdft.c Wed Aug 23 20:21:34 2006 @@ -207,12 +207,28 @@ byte = *((unsigned char *) (str + 1)); if (byte == '#') { - for (i = 2; i < 8; i++) { - byte = *((unsigned char *) (str + i)); - if (byte >= '0' && byte <= '9') { - n = (n * 10) + (byte - '0'); - } else { - break; + byte = *((unsigned char *) (str + 2)); + if (byte == 'x' || byte == 'X') { + for (i = 3; i < 8; i++) { + byte = *((unsigned char *) (str + i)); + if (byte >= 'A' && byte <= 'F') + byte = byte - 'A' + 10; + else if (byte >= 'a' && byte <= 'f') + byte = byte - 'a' + 10; + else if (byte >= '0' && byte <= '9') + byte = byte - '0'; + else + break; + n = (n * 16) + byte; + } + } else { + for (i = 2; i < 8; i++) { + byte = *((unsigned char *) (str + i)); + if (byte >= '0' && byte <= '9') { + n = (n * 10) + (byte - '0'); + } else { + break; + } } } if (byte == ';') {

« previous php.cvs (#40077) next »