~ubuntu-branches/ubuntu/quantal/libxml2/quantal-security

« back to all changes in this revision

Viewing changes to HTMLtree.c

  • Committer: Package Import Robot
  • Author(s): Iain Lane
  • Date: 2012-06-25 13:14:43 UTC
  • mfrom: (43.1.10 sid)
  • Revision ID: package-import@ubuntu.com-20120625131443-t0pb8n237uaz4z30
Tags: 2.8.0+dfsg1-4ubuntu1
* Merge with Debian (LP: #987502), remaining changes:
  - Don't drop *.la file. Some libraries still depend on it.

Show diffs side-by-side

added added

removed removed

Lines of Context:
151
151
 * htmlSetMetaEncoding:
152
152
 * @doc:  the document
153
153
 * @encoding:  the encoding string
154
 
 * 
 
154
 *
155
155
 * Sets the current encoding in the Meta tags
156
156
 * NOTE: this will not change the document content encoding, just
157
157
 * the META flag associated.
164
164
    const xmlChar *content = NULL;
165
165
    char newcontent[100];
166
166
 
 
167
    newcontent[0] = 0;
167
168
 
168
169
    if (doc == NULL)
169
170
        return(-1);
244
245
                            http = 1;
245
246
                        else
246
247
                        {
247
 
                           if ((value != NULL) && 
 
248
                           if ((value != NULL) &&
248
249
                               (!xmlStrcasecmp(attr->name, BAD_CAST"content")))
249
250
                               content = value;
250
251
                        }
278
279
            xmlNewProp(meta, BAD_CAST"content", BAD_CAST newcontent);
279
280
        }
280
281
    } else {
 
282
        /* remove the meta tag if NULL is passed */
 
283
        if (encoding == NULL) {
 
284
            xmlUnlinkNode(meta);
 
285
            xmlFreeNode(meta);
 
286
        }
281
287
        /* change the document only if there is a real encoding change */
282
 
        if (xmlStrcasestr(content, encoding) == NULL) {
 
288
        else if (xmlStrcasestr(content, encoding) == NULL) {
283
289
            xmlSetProp(meta, BAD_CAST"content", BAD_CAST newcontent);
284
290
        }
285
291
    }
481
487
        if (enc != XML_CHAR_ENCODING_UTF8) {
482
488
            handler = xmlFindCharEncodingHandler(encoding);
483
489
            if (handler == NULL)
484
 
                return(-1);
 
490
                htmlSaveErr(XML_SAVE_UNKNOWN_ENCODING, NULL, encoding);
485
491
        }
486
492
    }
487
493
 
562
568
            }
563
569
 
564
570
            handler = xmlFindCharEncodingHandler(encoding);
565
 
            if (handler == NULL) {
566
 
                *mem = NULL;
567
 
                *size = 0;
568
 
                return;
569
 
            }
 
571
            if (handler == NULL)
 
572
                htmlSaveErr(XML_SAVE_UNKNOWN_ENCODING, NULL, encoding);
 
573
 
570
574
        } else {
571
575
            handler = xmlFindCharEncodingHandler(encoding);
572
576
        }
587
591
        return;
588
592
    }
589
593
 
590
 
        htmlDocContentDumpFormatOutput(buf, cur, NULL, format);
 
594
    htmlDocContentDumpFormatOutput(buf, cur, NULL, format);
591
595
 
592
596
    xmlOutputBufferFlush(buf);
593
597
    if (buf->conv != NULL) {
1061
1065
 
1062
1066
            handler = xmlFindCharEncodingHandler(encoding);
1063
1067
            if (handler == NULL)
1064
 
                return(-1);
 
1068
                htmlSaveErr(XML_SAVE_UNKNOWN_ENCODING, NULL, encoding);
1065
1069
        } else {
1066
1070
            handler = xmlFindCharEncodingHandler(encoding);
1067
1071
        }
1120
1124
 
1121
1125
            handler = xmlFindCharEncodingHandler(encoding);
1122
1126
            if (handler == NULL)
1123
 
                return(-1);
 
1127
                htmlSaveErr(XML_SAVE_UNKNOWN_ENCODING, NULL, encoding);
1124
1128
        }
1125
1129
    }
1126
1130
 
1181
1185
 
1182
1186
            handler = xmlFindCharEncodingHandler(encoding);
1183
1187
            if (handler == NULL)
1184
 
                return(-1);
 
1188
                htmlSaveErr(XML_SAVE_UNKNOWN_ENCODING, NULL, encoding);
1185
1189
        }
1186
1190
        htmlSetMetaEncoding(cur, (const xmlChar *) encoding);
1187
1191
    } else {