aboutsummaryrefslogtreecommitdiffstats
path: root/entities.c
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@src.gnome.org>2000-07-14 14:49:25 +0000
committerDaniel Veillard <veillard@src.gnome.org>2000-07-14 14:49:25 +0000
commit32bc74ef98c7bd6172327fb03f68766f6ee4b6a2 (patch)
treeddef7c9058df5c69694c2de2f6ae3be6eb966f65 /entities.c
parent8d86964a4aa0f89344ba2065830ad30e6d0e0d47 (diff)
downloadandroid_external_libxml2-32bc74ef98c7bd6172327fb03f68766f6ee4b6a2.tar.gz
android_external_libxml2-32bc74ef98c7bd6172327fb03f68766f6ee4b6a2.tar.bz2
android_external_libxml2-32bc74ef98c7bd6172327fb03f68766f6ee4b6a2.zip
- doc/encoding.html doc/xml.html: added I18N doc
- encoding.[ch] HTMLtree.[ch] parser.c HTMLparser.c: I18N encoding improvements, both parser and filters, added ASCII & HTML, fixed the ISO-Latin-1 one - xmllint.c testHTML.c: added/made visible --encode - debugXML.c : cleanup - most .c files: applied patches due to warning on Windows and when using Sun Pro cc compiler - xpath.c : cleanup memleaks - nanoftp.c : added a TESTING preprocessor flag for standalong compile so that people can report bugs more easilly - nanohttp.c : ditched socklen_t which was a portability mess and replaced it with unsigned int. - tree.[ch]: added xmlHasProp() - TODO: updated - test/ : added more test for entities, NS, encoding, HTML, wap - configure.in: preparing for 2.2.0 release Daniel
Diffstat (limited to 'entities.c')
-rw-r--r--entities.c26
1 files changed, 6 insertions, 20 deletions
diff --git a/entities.c b/entities.c
index c541d679..75059433 100644
--- a/entities.c
+++ b/entities.c
@@ -128,7 +128,7 @@ xmlAddEntity(xmlEntitiesTablePtr table, const xmlChar *name, int type,
* fill the structure.
*/
ret->name = xmlStrdup(name);
- ret->etype = type;
+ ret->etype = (xmlEntityType) type;
if (ExternalID != NULL)
ret->ExternalID = xmlStrdup(ExternalID);
if (SystemID != NULL)
@@ -754,9 +754,6 @@ xmlEncodeEntities(xmlDocPtr doc, const xmlChar *input) {
* Contrary to xmlEncodeEntities, this routine is reentrant, and result
* must be deallocated.
*
- * TODO !!!! Once moved to UTF-8 internal encoding, the encoding of non-ascii
- * get erroneous.
- *
* Returns A newly allocated string with the substitution done.
*/
xmlChar *
@@ -832,20 +829,7 @@ xmlEncodeEntitiesReentrant(xmlDocPtr doc, const xmlChar *input) {
*/
*out++ = *cur;
} else if (*cur >= 0x80) {
- if (html) {
- char buf[15], *ptr;
-
- /*
- * TODO: improve by searching in html40EntitiesTable
- */
-#ifdef HAVE_SNPRINTF
- snprintf(buf, 9, "&#%d;", *cur);
-#else
- sprintf(buf, "&#%d;", *cur);
-#endif
- ptr = buf;
- while (*ptr != 0) *out++ = *ptr++;
- } else if (doc->encoding != NULL) {
+ if ((doc->encoding != NULL) || (html)) {
/*
* TODO !!!
*/
@@ -900,6 +884,7 @@ xmlEncodeEntitiesReentrant(xmlDocPtr doc, const xmlChar *input) {
#else
sprintf(buf, "&#%d;", *cur);
#endif
+ buf[9] = 0;
ptr = buf;
while (*ptr != 0) *out++ = *ptr++;
cur++;
@@ -909,11 +894,11 @@ xmlEncodeEntitiesReentrant(xmlDocPtr doc, const xmlChar *input) {
* We could do multiple things here. Just save as a char ref
*/
#ifdef HAVE_SNPRINTF
- snprintf(buf, 14, "&#x%X;", val);
+ snprintf(buf, 9, "&#x%X;", val);
#else
sprintf(buf, "&#x%X;", val);
#endif
- buf[14] = 0;
+ buf[9] = 0;
ptr = buf;
while (*ptr != 0) *out++ = *ptr++;
cur += l;
@@ -927,6 +912,7 @@ xmlEncodeEntitiesReentrant(xmlDocPtr doc, const xmlChar *input) {
#else
sprintf(buf, "&#%d;", *cur);
#endif
+ buf[9] = 0;
ptr = buf;
while (*ptr != 0) *out++ = *ptr++;
}