Changeset 7 for trunk/src/charsets


Ignore:
Timestamp:
Dec 22, 2007, 11:08:10 AM (12 years ago)
Author:
cameron
Message:

Reference extraction; checking ]]> in text; < in atts.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/charsets/ext_ascii_8.c

    r4 r7  
    1818
    1919int Ext_ASCII_8_Lexer::AdvanceBuffer(int newpos) {
     20  int new_blocks, new_packs;
    2021  unsigned char * buf_ptr = xml_buf->GetBytePtr(newpos * CODE_UNIT_BYTES);
     22  BytePack * src_data = (BytePack *) buf_ptr;
    2123  int avail_bytes = xml_buf->PrepareBytes(BYTE_STREAM_SIZE);
    22   int new_blocks = min(BUFFER_BLOCKS, (avail_bytes + BLOCKSIZE - 1)/BLOCKSIZE);
    23   int new_packs = new_blocks * 8 + 1;
    2424#ifdef BUFFER_PROFILING
    2525  start_BOM_interval(bitstream_timer);
    2626#endif
    27   BytePack * src_data = (BytePack *) buf_ptr;
    28   for (int pk = 0; pk < new_packs; pk++) {
    29     parsing_engine_data->x8data[pk] = sisd_load_unaligned(&src_data[pk]);
     27  if (avail_bytes >= BYTE_STREAM_SIZE) {
     28    new_blocks = BUFFER_BLOCKS;
     29    new_packs = new_blocks * 8 + 1;
     30    for (int pk = 0; pk < new_packs; pk++) {
     31      parsing_engine_data->x8data[pk] = sisd_load_unaligned(&src_data[pk]);
     32    }
     33  }
     34  else {
     35    new_blocks = min(BUFFER_BLOCKS, (avail_bytes + BLOCKSIZE - 1)/BLOCKSIZE);
     36    new_packs = new_blocks * 8 + 1;
     37    for (int pk = 0; pk < new_packs; pk++) {
     38      parsing_engine_data->x8data[pk] = sisd_load_unaligned(&src_data[pk]);
     39    }
     40    ((unsigned char *) parsing_engine_data->x8data)[avail_bytes] = ']';
    3041  }
    3142  ComputeLexicalItemStreams(new_blocks);
Note: See TracChangeset for help on using the changeset viewer.