Changeset 1210

Show
Ignore:
Timestamp:
07/04/09 03:12:01 (3 years ago)
Author:
andrei
Message:

minor

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/phobos/std/xml.d

    r1182 r1210  
    290290    // does not do copy-on-write, but instead copies always. 
    291291 
    292     if (s.find('&') != -1) s = replace(s,"&","&"); 
    293     if (s.find('"') != -1) s = replace(s,"\"","""); 
    294     if (s.find("'") != -1) s = replace(s,"'","'"); 
    295     if (s.find('<') != -1) s = replace(s,"<","&lt;"); 
    296     if (s.find('>') != -1) s = replace(s,">","&gt;"); 
     292    if (s.indexOf('&') != -1) s = replace(s,"&","&amp;"); 
     293    if (s.indexOf('"') != -1) s = replace(s,"\"","&quot;"); 
     294    if (s.indexOf("'") != -1) s = replace(s,"'","&apos;"); 
     295    if (s.indexOf('<') != -1) s = replace(s,"<","&lt;"); 
     296    if (s.indexOf('>') != -1) s = replace(s,">","&gt;"); 
    297297    return s; 
    298298} 
     
    379379                    dchar d; 
    380380                    string t = s[i..$]; 
    381                     checkCharRef(t,d); 
    382                     buffer ~= cast(char)d; 
     381                    checkCharRef(t, d); 
     382                    char[4] temp; 
     383                    buffer ~= temp[0 .. std.utf.encode(temp, d)]; 
    383384                    i = s.length - t.length - 1; 
    384385                } 
     
    11371138    this(string content) 
    11381139    { 
    1139         if (content == "-" || content.find("==") != -1) 
     1140        if (content == "-" || content.indexOf("==") != -1) 
    11401141            throw new CommentException(content); 
    11411142        this.content = content; 
     
    12171218    this(string content) 
    12181219    { 
    1219         if (content.find("]]>") != -1) throw new CDataException(content); 
     1220        if (content.indexOf("]]>") != -1) throw new CDataException(content); 
    12201221        this.content = content; 
    12211222    } 
     
    13761377    this(string content) 
    13771378    { 
    1378         if (content.find(">") != -1) throw new XIException(content); 
     1379        if (content.indexOf(">") != -1) throw new XIException(content); 
    13791380        this.content = content; 
    13801381    } 
     
    14551456    this(string content) 
    14561457    { 
    1457         if (content.find("?>") != -1) throw new PIException(content); 
     1458        if (content.indexOf("?>") != -1) throw new PIException(content); 
    14581459        this.content = content; 
    14591460    } 
     
    18741875            { 
    18751876                chop(*s,4); 
    1876                 t = chop(*s,find(*s,"-->")); 
     1877                t = chop(*s,indexOf(*s,"-->")); 
    18771878                if (commentHandler.funcptr !is null) commentHandler(t); 
    18781879                chop(*s,3); 
     
    18811882            { 
    18821883                chop(*s,9); 
    1883                 t = chop(*s,find(*s,"]]>")); 
     1884                t = chop(*s,indexOf(*s,"]]>")); 
    18841885                if (cdataHandler.funcptr !is null) cdataHandler(t); 
    18851886                chop(*s,3); 
     
    18881889            { 
    18891890                chop(*s,2); 
    1890                 t = chop(*s,find(*s,">")); 
     1891                t = chop(*s,indexOf(*s,">")); 
    18911892                if (xiHandler.funcptr !is null) xiHandler(t); 
    18921893                chop(*s,1); 
     
    18951896            { 
    18961897                chop(*s,2); 
    1897                 t = chop(*s,find(*s,"?>")); 
     1898                t = chop(*s,indexOf(*s,"?>")); 
    18981899                if (piHandler.funcptr !is null) piHandler(t); 
    18991900                chop(*s,2); 
     
    19701971            else 
    19711972            { 
    1972                 t = chop(*s,find(*s,"<")); 
     1973                t = chop(*s,indexOf(*s,"<")); 
    19731974                if (rawTextHandler.funcptr !is null) 
    19741975                    rawTextHandler(t); 
     
    21282129 
    21292130        try { checkLiteral("<!--",s); } catch(Err e) { fail(e); } 
    2130         int n = s.find("--"); 
     2131        int n = s.indexOf("--"); 
    21312132        if (n == -1) fail("unterminated comment"); 
    21322133        s = s[0..n]; 
     
    24682469        // Deliberately no mixin Check here. 
    24692470 
    2470         int n = s.find(end); 
     2471        int n = s.indexOf(end); 
    24712472        if (n == -1) throw new Err(s,"Unable to find terminating \""~end~"\""); 
    24722473        s = s[n..$]; 
     
    25892590    catch(CheckException e) 
    25902591    { 
    2591         int n = e.toString().find("end tag name \"genres\" differs" 
     2592        int n = e.toString().indexOf("end tag name \"genres\" differs" 
    25922593            " from start tag name \"genre\""); 
    25932594        assert(n != -1); 
     
    26592660    { 
    26602661        string head = entire[0..$-tail.length]; 
    2661         int n = head.rfind('\n') + 1; 
     2662        int n = head.lastIndexOf('\n') + 1; 
    26622663        line = head.count("\n") + 1; 
    26632664        dstring t;