@@ -265,13 +265,15 @@ static const char *const NamedEntities[][2] = {
265265 { "zwj;" ,"\xE2\x80\x8D" },
266266 { "zwnj;" ,"\xE2\x80\x8C" }
267267};
268+ 268269static int stringCompare (const void * key ,const void * value ) {
269270 return strncmp (
270271 (const char * ) key ,
271272 * (const char * const * ) value ,
272273 strlen (* (const char * const * )value )
273274 );
274275}
276+ 275277static const char * getNamedEntity (const char * name ) {
276278 const char * const * entity = (const char * const * )
277279 bsearch (
@@ -281,6 +283,7 @@ static const char *getNamedEntity(const char *name) {
281283 );
282284 return entity ? entity [1 ] : NULL ;
283285}
286+ 284287static size_t putUtf8Char (unsigned long value ,char * buffer ) {
285288 unsigned char * bytes = (unsigned char * ) buffer ;
286289 if (value <= 0x007Ful ) {
@@ -343,6 +346,7 @@ static size_t putUtf8Char(unsigned long value,char *buffer) {
343346 }
344347 return 0 ;
345348}
349+ 346350static int parseEntity (const char * current ,char * * to ,const char * * from ) {
347351 const char * end = strchr (current ,59 );
348352 if (!end ) {
@@ -375,6 +379,7 @@ static int parseEntity(const char *current,char **to,const char **from) {
375379 return 1 ;
376380 }
377381}
382+ 378383// 4bit
379384// const char asciiHex[23] = {
380385// 0,
@@ -401,12 +406,14 @@ static int parseEntity(const char *current,char **to,const char **from) {
401406// 14,
402407// 15
403408// };
409+ 404410// static inline char toUpper(char c) {
405411// if((c >= 97) && (c <= 122)) {//a,z
406412// return c ^ 0x20;//fast way
407413// }
408414// return c;
409415// }
416+ 410417// char *urlDecode(const char *str) {
411418// size_t i,j,len = strlen(str);
412419// char c,d,url_hex;
@@ -467,6 +474,7 @@ static int parseEntity(const char *current,char **to,const char **from) {
467474// decoded[j] = 0;
468475// return decoded;
469476// }
477+ 470478size_t decodeHtmlEntities (char * destination ,const char * source ) {
471479 if (!source ) {
472480 source = destination ;
@@ -488,6 +496,7 @@ size_t decodeHtmlEntities(char *destination,const char *source) {
488496 * to = 0 ;
489497 return (size_t )(to - destination );
490498}
499+ 491500void decodeUrl (char * destination ,const char * source ) {
492501 char x ,y ;
493502 while (* source ) {
0 commit comments