commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnue] r7535 - trunk/gnue-common/src/utils


From: johannes
Subject: [gnue] r7535 - trunk/gnue-common/src/utils
Date: Fri, 6 May 2005 12:59:48 -0500 (CDT)

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)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]