Diff for /embedaddon/libxml2/encoding.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, 2013/07/22 01:22:22
Line 1928  xmlCharEncFirstLineInt(xmlCharEncodingHandler *handler Line 1928  xmlCharEncFirstLineInt(xmlCharEncodingHandler *handler
     if (in == NULL) return(-1);      if (in == NULL) return(-1);
   
     /* calculate space available */      /* calculate space available */
    written = out->size - out->use;    written = out->size - out->use - 1; /* count '\0' */
     toconv = in->use;      toconv = in->use;
     /*      /*
      * echo '<?xml version="1.0" encoding="UCS4"?>' | wc -c => 38       * echo '<?xml version="1.0" encoding="UCS4"?>' | wc -c => 38
Line 2059  xmlCharEncInFunc(xmlCharEncodingHandler * handler, xml Line 2059  xmlCharEncInFunc(xmlCharEncodingHandler * handler, xml
     toconv = in->use;      toconv = in->use;
     if (toconv == 0)      if (toconv == 0)
         return (0);          return (0);
    written = out->size - out->use;    written = out->size - out->use -1; /* count '\0' */
     if (toconv * 2 >= written) {      if (toconv * 2 >= written) {
         xmlBufferGrow(out, out->size + toconv * 2);          xmlBufferGrow(out, out->size + toconv * 2);
         written = out->size - out->use - 1;          written = out->size - out->use - 1;
Line 2161  xmlCharEncOutFunc(xmlCharEncodingHandler *handler, xml Line 2161  xmlCharEncOutFunc(xmlCharEncodingHandler *handler, xml
     int writtentot = 0;      int writtentot = 0;
     int toconv;      int toconv;
     int output = 0;      int output = 0;
       int charref_len = 0;
   
     if (handler == NULL) return(-1);      if (handler == NULL) return(-1);
     if (out == NULL) return(-1);      if (out == NULL) return(-1);
Line 2242  retry: Line 2243  retry:
                 /*                  /*
                  * Can be a limitation of iconv                   * Can be a limitation of iconv
                  */                   */
                   charref_len = 0;
                 goto retry;                  goto retry;
             }              }
             ret = -3;              ret = -3;
Line 2262  retry: Line 2264  retry:
                 /*                  /*
                  * Can be a limitation of iconv                   * Can be a limitation of iconv
                  */                   */
                   charref_len = 0;
                 goto retry;                  goto retry;
             }              }
             ret = -3;              ret = -3;
Line 2305  retry: Line 2308  retry:
             int cur;              int cur;
   
             cur = xmlGetUTF8Char(utf, &len);              cur = xmlGetUTF8Char(utf, &len);
            if (cur > 0) {            if ((charref_len != 0) && (written < charref_len)) {
                 /*
                  * We attempted to insert a character reference and failed.
                  * Undo what was written and skip the remaining charref.
                  */
                 out->use -= written;
                 writtentot -= written;
                 xmlBufferShrink(in, charref_len - written);
                 charref_len = 0;
 
                 ret = -1;
                 break;
             } else if (cur > 0) {
                 xmlChar charref[20];                  xmlChar charref[20];
   
 #ifdef DEBUG_ENCODING  #ifdef DEBUG_ENCODING
Line 2321  retry: Line 2336  retry:
                  * and continue the transcoding phase, hoping the error                   * and continue the transcoding phase, hoping the error
                  * did not mangle the encoder state.                   * did not mangle the encoder state.
                  */                   */
                snprintf((char *) &charref[0], sizeof(charref), "&#%d;", cur);                charref_len = snprintf((char *) &charref[0], sizeof(charref),
                                  "&#%d;", cur);
                 xmlBufferShrink(in, len);                  xmlBufferShrink(in, len);
                 xmlBufferAddHead(in, charref, -1);                  xmlBufferAddHead(in, charref, -1);
   

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


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