Author: johannes
Date: 2005-05-06 12:59:47 -0500 (Fri, 06 May 2005)
New Revision: 7535
Modified:
trunk/gnue-common/src/utils/dbf.py
Log:
Add a small tolerance to file size checks
Modified: trunk/gnue-common/src/utils/dbf.py
===================================================================
--- trunk/gnue-common/src/utils/dbf.py 2005-05-06 17:31:54 UTC (rev 7534)
+++ trunk/gnue-common/src/utils/dbf.py 2005-05-06 17:59:47 UTC (rev 7535)
@@ -104,8 +104,9 @@
self.headerLen = struct.unpack ('<H', self.__file.read (2)) [0]
self.recordLen = struct.unpack ('<H', self.__file.read (2)) [0]
- # Logical file size must match the real file size
- if 1 + self.headerLen + self.__numRecords * self.recordLen != self.__size:
+ # Check the real and logical file size
+ cSize = self.headerLen + self.__numRecords * self.recordLen
+ if not self.__size - cSize in [0, 1]:
raise InvalidFormatError, "wrong file size"
reserved = self.__file.read (2)
_______________________________________________
Commit-gnue mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/commit-gnue