Changeset 214

Show
Ignore:
Timestamp:
07/09/06 04:59:31 (2 years ago)
Author:
Don Clugston
Message:

Bugfix for bug found by Tom S: error in Lname length calculation.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/meta/demangle.d

    r212 r214  
    146146template getLname(char [] str) 
    147147{ 
    148     static if (str.length<=10 || !isdigit!( (str[1]) ) ) 
     148    static if (str.length <= 9+1 || !isdigit!( (str[1]) ) ) 
    149149        const char [] getLname = str[1..(str[0]-'0' + 1)]; 
    150     else static if (str.length<=100 || !isdigit!( (str[2]) )) 
     150    else static if (str.length <= 99+2 || !isdigit!( (str[2]) )) 
    151151        const char [] getLname = str[2..((str[0]-'0')*10 + str[1]-'0'+ 2)]; 
     152    else static if (str.length <= 999+3 || !isdigit!( (str[3]) )) 
     153        const char [] getLname =  
     154            str[3..((str[0]-'0')*100 + (str[1]-'0')*10 + str[2]-'0' + 3)]; 
    152155    else 
    153156        const char [] getLname =  
    154             str[3..((str[0]-'0')*100 + (str[1]-'0')*10 + str[0]-'0' + 3)]; 
     157            str[4..((str[0]-'0')*1000 + (str[1]-'0')*100 + (str[2]-'0')*10 + (str[3]-'0') + 4)]; 
    155158} 
    156159 
     
    229232    static if (str.length==0) 
    230233        const int getLnameConsumed=0; 
    231     else static if (str.length<=10 || !isdigit!( (str[1]) ) ) 
     234    else static if (str.length <= (9+1) || !isdigit!( (str[1]) ) ) 
    232235        const int getLnameConsumed = 1 + str[0]-'0'; 
    233     else static if (str.length<=100 || !isdigit!( (str[2]) )) 
     236    else static if (str.length <= (99+2) || !isdigit!( (str[2]) )) 
    234237        const int getLnameConsumed = (str[0]-'0')*10 + str[1]-'0' + 2; 
    235     else 
    236         const int getLnameConsumed = (str[0]-'0')*100 + (str[1]-'0')*10 + str[0]-'0' + 3; 
     238    else static if (str.length <= (999+3) || !isdigit!( (str[3]) )) 
     239        const int getLnameConsumed = (str[0]-'0')*100 + (str[1]-'0')*10 + str[2]-'0' + 3; 
     240    else  
     241        const int getLnameConsumed = (str[0]-'0')*1000 + (str[1]-'0')*100 + (str[2]-'0')*10 + (str[3]-'0') + 4; 
    237242} 
    238243