[sword-svn] r2053 - trunk/src/mgr

scribe at www.crosswire.org scribe at www.crosswire.org
Thu May 24 20:44:06 MST 2007


Author: scribe
Date: 2007-05-24 20:44:04 -0700 (Thu, 24 May 2007)
New Revision: 2053

Modified:
   trunk/src/mgr/filemgr.cpp
Log:
Fixed a big bug in common code which messed up on lines from a file that were exactly 253 bytes long.


Modified: trunk/src/mgr/filemgr.cpp
===================================================================
--- trunk/src/mgr/filemgr.cpp	2007-05-19 21:28:23 UTC (rev 2052)
+++ trunk/src/mgr/filemgr.cpp	2007-05-25 03:44:04 UTC (rev 2053)
@@ -429,6 +429,8 @@
 		more = false;
 		long index = fDesc->seek(0, SEEK_CUR);
 		len = fDesc->read(chunk, 254);
+
+		// assert we have a readable file (not a directory)
 		if (len < 1)
 			break;
 
@@ -441,15 +443,13 @@
 			}
 		}
 
-		// assert we have a readable file (not a directory)
-		if (len < 0)
-			break;
-
 		// find the end
 		int end;
 		for (end = start; ((end < (len-1)) && (chunk[end] != 10)); end++);
-		if (end >= 253)
+	
+		if ((chunk[end] != 10) && (len == 254)) {
 			more = true;
+		}
 		index += (end + 1);
 
 		// reposition to next valid place to read




More information about the sword-cvs mailing list