@@ -265,13 +265,15 @@ static const char *const NamedEntities[][2] = {
265
265
{ "zwj;" ,"\xE2\x80\x8D" },
266
266
{ "zwnj;" ,"\xE2\x80\x8C" }
267
267
};
268
+
268
269
static int stringCompare (const void * key ,const void * value ) {
269
270
return strncmp (
270
271
(const char * ) key ,
271
272
* (const char * const * ) value ,
272
273
strlen (* (const char * const * )value )
273
274
);
274
275
}
276
+
275
277
static const char * getNamedEntity (const char * name ) {
276
278
const char * const * entity = (const char * const * )
277
279
bsearch (
@@ -281,6 +283,7 @@ static const char *getNamedEntity(const char *name) {
281
283
);
282
284
return entity ? entity [1 ] : NULL ;
283
285
}
286
+
284
287
static size_t putUtf8Char (unsigned long value ,char * buffer ) {
285
288
unsigned char * bytes = (unsigned char * ) buffer ;
286
289
if (value <= 0x007Ful ) {
@@ -343,6 +346,7 @@ static size_t putUtf8Char(unsigned long value,char *buffer) {
343
346
}
344
347
return 0 ;
345
348
}
349
+
346
350
static int parseEntity (const char * current ,char * * to ,const char * * from ) {
347
351
const char * end = strchr (current ,59 );
348
352
if (!end ) {
@@ -375,6 +379,7 @@ static int parseEntity(const char *current,char **to,const char **from) {
375
379
return 1 ;
376
380
}
377
381
}
382
+
378
383
// 4bit
379
384
// const char asciiHex[23] = {
380
385
// 0,
@@ -401,12 +406,14 @@ static int parseEntity(const char *current,char **to,const char **from) {
401
406
// 14,
402
407
// 15
403
408
// };
409
+
404
410
// static inline char toUpper(char c) {
405
411
// if((c >= 97) && (c <= 122)) {//a,z
406
412
// return c ^ 0x20;//fast way
407
413
// }
408
414
// return c;
409
415
// }
416
+
410
417
// char *urlDecode(const char *str) {
411
418
// size_t i,j,len = strlen(str);
412
419
// char c,d,url_hex;
@@ -467,6 +474,7 @@ static int parseEntity(const char *current,char **to,const char **from) {
467
474
// decoded[j] = 0;
468
475
// return decoded;
469
476
// }
477
+
470
478
size_t decodeHtmlEntities (char * destination ,const char * source ) {
471
479
if (!source ) {
472
480
source = destination ;
@@ -488,6 +496,7 @@ size_t decodeHtmlEntities(char *destination,const char *source) {
488
496
* to = 0 ;
489
497
return (size_t )(to - destination );
490
498
}
499
+
491
500
void decodeUrl (char * destination ,const char * source ) {
492
501
char x ,y ;
493
502
while (* source ) {
0 commit comments