Source/DCMessageContextDisplayPlugin.m
changeset 2824 0eb39f6eb39c
parent 2823 24c471ce6c9e
child 2829 51687f71fc63
     1.1 --- a/Source/DCMessageContextDisplayPlugin.m	Wed Nov 25 22:55:50 2009 -0500
     1.2 +++ b/Source/DCMessageContextDisplayPlugin.m	Wed Nov 25 23:53:28 2009 -0500
     1.3 @@ -238,7 +238,8 @@
     1.4  		NSAutoreleasePool *parsingAutoreleasePool = [[NSAutoreleasePool alloc] init];
     1.5  		
     1.6  		do {
     1.7 -			//Calculate the new offset
     1.8 +			//Calculate the new offset. This also leaves offset where it needs to be
     1.9 +			//for the next iteration, since we modify it for the round every time.
    1.10  			offset = (offset <= readSize) ? 0 : offset - readSize;
    1.11  			
    1.12  			//Seek to it and read greedily until we hit readSize or run out of file.
    1.13 @@ -247,20 +248,19 @@
    1.14  				amountRead = pread(fd, buf + idx, readSize, offset + idx); 
    1.15  			   if (amountRead <= 0) break;
    1.16  			}
    1.17 -			offset -= idx;
    1.18  			
    1.19  			//Parse
    1.20  			result = [parser parseChunk:chunk];
    1.21  			
    1.22  		//Continue to parse as long as we need more elements, we have data to read, and LMX doesn't think we're done.
    1.23  		} while ([foundMessages count] < linesLeftToFind && offset > 0 && result != LMXParsedCompletely);
    1.24 -
    1.25 +		
    1.26  		//Drain our autorelease pool.
    1.27  		[parsingAutoreleasePool release];
    1.28  
    1.29  		//Be a good citizen and close the file
    1.30  		[file closeFile];
    1.31 -
    1.32 +		
    1.33  		//Add our locals to the outer array; we're probably looping again.
    1.34  		[outerFoundContentContexts replaceObjectsInRange:NSMakeRange(0, 0) withObjectsFromArray:foundMessages];
    1.35  		linesLeftToFind -= [outerFoundContentContexts count];