Changeset 120


Ignore:
Timestamp:
Apr 29, 2008, 10:17:32 AM (11 years ago)
Author:
cameron
Message:

Error reporting for character validation errors.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:ignore set to
      .project
  • trunk/markup_stats.cxx

    r118 r120  
    2828
    2929#ifndef REPEAT_RUNS
    30 #define REPEAT_RUNS 30
     30#define REPEAT_RUNS 1
    3131#endif
    3232
  • trunk/src/bitlex.c

    r114 r120  
    601601        }
    602602        u16_surrogate_accum = simd_or(u16_surrogate_accum, hi_surrogate_pending);
    603         if (bitblock_has_bit(simd_or(u16_surrogate_accum, u16_FFFE_FFFF_accum)))
     603        if (bitblock_has_bit(simd_or(u16_surrogate_accum, u16_FFFE_FFFF_accum))) {
    604604                CharSetValidationError("UTF-16");
    605605        }
     
    880880#endif
    881881        err_pos = bitstream_scan0(validation_stream);
    882         if (err_pos < buffer_units) {
    883                 printf("Illegal control character in XML input stream at position %i\n",
    884                         lexer_base_pos + err_pos);
    885                 exit(-1);
    886         }
     882        if (err_pos < buffer_units) XMLCharacterError(lexer_base_pos + err_pos);
    887883#ifdef CODE_CLOCKING
    888884/*
     
    912908        err_pos = bitstream_scan0(validation_stream);
    913909        if (err_pos < buffer_units) {
    914                 printf("Invalid %s character in input stream at position %i\n",
    915                         entity_Info->encoding,
    916                         lexer_base_pos + err_pos);
    917                 exit(-1);
     910                CharSetValidationError((char *) entity_Info->encoding, lexer_base_pos + err_pos);
    918911        }
    919912#ifdef CODE_CLOCKING
  • trunk/src/xml_error.c

    r112 r120  
    3232}
    3333
    34 void CharSetValidationError(char * encoding) {
    35         fprintf(stderr, "Error: invalid %s character.\n", encoding);
     34void CharSetValidationError(char * encoding, int err_pos) {
     35        fprintf(stderr, "Error: Invalid %s character in input stream at position %i\n", encoding, err_pos);
     36        exit(-1);
     37}
     38
     39void XMLCharacterError(int err_pos) {
     40        fprintf(stderr, "Illegal control character in XML input stream at position %i\n", err_pos);
    3641        exit(-1);
    3742}
     
    5661        exit(-1);
    5762}
     63
  • trunk/src/xml_error.h

    r111 r120  
    278278void EncodingError(char * msg, unsigned char * encoding, int lgth);
    279279
    280 void CharSetValidationError(char * encoding);
     280void CharSetValidationError(char * encoding, int err_pos);
     281
     282void XMLCharacterError(int err_pos);
    281283
    282284void IncompleteCodeUnitError();
Note: See TracChangeset for help on using the changeset viewer.