Diff for /embedaddon/libxml2/error.c between versions 1.1.1.2 and 1.1.1.3

version 1.1.1.2, 2013/07/22 01:22:22 version 1.1.1.3, 2014/06/15 19:53:28
Line 33  void XMLCDECL xmlGenericErrorDefaultFunc (void *ctx AT Line 33  void XMLCDECL xmlGenericErrorDefaultFunc (void *ctx AT
                                                                 \                                                                  \
     while (size < 64000) {                                      \      while (size < 64000) {                                      \
         va_start(ap, msg);                                      \          va_start(ap, msg);                                      \
        chars = vsnprintf(str, size, msg, ap);                  \        chars = vsnprintf(str, size, msg, ap);                  \
         va_end(ap);                                             \          va_end(ap);                                             \
         if ((chars > -1) && (chars < size)) {                   \          if ((chars > -1) && (chars < size)) {                   \
             if (prev_size == chars) {                           \              if (prev_size == chars) {                           \
Line 54  void XMLCDECL xmlGenericErrorDefaultFunc (void *ctx AT Line 54  void XMLCDECL xmlGenericErrorDefaultFunc (void *ctx AT
 }  }
   
 /************************************************************************  /************************************************************************
 *                                                                      * *                                                                        *
 *                      Handling of out of context errors               * *                      Handling of out of context errors               *
 *                                                                      * *                                                                      *
  ************************************************************************/   ************************************************************************/
   
 /**  /**
Line 64  void XMLCDECL xmlGenericErrorDefaultFunc (void *ctx AT Line 64  void XMLCDECL xmlGenericErrorDefaultFunc (void *ctx AT
  * @ctx:  an error context   * @ctx:  an error context
  * @msg:  the message to display/transmit   * @msg:  the message to display/transmit
  * @...:  extra parameters for the message display   * @...:  extra parameters for the message display
 *  *
  * Default handler for out of context error messages.   * Default handler for out of context error messages.
  */   */
 void XMLCDECL  void XMLCDECL
Line 82  xmlGenericErrorDefaultFunc(void *ctx ATTRIBUTE_UNUSED, Line 82  xmlGenericErrorDefaultFunc(void *ctx ATTRIBUTE_UNUSED,
 /**  /**
  * initGenericErrorDefaultFunc:   * initGenericErrorDefaultFunc:
  * @handler:  the handler   * @handler:  the handler
 *  *
  * Set or reset (if NULL) the default handler for generic errors   * Set or reset (if NULL) the default handler for generic errors
  * to the builtin error function.   * to the builtin error function.
  */   */
Line 137  xmlSetStructuredErrorFunc(void *ctx, xmlStructuredErro Line 137  xmlSetStructuredErrorFunc(void *ctx, xmlStructuredErro
 }  }
   
 /************************************************************************  /************************************************************************
 *                                                                      * *                                                                        *
 *                      Handling of parsing errors                      * *                      Handling of parsing errors                      *
 *                                                                      * *                                                                      *
  ************************************************************************/   ************************************************************************/
   
 /**  /**
  * xmlParserPrintFileInfo:   * xmlParserPrintFileInfo:
  * @input:  an xmlParserInputPtr input   * @input:  an xmlParserInputPtr input
 *  *
  * Displays the associated file and line informations for the current input   * Displays the associated file and line informations for the current input
  */   */
   
Line 165  xmlParserPrintFileInfo(xmlParserInputPtr input) { Line 165  xmlParserPrintFileInfo(xmlParserInputPtr input) {
 /**  /**
  * xmlParserPrintFileContext:   * xmlParserPrintFileContext:
  * @input:  an xmlParserInputPtr input   * @input:  an xmlParserInputPtr input
 *  *
  * Displays current context within the input content for error tracking   * Displays current context within the input content for error tracking
  */   */
   
 static void  static void
xmlParserPrintFileContextInternal(xmlParserInputPtr input , xmlParserPrintFileContextInternal(xmlParserInputPtr input ,
                 xmlGenericErrorFunc channel, void *data ) {                  xmlGenericErrorFunc channel, void *data ) {
     const xmlChar *cur, *base;      const xmlChar *cur, *base;
     unsigned int n, col;        /* GCC warns if signed, because compared with sizeof() */      unsigned int n, col;        /* GCC warns if signed, because compared with sizeof() */
Line 186  xmlParserPrintFileContextInternal(xmlParserInputPtr in Line 186  xmlParserPrintFileContextInternal(xmlParserInputPtr in
     }      }
     n = 0;      n = 0;
     /* search backwards for beginning-of-line (to max buff size) */      /* search backwards for beginning-of-line (to max buff size) */
    while ((n++ < (sizeof(content)-1)) && (cur > base) &&     while ((n++ < (sizeof(content)-1)) && (cur > base) &&
           (*(cur) != '\n') && (*(cur) != '\r'))           (*(cur) != '\n') && (*(cur) != '\r'))
         cur--;          cur--;
     if ((*(cur) == '\n') || (*(cur) == '\r')) cur++;      if ((*(cur) == '\n') || (*(cur) == '\r')) cur++;
     /* calculate the error position in terms of the current position */      /* calculate the error position in terms of the current position */
Line 196  xmlParserPrintFileContextInternal(xmlParserInputPtr in Line 196  xmlParserPrintFileContextInternal(xmlParserInputPtr in
     n = 0;      n = 0;
     ctnt = content;      ctnt = content;
     /* copy selected text to our buffer */      /* copy selected text to our buffer */
    while ((*cur != 0) && (*(cur) != '\n') &&     while ((*cur != 0) && (*(cur) != '\n') &&
           (*(cur) != '\r') && (n < sizeof(content)-1)) {           (*(cur) != '\r') && (n < sizeof(content)-1)) {
                 *ctnt++ = *cur++;                  *ctnt++ = *cur++;
         n++;          n++;
     }      }
Line 221  xmlParserPrintFileContextInternal(xmlParserInputPtr in Line 221  xmlParserPrintFileContextInternal(xmlParserInputPtr in
 /**  /**
  * xmlParserPrintFileContext:   * xmlParserPrintFileContext:
  * @input:  an xmlParserInputPtr input   * @input:  an xmlParserInputPtr input
 *  *
  * Displays current context within the input content for error tracking   * Displays current context within the input content for error tracking
  */   */
 void  void
Line 292  xmlReportError(xmlErrorPtr err, xmlParserCtxtPtr ctxt, Line 292  xmlReportError(xmlErrorPtr err, xmlParserCtxtPtr ctxt,
     } else {      } else {
         if (file != NULL)          if (file != NULL)
             channel(data, "%s:%d: ", file, line);              channel(data, "%s:%d: ", file, line);
        else if ((line != 0) && (domain == XML_FROM_PARSER))        else if ((line != 0) &&
                  ((domain == XML_FROM_PARSER) || (domain == XML_FROM_SCHEMASV)||
                   (domain == XML_FROM_SCHEMASP)||(domain == XML_FROM_DTD) ||
                   (domain == XML_FROM_RELAXNGP)||(domain == XML_FROM_RELAXNGV)))
             channel(data, "Entity: line %d: ", line);              channel(data, "Entity: line %d: ", line);
     }      }
     if (name != NULL) {      if (name != NULL) {
Line 360  xmlReportError(xmlErrorPtr err, xmlParserCtxtPtr ctxt, Line 363  xmlReportError(xmlErrorPtr err, xmlParserCtxtPtr ctxt,
         case XML_FROM_I18N:          case XML_FROM_I18N:
             channel(data, "encoding ");              channel(data, "encoding ");
             break;              break;
           case XML_FROM_SCHEMATRONV:
               channel(data, "schematron ");
               break;
           case XML_FROM_BUFFER:
               channel(data, "internal buffer ");
               break;
           case XML_FROM_URI:
               channel(data, "URI ");
               break;
         default:          default:
             break;              break;
     }      }
Line 429  xmlReportError(xmlErrorPtr err, xmlParserCtxtPtr ctxt, Line 441  xmlReportError(xmlErrorPtr err, xmlParserCtxtPtr ctxt,
  * @str2: extra string info   * @str2: extra string info
  * @str3: extra string info   * @str3: extra string info
  * @int1: extra int info   * @int1: extra int info
 * @col: column number of the error or 0 if N/A  * @col: column number of the error or 0 if N/A
  * @msg:  the message to display/transmit   * @msg:  the message to display/transmit
  * @...:  extra parameters for the message display   * @...:  extra parameters for the message display
  *   *
Line 521  __xmlRaiseError(xmlStructuredErrorFunc schannel, Line 533  __xmlRaiseError(xmlStructuredErrorFunc schannel,
   
         if ((node != NULL) && (node->type == XML_ELEMENT_NODE))          if ((node != NULL) && (node->type == XML_ELEMENT_NODE))
             line = node->line;              line = node->line;
           if ((line == 0) || (line == 65535))
               line = xmlGetLineNo(node);
     }      }
   
     /*      /*
Line 601  __xmlRaiseError(xmlStructuredErrorFunc schannel, Line 615  __xmlRaiseError(xmlStructuredErrorFunc schannel,
         data = ctxt->userData;          data = ctxt->userData;
     } else if (channel == NULL) {      } else if (channel == NULL) {
         channel = xmlGenericError;          channel = xmlGenericError;
        if (!data)        if (ctxt != NULL) {
             data = ctxt;
         } else {
             data = xmlGenericErrorContext;              data = xmlGenericErrorContext;
           }
     }      }
     if (channel == NULL)      if (channel == NULL)
         return;          return;
Line 654  __xmlSimpleError(int domain, int code, xmlNodePtr node Line 671  __xmlSimpleError(int domain, int code, xmlNodePtr node
  * @ctx:  an XML parser context   * @ctx:  an XML parser context
  * @msg:  the message to display/transmit   * @msg:  the message to display/transmit
  * @...:  extra parameters for the message display   * @...:  extra parameters for the message display
 *  *
  * Display and format an error messages, gives file, line, position and   * Display and format an error messages, gives file, line, position and
  * extra parameters.   * extra parameters.
  */   */
Line 697  xmlParserError(void *ctx, const char *msg, ...) Line 714  xmlParserError(void *ctx, const char *msg, ...)
  * @ctx:  an XML parser context   * @ctx:  an XML parser context
  * @msg:  the message to display/transmit   * @msg:  the message to display/transmit
  * @...:  extra parameters for the message display   * @...:  extra parameters for the message display
 *  *
  * Display and format a warning messages, gives file, line, position and   * Display and format a warning messages, gives file, line, position and
  * extra parameters.   * extra parameters.
  */   */
Line 718  xmlParserWarning(void *ctx, const char *msg, ...) Line 735  xmlParserWarning(void *ctx, const char *msg, ...)
         }          }
         xmlParserPrintFileInfo(input);          xmlParserPrintFileInfo(input);
     }      }
        
     xmlGenericError(xmlGenericErrorContext, "warning: ");      xmlGenericError(xmlGenericErrorContext, "warning: ");
     XML_GET_VAR_STR(msg, str);      XML_GET_VAR_STR(msg, str);
     xmlGenericError(xmlGenericErrorContext, "%s", str);      xmlGenericError(xmlGenericErrorContext, "%s", str);
Line 736  xmlParserWarning(void *ctx, const char *msg, ...) Line 753  xmlParserWarning(void *ctx, const char *msg, ...)
 }  }
   
 /************************************************************************  /************************************************************************
 *                                                                      * *                                                                        *
 *                      Handling of validation errors                   * *                      Handling of validation errors                   *
 *                                                                      * *                                                                      *
  ************************************************************************/   ************************************************************************/
   
 /**  /**
Line 746  xmlParserWarning(void *ctx, const char *msg, ...) Line 763  xmlParserWarning(void *ctx, const char *msg, ...)
  * @ctx:  an XML parser context   * @ctx:  an XML parser context
  * @msg:  the message to display/transmit   * @msg:  the message to display/transmit
  * @...:  extra parameters for the message display   * @...:  extra parameters for the message display
 *  *
  * Display and format an validity error messages, gives file,   * Display and format an validity error messages, gives file,
  * line, position and extra parameters.   * line, position and extra parameters.
  */   */
Line 764  xmlParserValidityError(void *ctx, const char *msg, ... Line 781  xmlParserValidityError(void *ctx, const char *msg, ...
             input = ctxt->input;              input = ctxt->input;
             if ((input->filename == NULL) && (ctxt->inputNr > 1))              if ((input->filename == NULL) && (ctxt->inputNr > 1))
                 input = ctxt->inputTab[ctxt->inputNr - 2];                  input = ctxt->inputTab[ctxt->inputNr - 2];
                
             if (had_info == 0) {              if (had_info == 0) {
                 xmlParserPrintFileInfo(input);                  xmlParserPrintFileInfo(input);
             }              }
Line 790  xmlParserValidityError(void *ctx, const char *msg, ... Line 807  xmlParserValidityError(void *ctx, const char *msg, ...
  * @ctx:  an XML parser context   * @ctx:  an XML parser context
  * @msg:  the message to display/transmit   * @msg:  the message to display/transmit
  * @...:  extra parameters for the message display   * @...:  extra parameters for the message display
 *  *
  * Display and format a validity warning messages, gives file, line,   * Display and format a validity warning messages, gives file, line,
  * position and extra parameters.   * position and extra parameters.
  */   */
Line 809  xmlParserValidityWarning(void *ctx, const char *msg, . Line 826  xmlParserValidityWarning(void *ctx, const char *msg, .
   
         xmlParserPrintFileInfo(input);          xmlParserPrintFileInfo(input);
     }      }
        
     xmlGenericError(xmlGenericErrorContext, "validity warning: ");      xmlGenericError(xmlGenericErrorContext, "validity warning: ");
     XML_GET_VAR_STR(msg, str);      XML_GET_VAR_STR(msg, str);
     xmlGenericError(xmlGenericErrorContext, "%s", str);      xmlGenericError(xmlGenericErrorContext, "%s", str);

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


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