@@ -336,7 +336,7 @@ inline static unsigned short get_next_char(enum entity_charset charset,
336
336
337
337
MB_WRITE ((unsigned char )this_char );
338
338
339
- switch (charset ) {
339
+ switch (charset ) {
340
340
case cs_utf_8 :
341
341
{
342
342
unsigned long utf = 0 ;
@@ -350,9 +350,8 @@ inline static unsigned short get_next_char(enum entity_charset charset,
350
350
if (this_char < 0x80 ) {
351
351
more = 0 ;
352
352
break ;
353
- }
354
- else if (this_char < 0xc0 ) {
355
- switch (stat ) {
353
+ } else if (this_char < 0xc0 ) {
354
+ switch (stat ) {
356
355
case 0x10 : /* 2, 2nd */
357
356
case 0x21 : /* 3, 3rd */
358
357
case 0x32 : /* 4, 4th */
@@ -416,7 +415,7 @@ inline static unsigned short get_next_char(enum entity_charset charset,
416
415
this_char = str [pos ++ ];
417
416
MB_WRITE ((unsigned char )this_char );
418
417
}
419
- } while (more );
418
+ } while (more );
420
419
}
421
420
break ;
422
421
case cs_big5 :
@@ -428,8 +427,7 @@ inline static unsigned short get_next_char(enum entity_charset charset,
428
427
/* peek at the next char */
429
428
unsigned char next_char = str [pos ];
430
429
if ((next_char >= 0x40 && next_char <= 0x73 ) ||
431
- (next_char >= 0xa1 && next_char <= 0xfe ))
432
- {
430
+ (next_char >= 0xa1 && next_char <= 0xfe )) {
433
431
/* yes, this a wide char */
434
432
this_char <<= 8 ;
435
433
MB_WRITE (next_char );
@@ -467,8 +465,7 @@ inline static unsigned short get_next_char(enum entity_charset charset,
467
465
if (this_char >= 0xa1 && this_char <= 0xfe ) {
468
466
/* peek at the next char */
469
467
unsigned char next_char = str [pos ];
470
- if (next_char >= 0xa1 && next_char <= 0xfe )
471
- {
468
+ if (next_char >= 0xa1 && next_char <= 0xfe ) {
472
469
/* yes, this a jis kanji char */
473
470
this_char <<= 8 ;
474
471
MB_WRITE (next_char );
@@ -479,8 +476,7 @@ inline static unsigned short get_next_char(enum entity_charset charset,
479
476
} else if (this_char == 0x8e ) {
480
477
/* peek at the next char */
481
478
unsigned char next_char = str [pos ];
482
- if (next_char >= 0xa1 && next_char <= 0xdf )
483
- {
479
+ if (next_char >= 0xa1 && next_char <= 0xdf ) {
484
480
/* JIS X 0201 kana */
485
481
this_char <<= 8 ;
486
482
MB_WRITE (next_char );
@@ -493,8 +489,7 @@ inline static unsigned short get_next_char(enum entity_charset charset,
493
489
unsigned char next_char = str [pos ];
494
490
unsigned char next2_char = str [pos + 1 ];
495
491
if ((next_char >= 0xa1 && next_char <= 0xfe ) &&
496
- (next2_char >= 0xa1 && next2_char <= 0xfe ))
497
- {
492
+ (next2_char >= 0xa1 && next2_char <= 0xfe )) {
498
493
/* JIS X 0212 hojo-kanji */
499
494
this_char <<= 8 ;
500
495
MB_WRITE (next_char );
@@ -510,9 +505,7 @@ inline static unsigned short get_next_char(enum entity_charset charset,
510
505
break ;
511
506
}
512
507
default :
513
- {
514
- break ;
515
- }
508
+ break ;
516
509
}
517
510
MB_RETURN ;
518
511
}
@@ -537,8 +530,7 @@ static enum entity_charset determine_charset(char *charset_hint TSRMLS_DC)
537
530
charset_hint = nl_langinfo (CODESET );
538
531
#endif
539
532
#if HAVE_LOCALE_H
540
- if (charset_hint == NULL )
541
- {
533
+ if (charset_hint == NULL ) {
542
534
/* try to figure out the charset from the locale */
543
535
char * localename ;
544
536
char * dot , * at ;
@@ -547,7 +539,7 @@ static enum entity_charset determine_charset(char *charset_hint TSRMLS_DC)
547
539
localename = setlocale (LC_CTYPE , NULL );
548
540
549
541
dot = strchr (localename , '.' );
550
- if (dot ) {
542
+ if (dot ) {
551
543
dot ++ ;
552
544
/* locale specifies a codeset */
553
545
at = strchr (dot , '@' );
@@ -556,22 +548,20 @@ static enum entity_charset determine_charset(char *charset_hint TSRMLS_DC)
556
548
else
557
549
len = strlen (dot );
558
550
charset_hint = dot ;
559
- }
560
- else {
551
+ } else {
561
552
/* no explicit name; see if the name itself
562
553
* is the charset */
563
554
charset_hint = localename ;
564
555
len = strlen (charset_hint );
565
556
}
566
- }
567
- else
557
+ } else
568
558
len = strlen (charset_hint );
569
559
#else
570
560
if (charset_hint )
571
561
len = strlen (charset_hint );
572
562
#endif
573
563
}
574
- if (charset_hint ) {
564
+ if (charset_hint ) {
575
565
int found = 0 ;
576
566
if (!len )
577
567
len = strlen (charset_hint );
@@ -606,13 +596,13 @@ PHPAPI char *php_unescape_html_entities(unsigned char *old, int oldlen, int *new
606
596
ret = estrdup (old );
607
597
retlen = oldlen ;
608
598
609
- if (all ) {
599
+ if (all ) {
610
600
/* look for a match in the maps for this charset */
611
- for (j = 0 ; entity_map [j ].charset != cs_terminator ; j ++ ) {
601
+ for (j = 0 ; entity_map [j ].charset != cs_terminator ; j ++ ) {
612
602
if (entity_map [j ].charset != charset )
613
603
continue ;
614
604
615
- for (k = entity_map [j ].basechar ; k <= entity_map [j ].endchar ; k ++ ) {
605
+ for (k = entity_map [j ].basechar ; k <= entity_map [j ].endchar ; k ++ ) {
616
606
unsigned char entity [32 ];
617
607
int entity_length = 0 ;
618
608
@@ -628,8 +618,9 @@ PHPAPI char *php_unescape_html_entities(unsigned char *old, int oldlen, int *new
628
618
entity_length += 2 ;
629
619
630
620
/* When we have MBCS entities in the tables above, this will need to handle it */
631
- if (k > 0xff )
621
+ if (k > 0xff ) {
632
622
zend_error (E_WARNING , "cannot yet handle MBCS in html_entity_decode()!" );
623
+ }
633
624
replacement [0 ] = k ;
634
625
replacement [1 ] = '\0' ;
635
626
@@ -692,7 +683,7 @@ PHPAPI char *php_escape_html_entities(unsigned char *old, int oldlen, int *newle
692
683
unsigned char * rep ;
693
684
694
685
695
- for (j = 0 ; entity_map [j ].charset != cs_terminator ; j ++ ) {
686
+ for (j = 0 ; entity_map [j ].charset != cs_terminator ; j ++ ) {
696
687
if (entity_map [j ].charset == charset
697
688
&& this_char >= entity_map [j ].basechar
698
689
&& this_char <= entity_map [j ].endchar )
@@ -840,11 +831,10 @@ PHP_FUNCTION(get_html_translation_table)
840
831
841
832
switch (which ) {
842
833
case HTML_ENTITIES :
843
- for (j = 0 ; entity_map [j ].charset != cs_terminator ; j ++ ) {
834
+ for (j = 0 ; entity_map [j ].charset != cs_terminator ; j ++ ) {
844
835
if (entity_map [j ].charset != charset )
845
836
continue ;
846
- for (i = 0 ; i <= entity_map [j ].endchar - entity_map [j ].basechar ; i ++ )
847
- {
837
+ for (i = 0 ; i <= entity_map [j ].endchar - entity_map [j ].basechar ; i ++ ) {
848
838
char buffer [16 ];
849
839
850
840
if (entity_map [j ].table [i ] == NULL )
@@ -859,7 +849,7 @@ PHP_FUNCTION(get_html_translation_table)
859
849
/* break thru */
860
850
861
851
case HTML_SPECIALCHARS :
862
- for (j = 0 ; basic_entities [j ].charcode != 0 ; j ++ ) {
852
+ for (j = 0 ; basic_entities [j ].charcode != 0 ; j ++ ) {
863
853
864
854
if (basic_entities [j ].flags && (quote_style & basic_entities [j ].flags ) == 0 )
865
855
continue ;
0 commit comments