Changeset 166 for trunk


Ignore:
Timestamp:
Jun 23, 2008, 8:39:01 AM (11 years ago)
Author:
cameron
Message:

Delete junk from ReadTextDeclaration?; clean-up.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/xmldecl.c

    r165 r166  
    66
    77*/
    8 #include <stdio.h>
    9 #include <stdlib.h>
    10 #include <string.h>
    11 #include <sys/types.h>
    128
    139#include "byteplex.h"
     
    1612#include "multiliteral.h"
    1713#include "bytelex.h"
    18 #include "xmlmodel.h"
    19 
    2014
    2115Entity_Info::Entity_Info() {
     
    176170                ScanToQuote();
    177171                if (cur()[0] != quoteCh) DeclError();
    178                 int end_pos = AbsPos();
    179                 e.encoding = new unsigned char[end_pos - start_pos + 1];
    180                 memcpy(e.encoding, &x8data[start_pos-buffer_base_pos], end_pos - start_pos);
    181                 e.encoding[end_pos - start_pos] = '\0';
     172                int lgth = AbsPos() - start_pos;
     173                e.encoding = new unsigned char[lgth + 1];
     174                memcpy(e.encoding, &x8data[start_pos-buffer_base_pos], lgth);
     175                e.encoding[lgth] = '\0';
    182176        }
    183177        else DeclError();
     
    240234// Similar to reading the XML_declaration of the document entity,
    241235// ReadTextDeclaration reads the text declaration of an external
    242 // parsed entity.  This is not really needed at present, for DTDless
    243 // processing.
     236// parsed entity.
    244237template <CodeUnit_Base C>
    245238void XML_Decl_Parser<C>::ReadTextDeclaration(Entity_Info & e) {
     
    248241        e.standalone = Standalone_no_value;
    249242        buffer_rel_pos = e.BOM_units;
    250         // It is possible that there is no XML declaration.
     243        // It is possible that there is no text declaration.
    251244        if (!at_XmlDecl_start<C>(cur())) {
    252245                e.content_start = AbsPos();
     
    266259        ParseEncoding(e);
    267260        Scan_WS();
    268         if (!at_PI_End<C>(cur())) DeclError();  ParseVersion(e);
    269         if (at_PI_End<C>(cur())) {
    270                 e.content_start = AbsPos()+2;
    271                 return;
    272         }
    273 
     261        if (!at_PI_End<C>(cur())) DeclError();
    274262        e.content_start = AbsPos()+2;
    275263}
Note: See TracChangeset for help on using the changeset viewer.