@@ -110,7 +110,7 @@ - (void) showFile
110
110
if (startFile==@" fileview" ){
111
111
fileTxt=[file textContents: &theError];
112
112
if (!theError)
113
- fileTxt=[GLFileView parseHTML : fileTxt];
113
+ fileTxt=[GLFileView cleanupHTML : fileTxt];
114
114
}else if (startFile==@" blame" ){
115
115
fileTxt=[file blame: &theError];
116
116
if (!theError)
@@ -240,13 +240,16 @@ - (void)closeView
240
240
[super closeView ];
241
241
}
242
242
243
- + (NSString *) parseHTML : (NSString *)txt
243
+ + (NSString *) cleanupHTML : (NSString *)txt
244
244
{
245
- txt=[txt stringByReplacingOccurrencesOfString: @" &" withString: @" &" ];
246
- txt=[txt stringByReplacingOccurrencesOfString: @" <" withString: @" <" ];
247
- txt=[txt stringByReplacingOccurrencesOfString: @" >" withString: @" >" ];
245
+ NSMutableString *newTxt = [NSMutableString stringWithString: txt];
246
+ [newTxt replaceOccurrencesOfString: @" &" withString: @" &" options: NSLiteralSearch range: NSMakeRange (0 , [newTxt length ])];
247
+ [newTxt replaceOccurrencesOfString: @" <" withString: @" <" options: NSLiteralSearch range: NSMakeRange (0 , [newTxt length ])];
248
+ [newTxt replaceOccurrencesOfString: @" >" withString: @" >" options: NSLiteralSearch range: NSMakeRange (0 , [newTxt length ])];
249
+ [newTxt replaceOccurrencesOfString: @" \" " withString: @" "" options: NSLiteralSearch range: NSMakeRange (0 , [newTxt length ])];
250
+ [newTxt replaceOccurrencesOfString: @" '" withString: @" '" options: NSLiteralSearch range: NSMakeRange (0 , [newTxt length ])];
248
251
249
- return txt ;
252
+ return newTxt ;
250
253
}
251
254
252
255
+ (NSString *)parseDiffTree : (NSString *)txt withStats : (NSMutableDictionary *)stats
@@ -296,7 +299,7 @@ + (NSString *)parseDiffTree:(NSString *)txt withStats:(NSMutableDictionary *)sta
296
299
297
300
+ (NSString *)parseDiff : (NSString *)txt
298
301
{
299
- txt=[self parseHTML : txt];
302
+ txt=[self cleanupHTML : txt];
300
303
301
304
NSMutableString *res=[NSMutableString string ];
302
305
NSScanner *scan=[NSScanner scannerWithString: txt];
@@ -504,7 +507,7 @@ +(BOOL)isStartBlock:(NSString *)line
504
507
505
508
- (NSString *) parseBlame : (NSString *)txt
506
509
{
507
- txt=[GLFileView parseHTML : txt];
510
+ txt=[GLFileView cleanupHTML : txt];
508
511
509
512
NSArray *lines = [txt componentsSeparatedByString: @" \n " ];
510
513
NSString *line;
0 commit comments