Diff for /embedaddon/libxml2/xmlwriter.c between versions 1.1.1.1 and 1.1.1.2

version 1.1.1.1, 2012/02/21 23:37:58 version 1.1.1.2, 2014/06/15 19:53:28
Line 21 Line 21
   
 #include <libxml/xmlwriter.h>  #include <libxml/xmlwriter.h>
   
   #include "buf.h"
   #include "enc.h"
   #include "save.h"
   
 #define B64LINELEN 72  #define B64LINELEN 72
 #define B64CRLF "\r\n"  #define B64CRLF "\r\n"
   
Line 548  xmlTextWriterStartDocument(xmlTextWriterPtr writer, co Line 552  xmlTextWriterStartDocument(xmlTextWriterPtr writer, co
     writer->out->encoder = encoder;      writer->out->encoder = encoder;
     if (encoder != NULL) {      if (encoder != NULL) {
         if (writer->out->conv == NULL) {          if (writer->out->conv == NULL) {
            writer->out->conv = xmlBufferCreateSize(4000);            writer->out->conv = xmlBufCreateSize(4000);
         }          }
        xmlCharEncOutFunc(encoder, writer->out->conv, NULL);        xmlCharEncOutput(writer->out, 1);
         if ((writer->doc != NULL) && (writer->doc->encoding == NULL))          if ((writer->doc != NULL) && (writer->doc->encoding == NULL))
             writer->doc->encoding = xmlStrdup((xmlChar *)writer->out->encoder->name);              writer->doc->encoding = xmlStrdup((xmlChar *)writer->out->encoder->name);
     } else      } else
Line 1074  xmlTextWriterStartElementNS(xmlTextWriterPtr writer, Line 1078  xmlTextWriterStartElementNS(xmlTextWriterPtr writer,
     sum += count;      sum += count;
   
     if (namespaceURI != 0) {      if (namespaceURI != 0) {
        xmlTextWriterNsStackEntry *p = (xmlTextWriterNsStackEntry *)         xmlTextWriterNsStackEntry *p = (xmlTextWriterNsStackEntry *)
         xmlMalloc(sizeof(xmlTextWriterNsStackEntry));          xmlMalloc(sizeof(xmlTextWriterNsStackEntry));
         if (p == 0) {          if (p == 0) {
            xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,             xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
                             "xmlTextWriterStartElementNS : out of memory!\n");                              "xmlTextWriterStartElementNS : out of memory!\n");
             return -1;              return -1;
         }          }
Line 1501  xmlTextWriterWriteString(xmlTextWriterPtr writer, cons Line 1505  xmlTextWriterWriteString(xmlTextWriterPtr writer, cons
                     break;                      break;
                 case XML_TEXTWRITER_ATTRIBUTE:                  case XML_TEXTWRITER_ATTRIBUTE:
                     buf = NULL;                      buf = NULL;
                    xmlAttrSerializeTxtContent(writer->out->buffer, writer->doc,                    xmlBufAttrSerializeTxtContent(writer->out->buffer,
                                               NULL, content);                                                  writer->doc, NULL, content);
                     break;                      break;
                 default:                  default:
                     break;                      break;
Line 1663  xmlTextWriterWriteBase64(xmlTextWriterPtr writer, cons Line 1667  xmlTextWriterWriteBase64(xmlTextWriterPtr writer, cons
  * Write hqx encoded data to an xmlOutputBuffer.   * Write hqx encoded data to an xmlOutputBuffer.
  * ::todo   * ::todo
  *   *
 * Returns the bytes written (may be 0 because of buffering)  * Returns the bytes written (may be 0 because of buffering)
  * or -1 in case of error   * or -1 in case of error
  */   */
 static int  static int
Line 1672  xmlOutputBufferWriteBinHex(xmlOutputBufferPtr out, Line 1676  xmlOutputBufferWriteBinHex(xmlOutputBufferPtr out,
 {  {
     int count;      int count;
     int sum;      int sum;
    static char hex[16] =     static char hex[16] =
        {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};        {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
     int i;      int i;
   
     if ((out == NULL) || (data == NULL) || (len < 0)) {      if ((out == NULL) || (data == NULL) || (len < 0)) {
Line 1849  xmlTextWriterStartAttributeNS(xmlTextWriterPtr writer, Line 1853  xmlTextWriterStartAttributeNS(xmlTextWriterPtr writer,
         nsentry.uri = (xmlChar *)namespaceURI;          nsentry.uri = (xmlChar *)namespaceURI;
         nsentry.elem = xmlListFront(writer->nodes);          nsentry.elem = xmlListFront(writer->nodes);
   
        curns = (xmlTextWriterNsStackEntry *)xmlListSearch(writer->nsstack,         curns = (xmlTextWriterNsStackEntry *)xmlListSearch(writer->nsstack,
                                                            (void *)&nsentry);                                                             (void *)&nsentry);
         if ((curns != NULL)) {          if ((curns != NULL)) {
             xmlFree(buf);              xmlFree(buf);
Line 2496  xmlTextWriterEndPI(xmlTextWriterPtr writer) Line 2500  xmlTextWriterEndPI(xmlTextWriterPtr writer)
   
     if (writer->indent) {      if (writer->indent) {
         count = xmlOutputBufferWriteString(writer->out, "\n");          count = xmlOutputBufferWriteString(writer->out, "\n");
        if (count < 0)        if (count < 0)
        return -1;        return -1;
         sum += count;          sum += count;
     }      }
   
Line 4603  xmlTextWriterSetIndentString(xmlTextWriterPtr writer,  Line 4607  xmlTextWriterSetIndentString(xmlTextWriterPtr writer, 
         return -1;          return -1;
     else      else
         return 0;          return 0;
   }
   
   /**
    * xmlTextWriterSetQuoteChar:
    * @writer:  the xmlTextWriterPtr
    * @quotechar:  the quote character
    *
    * Set the character used for quoting attributes.
    *
    * Returns -1 on error or 0 otherwise.
    */
   int
   xmlTextWriterSetQuoteChar(xmlTextWriterPtr writer, xmlChar quotechar)
   {
       if ((writer == NULL) || ((quotechar != '\'') && (quotechar != '"')))
           return -1;
   
       writer->qchar = quotechar;
   
       return 0;
 }  }
   
 /**  /**

Removed from v.1.1.1.1  
changed lines
  Added in v.1.1.1.2


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>