adium-1.4 2824:0eb39f6eb39c: Fix the context parser ignoring pag...
commits at adium.im
commits at adium.im
Thu Nov 26 04:53:32 UTC 2009
details: http://hg.adium.im/adium-1.4/rev/0eb39f6eb39c
revision: 2824:0eb39f6eb39c
author: Zachary West <zacw at adium.im>
date: Wed Nov 25 23:53:28 2009 -0500
Fix the context parser ignoring pages. Fixes #13362.
Every iteration was doing:
1. Move to location for reading.
2. Read
3. Move to location for next read.
So we were skipping reads like a mofo here. I believe this fixes any remaining context issues that un-instance-variableing didn't hit.
diffs (36 lines):
diff -r 24c471ce6c9e -r 0eb39f6eb39c Source/DCMessageContextDisplayPlugin.m
--- a/Source/DCMessageContextDisplayPlugin.m Wed Nov 25 22:55:50 2009 -0500
+++ b/Source/DCMessageContextDisplayPlugin.m Wed Nov 25 23:53:28 2009 -0500
@@ -238,7 +238,8 @@
NSAutoreleasePool *parsingAutoreleasePool = [[NSAutoreleasePool alloc] init];
do {
- //Calculate the new offset
+ //Calculate the new offset. This also leaves offset where it needs to be
+ //for the next iteration, since we modify it for the round every time.
offset = (offset <= readSize) ? 0 : offset - readSize;
//Seek to it and read greedily until we hit readSize or run out of file.
@@ -247,20 +248,19 @@
amountRead = pread(fd, buf + idx, readSize, offset + idx);
if (amountRead <= 0) break;
}
- offset -= idx;
//Parse
result = [parser parseChunk:chunk];
//Continue to parse as long as we need more elements, we have data to read, and LMX doesn't think we're done.
} while ([foundMessages count] < linesLeftToFind && offset > 0 && result != LMXParsedCompletely);
-
+
//Drain our autorelease pool.
[parsingAutoreleasePool release];
//Be a good citizen and close the file
[file closeFile];
-
+
//Add our locals to the outer array; we're probably looping again.
[outerFoundContentContexts replaceObjectsInRange:NSMakeRange(0, 0) withObjectsFromArray:foundMessages];
linesLeftToFind -= [outerFoundContentContexts count];
More information about the commits
mailing list