Skip to content

Commit ae70a4e

Browse files
committed
few ws fixes.
1 parent df43107 commit ae70a4e

File tree

1 file changed

+23
-33
lines changed

1 file changed

+23
-33
lines changed

ext/standard/html.c

Lines changed: 23 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ inline static unsigned short get_next_char(enum entity_charset charset,
336336

337337
MB_WRITE((unsigned char)this_char);
338338

339-
switch(charset) {
339+
switch (charset) {
340340
case cs_utf_8:
341341
{
342342
unsigned long utf = 0;
@@ -350,9 +350,8 @@ inline static unsigned short get_next_char(enum entity_charset charset,
350350
if (this_char < 0x80) {
351351
more = 0;
352352
break;
353-
}
354-
else if (this_char < 0xc0) {
355-
switch(stat) {
353+
} else if (this_char < 0xc0) {
354+
switch (stat) {
356355
case 0x10: /* 2, 2nd */
357356
case 0x21: /* 3, 3rd */
358357
case 0x32: /* 4, 4th */
@@ -416,7 +415,7 @@ inline static unsigned short get_next_char(enum entity_charset charset,
416415
this_char = str[pos++];
417416
MB_WRITE((unsigned char)this_char);
418417
}
419-
} while(more);
418+
} while (more);
420419
}
421420
break;
422421
case cs_big5:
@@ -428,8 +427,7 @@ inline static unsigned short get_next_char(enum entity_charset charset,
428427
/* peek at the next char */
429428
unsigned char next_char = str[pos];
430429
if ((next_char >= 0x40 && next_char <= 0x73) ||
431-
(next_char >= 0xa1 && next_char <= 0xfe))
432-
{
430+
(next_char >= 0xa1 && next_char <= 0xfe)) {
433431
/* yes, this a wide char */
434432
this_char <<= 8;
435433
MB_WRITE(next_char);
@@ -467,8 +465,7 @@ inline static unsigned short get_next_char(enum entity_charset charset,
467465
if (this_char >= 0xa1 && this_char <= 0xfe) {
468466
/* peek at the next char */
469467
unsigned char next_char = str[pos];
470-
if (next_char >= 0xa1 && next_char <= 0xfe)
471-
{
468+
if (next_char >= 0xa1 && next_char <= 0xfe) {
472469
/* yes, this a jis kanji char */
473470
this_char <<= 8;
474471
MB_WRITE(next_char);
@@ -479,8 +476,7 @@ inline static unsigned short get_next_char(enum entity_charset charset,
479476
} else if (this_char == 0x8e) {
480477
/* peek at the next char */
481478
unsigned char next_char = str[pos];
482-
if (next_char >= 0xa1 && next_char <= 0xdf)
483-
{
479+
if (next_char >= 0xa1 && next_char <= 0xdf) {
484480
/* JIS X 0201 kana */
485481
this_char <<= 8;
486482
MB_WRITE(next_char);
@@ -493,8 +489,7 @@ inline static unsigned short get_next_char(enum entity_charset charset,
493489
unsigned char next_char = str[pos];
494490
unsigned char next2_char = str[pos+1];
495491
if ((next_char >= 0xa1 && next_char <= 0xfe) &&
496-
(next2_char >= 0xa1 && next2_char <= 0xfe))
497-
{
492+
(next2_char >= 0xa1 && next2_char <= 0xfe)) {
498493
/* JIS X 0212 hojo-kanji */
499494
this_char <<= 8;
500495
MB_WRITE(next_char);
@@ -510,9 +505,7 @@ inline static unsigned short get_next_char(enum entity_charset charset,
510505
break;
511506
}
512507
default:
513-
{
514-
break;
515-
}
508+
break;
516509
}
517510
MB_RETURN;
518511
}
@@ -537,8 +530,7 @@ static enum entity_charset determine_charset(char *charset_hint TSRMLS_DC)
537530
charset_hint = nl_langinfo(CODESET);
538531
#endif
539532
#if HAVE_LOCALE_H
540-
if (charset_hint == NULL)
541-
{
533+
if (charset_hint == NULL) {
542534
/* try to figure out the charset from the locale */
543535
char *localename;
544536
char *dot, *at;
@@ -547,7 +539,7 @@ static enum entity_charset determine_charset(char *charset_hint TSRMLS_DC)
547539
localename = setlocale(LC_CTYPE, NULL);
548540

549541
dot = strchr(localename, '.');
550-
if (dot) {
542+
if (dot) {
551543
dot++;
552544
/* locale specifies a codeset */
553545
at = strchr(dot, '@');
@@ -556,22 +548,20 @@ static enum entity_charset determine_charset(char *charset_hint TSRMLS_DC)
556548
else
557549
len = strlen(dot);
558550
charset_hint = dot;
559-
}
560-
else {
551+
} else {
561552
/* no explicit name; see if the name itself
562553
* is the charset */
563554
charset_hint = localename;
564555
len = strlen(charset_hint);
565556
}
566-
}
567-
else
557+
} else
568558
len = strlen(charset_hint);
569559
#else
570560
if (charset_hint)
571561
len = strlen(charset_hint);
572562
#endif
573563
}
574-
if (charset_hint) {
564+
if (charset_hint) {
575565
int found = 0;
576566
if (!len)
577567
len = strlen(charset_hint);
@@ -606,13 +596,13 @@ PHPAPI char *php_unescape_html_entities(unsigned char *old, int oldlen, int *new
606596
ret = estrdup(old);
607597
retlen = oldlen;
608598

609-
if (all) {
599+
if (all) {
610600
/* 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++) {
612602
if (entity_map[j].charset != charset)
613603
continue;
614604

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++) {
616606
unsigned char entity[32];
617607
int entity_length = 0;
618608

@@ -628,8 +618,9 @@ PHPAPI char *php_unescape_html_entities(unsigned char *old, int oldlen, int *new
628618
entity_length += 2;
629619

630620
/* When we have MBCS entities in the tables above, this will need to handle it */
631-
if (k > 0xff)
621+
if (k > 0xff) {
632622
zend_error(E_WARNING, "cannot yet handle MBCS in html_entity_decode()!");
623+
}
633624
replacement[0] = k;
634625
replacement[1] = '\0';
635626

@@ -692,7 +683,7 @@ PHPAPI char *php_escape_html_entities(unsigned char *old, int oldlen, int *newle
692683
unsigned char *rep;
693684

694685

695-
for (j=0; entity_map[j].charset != cs_terminator; j++) {
686+
for (j = 0; entity_map[j].charset != cs_terminator; j++) {
696687
if (entity_map[j].charset == charset
697688
&& this_char >= entity_map[j].basechar
698689
&& this_char <= entity_map[j].endchar)
@@ -840,11 +831,10 @@ PHP_FUNCTION(get_html_translation_table)
840831

841832
switch (which) {
842833
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++) {
844835
if (entity_map[j].charset != charset)
845836
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++) {
848838
char buffer[16];
849839

850840
if (entity_map[j].table[i] == NULL)
@@ -859,7 +849,7 @@ PHP_FUNCTION(get_html_translation_table)
859849
/* break thru */
860850

861851
case HTML_SPECIALCHARS:
862-
for (j = 0; basic_entities[j].charcode != 0; j++) {
852+
for (j = 0; basic_entities[j].charcode != 0; j++) {
863853

864854
if (basic_entities[j].flags && (quote_style & basic_entities[j].flags) == 0)
865855
continue;

0 commit comments

Comments
 (0)