Changeset 4726 for Footagehead/trunk/FHHTMLParser.m
- Timestamp:
- 04/26/07 15:07:53 (2 years ago)
- Files:
-
- Footagehead/trunk/FHHTMLParser.m (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
Footagehead/trunk/FHHTMLParser.m
r4724 r4726 46 46 NSArray *tokens; 47 47 NSSet *types; 48 NSString *token, *link, *path ;48 NSString *token, *link, *path, *extension; 49 49 WIURL *url; 50 50 NSUInteger i, count, length; 51 51 52 links = [NSMutableArray arrayWithCapacity:50]; 53 set = [NSMutableSet setWithCapacity:50]; 54 length = [html length]; 55 skipSet = [NSCharacterSet characterSetWithCharactersInString:@" =\r\n\t\"\'<>"]; 52 links = [NSMutableArray arrayWithCapacity:50]; 53 length = [html length]; 54 skipSet = [NSCharacterSet characterSetWithCharactersInString:@" =\r\n\t\"\'<>"]; 56 55 57 56 switch(type) { … … 82 81 if([scanner scanUpToString:token intoString:NULL]) { 83 82 if([scanner scanString:token intoString:NULL]) { 84 if([scanner scanUpToCharactersFromSet:skipSet intoString:&link]) { 85 if(![set containsObject:link]) { 86 [links addObject:link]; 87 [set addObject:link]; 88 } 89 } 83 if([scanner scanUpToCharactersFromSet:skipSet intoString:&link]) 84 [links addObject:link]; 90 85 } 91 86 } … … 95 90 } 96 91 97 count = [links count]; 98 urls = [NSMutableArray arrayWithCapacity:count]; 99 types = [NSSet setWithArray:[NSImage FHImageFileTypes]]; 92 count = [links count]; 93 urls = [NSMutableArray arrayWithCapacity:count]; 94 set = [NSMutableSet setWithCapacity:count]; 95 types = [NSSet setWithArray:[NSImage FHImageFileTypes]]; 100 96 101 97 for(i = 0; i < count; i++) { 102 98 link = [links objectAtIndex:i]; 99 extension = [link pathExtension]; 103 100 104 if(![types containsObject:[link pathExtension]]) 101 if(![types containsObject:extension]) 102 continue; 103 104 if([extension isEqualToString:@"ico"]) 105 105 continue; 106 106 … … 124 124 } 125 125 126 [urls addObject:url]; 126 if(![set containsObject:url]) { 127 [urls addObject:url]; 128 [set addObject:url]; 129 } 127 130 } 128 131
