cvs: php4 /ext/standard html.c
| From: | Wez Furlong | Date: | Sun, 25 Aug 2002 19:44:26 +0000 |
| Subject: | cvs: php4 /ext/standard html.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-13671@lists.php.net to get a copy of this message | ||
wez Sun Aug 25 15:44:26 2002 EDT
Modified files:
/php4/ext/standard html.c
Log:
WS
Index: php4/ext/standard/html.c
diff -u php4/ext/standard/html.c:1.48 php4/ext/standard/html.c:1.49
--- php4/ext/standard/html.c:1.48 Mon Jul 8 08:52:22 2002
+++ php4/ext/standard/html.c Sun Aug 25 15:44:25 2002
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: html.c,v 1.48 2002/07/08 12:52:22 derick Exp $ */
+/* $Id: html.c,v 1.49 2002/08/25 19:44:25 wez Exp $ */
#include "php.h"
#include "reg.h"
@@ -347,11 +347,11 @@
* Code stolen from the mbstring extension */
do {
- if (this_char < 0x80) {
+ if (this_char < 0x80) {
more = 0;
break;
}
- else if (this_char < 0xc0) {
+ else if (this_char < 0xc0) {
switch(stat) {
case 0x10: /* 2, 2nd */
case 0x21: /* 3, 3rd */
@@ -394,26 +394,25 @@
else if (this_char < 0xe0) {
stat = 0x10; /* 2 byte */
utf = (this_char & 0x1f) << 6;
- } else if (this_char < 0xf0) {
+ } else if (this_char < 0xf0) {
stat = 0x20; /* 3 byte */
utf = (this_char & 0xf) << 12;
} else if (this_char < 0xf8) {
stat = 0x30; /* 4 byte */
utf = (this_char & 0x7) << 18;
- } else if (this_char < 0xfc) {
+ } else if (this_char < 0xfc) {
stat = 0x40; /* 5 byte */
utf = (this_char & 0x3) << 24;
- } else if (this_char < 0xfe) {
+ } else if (this_char < 0xfe) {
stat = 0x50; /* 6 byte */
utf = (this_char & 0x1) << 30;
- }
- else {
+ } else {
/* invalid; bail */
more = 0;
break;
}
- if (more)
- {
+
+ if (more) {
this_char = str[pos++];
MB_WRITE((unsigned char)this_char);
}
@@ -425,7 +424,7 @@
case cs_big5hkscs:
{
/* check if this is the first of a 2-byte sequence */
- if (this_char >= 0xa1 && this_char <= 0xf9) {
+ if (this_char >= 0xa1 && this_char <= 0xf9) {
/* peek at the next char */
unsigned char next_char = str[pos];
if ((next_char >= 0x40 && next_char <= 0x73) ||
@@ -446,7 +445,7 @@
/* check if this is the first of a 2-byte sequence */
if ( (this_char >= 0x81 && this_char <= 0x9f) ||
(this_char >= 0xe0 && this_char <= 0xef)
- ) {
+ ) {
/* peek at the next char */
unsigned char next_char = str[pos];
if ((next_char >= 0x40 && next_char <= 0x7e) ||
@@ -465,7 +464,7 @@
case cs_eucjp:
{
/* check if this is the first of a multi-byte sequence */
- if (this_char >= 0xa1 && this_char <= 0xfe) {
+ if (this_char >= 0xa1 && this_char <= 0xfe) {
/* peek at the next char */
unsigned char next_char = str[pos];
if (next_char >= 0xa1 && next_char <= 0xfe)
@@ -477,7 +476,7 @@
pos++;
}
- } else if (this_char == 0x8e) {
+ } else if (this_char == 0x8e) {
/* peek at the next char */
unsigned char next_char = str[pos];
if (next_char >= 0xa1 && next_char <= 0xdf)
@@ -489,7 +488,7 @@
pos++;
}
- } else if (this_char == 0x8f) {
+ } else if (this_char == 0x8f) {
/* peek at the next two char */
unsigned char next_char = str[pos];
unsigned char next2_char = str[pos+1];
@@ -680,18 +679,18 @@
if (len + 9 > maxlen)
replaced = erealloc (replaced, maxlen += 128);
- if (all) {
+ if (all) {
/* look for a match in the maps for this charset */
unsigned char *rep;
- for (j=0; entity_map[j].charset != cs_terminator; j++) {
+ for (j=0; entity_map[j].charset != cs_terminator; j++) {
if (entity_map[j].charset == charset
&& this_char >= entity_map[j].basechar
&& this_char <= entity_map[j].endchar)
{
rep = (unsigned char*)entity_map[j].table[this_char - entity_map[j].basechar];
- if (rep == NULL) {
+ if (rep == NULL) {
/* there is no entity for this position; fall through and
* just output the character itself */
break;
@@ -702,17 +701,17 @@
}
}
- if (matches_map) {
+ if (matches_map) {
replaced[len++] = '&';
strcpy(replaced + len, rep);
len += strlen(rep);
replaced[len++] = ';';
}
}
- if (!matches_map) {
+ if (!matches_map) {
int is_basic = 0;
- for (j = 0; basic_entities[j].charcode != 0; j++) {
+ for (j = 0; basic_entities[j].charcode != 0; j++) {
if ((basic_entities[j].charcode != this_char) ||
(basic_entities[j].flags && (quote_style & basic_entities[j].flags) == 0))
continue;
@@ -724,18 +723,19 @@
break;
}
- if (!is_basic) {
- if (this_char > 0xff) {
+ if (!is_basic) {
+ if (this_char > 0xff) {
/* a wide char without a named entity; pass through the original sequence */
memcpy(replaced + len, mbsequence, mbseqlen);
len += mbseqlen;
- } else
- replaced [len++] = (unsigned char)this_char;
+ } else {
+ replaced[len++] = (unsigned char)this_char;
+ }
}
}
}
- replaced [len] = '\0';
+ replaced[len] = '\0';
*newlen = len;
return replaced;