Title: [commits] (vajda) [15923] replace 'long' packs with 'int'

Diff

Modified: branches/64/chandler/repository/persistence/DBContainer.py (15922 => 15923)

--- branches/64/chandler/repository/persistence/DBContainer.py	2007-11-27 19:38:50 UTC (rev 15922)
+++ branches/64/chandler/repository/persistence/DBContainer.py	2007-11-27 19:56:22 UTC (rev 15923)
@@ -440,7 +440,7 @@
             else:
                 prevValue = None
                 while value is not None and value[0].startswith(key):
-                    version = ~unpack('>l', value[0][32:36])[0]
+                    version = ~unpack('>i', value[0][32:36])[0]
                     if version < toVersion:
                         if (prevValue is not None and
                             prevValue[0][16:32] == value[0][16:32]):
@@ -468,7 +468,7 @@
             value = cursor.set_range(key, flags, None)
 
             while value is not None and value[0].startswith(key):
-                keyVer = ~unpack('>l', value[0][32:36])[0]
+                keyVer = ~unpack('>i', value[0][32:36])[0]
                 if keyVer == version:
                     cursor.delete(flags)
                 value = cursor.next(flags, None)
@@ -514,7 +514,7 @@
             else:
                 prevValue = None
                 while value is not None and value[0].startswith(key):
-                    version = ~unpack('>l', value[0][-4:])[0]
+                    version = ~unpack('>i', value[0][-4:])[0]
                     if version < toVersion:
                         if (prevValue is not None and
                             prevValue[0][16:20] == value[0][16:20]):
@@ -540,7 +540,7 @@
             value = cursor.set_range(key, flags, None)
 
             while value is not None and value[0].startswith(key):
-                nameVer = ~unpack('>l', value[0][-4:])[0]
+                nameVer = ~unpack('>i', value[0][-4:])[0]
                 if nameVer == version:
                     cursor.delete(flags)
                 value = cursor.next(flags, None)
@@ -768,7 +768,7 @@
             else:
                 prevValue = None
                 while value is not None and value[0].startswith(key):
-                    version = ~unpack('>l', value[0][32:36])[0]
+                    version = ~unpack('>i', value[0][32:36])[0]
                     if version < toVersion:
                         if (prevValue is not None and
                             prevValue[0][16:32] == value[0][16:32]):
@@ -794,7 +794,7 @@
             value = cursor.set_range(key, flags, None)
 
             while value is not None and value[0].startswith(key):
-                keyVer = ~unpack('>l', value[0][32:36])[0]
+                keyVer = ~unpack('>i', value[0][32:36])[0]
                 if keyVer == version:
                     cursor.delete(flags)
                 value = cursor.next(flags, None)
@@ -1044,7 +1044,7 @@
 
     def purgeItem(self, txn, counter, uuid, version):
 
-        self.delete(pack('>16sl', uuid._uuid, ~version), txn)
+        self.delete(pack('>16si', uuid._uuid, ~version), txn)
         if counter is not None:
             counter.itemCount += 1
 
@@ -1513,10 +1513,10 @@
 
     FORMAT_VERSION = 0x00070a00
 
-    SCHEMA_KEY  = pack('>16sl', Repository.itsUUID._uuid, 0)
-    VERSION_KEY = pack('>16sl', Repository.itsUUID._uuid, 1)
-    VIEW_KEY = pack('>16sl', Repository.itsUUID._uuid, 2)
-    MIN_VERSION_KEY = pack('>16sl', Repository.itsUUID._uuid, 3)
+    SCHEMA_KEY  = pack('>16si', Repository.itsUUID._uuid, 0)
+    VERSION_KEY = pack('>16si', Repository.itsUUID._uuid, 1)
+    VIEW_KEY = pack('>16si', Repository.itsUUID._uuid, 2)
+    MIN_VERSION_KEY = pack('>16si', Repository.itsUUID._uuid, 3)
 
     VIEW_DATA_TYPES = (Record.INT,       # status
                        Record.SYMBOL,    # timezone
@@ -1542,7 +1542,7 @@
 
         if kwds.get('create', False):
             self._db.put(VersionContainer.SCHEMA_KEY,
-                         pack('>16sll', UUID()._uuid,
+                         pack('>16sii', UUID()._uuid,
                               format_version, schema_version), txn)
         else:
             try:
@@ -1562,7 +1562,7 @@
         if value is None:
             raise AssertionError, 'schema record is missing'
 
-        versionId, format, schema = unpack('>16sll', value)
+        versionId, format, schema = unpack('>16sii', value)
 
         return UUID(versionId), format, schema
         
@@ -1626,17 +1626,17 @@
         if value is None:
             return 0
         else:
-            return unpack('>l', value)[0]
+            return unpack('>i', value)[0]
 
     def setVersion(self, version):
 
-        self._db.put(VersionContainer.VERSION_KEY, pack('>l', version),
+        self._db.put(VersionContainer.VERSION_KEY, pack('>i', version),
                      self.store.txn)
 
     def nextVersion(self):
 
         version = self.getVersion() + 1
-        self._db.put(VersionContainer.VERSION_KEY, pack('>l', version),
+        self._db.put(VersionContainer.VERSION_KEY, pack('>i', version),
                      self.store.txn)
 
         return version
@@ -1648,11 +1648,11 @@
         if value is None:
             return 0
         else:
-            return unpack('>l', value)[0]
+            return unpack('>i', value)[0]
 
     def setMinVersion(self, version):
 
-        self._db.put(VersionContainer.MIN_VERSION_KEY, pack('>l', version),
+        self._db.put(VersionContainer.MIN_VERSION_KEY, pack('>i', version),
                      self.store.txn)
 
     def purgeViewData(self, txn, counter, toVersion):
@@ -1673,7 +1673,7 @@
                     value = cursor.next(flags, None)
             else:
                 while value is not None and value[0].startswith(key):
-                    version = unpack('>l', value[0][20:24])[0]
+                    version = unpack('>i', value[0][20:24])[0]
                     if version < toVersion:
                         value = cursor.delete(flags)
                         counter.valueCount += 1
@@ -1688,7 +1688,7 @@
 
     def logCommit(self, view, version, commitCount):
 
-        key = pack('>l', version)
+        key = pack('>i', version)
         data = "" long(time() * 1000), len(view),
                     commitCount) + view.name
 
@@ -1696,7 +1696,7 @@
 
     def getCommit(self, version):
 
-        data = "" version))
+        data = "" version))
         if data is not None:
             return self._readCommit(data)
 
@@ -1704,7 +1704,7 @@
 
     def purgeCommit(self, version):
 
-        self.delete(pack('>l', version))
+        self.delete(pack('>i', version))
 
     def _readCommit(self, data):
 
@@ -1740,12 +1740,12 @@
                 _self.cursor = self.c.openCursor()
                 
                 try:
-                    value = _self.cursor.set_range(pack('>l', fromVersion),
+                    value = _self.cursor.set_range(pack('>i', fromVersion),
                                                    self.c.flags, None)
 
                     while value is not None:
                         key, data = ""
-                        version, = unpack('>l', key)
+                        version, = unpack('>i', key)
                         if toVersion and version > toVersion:
                             break
 

Modified: branches/64/chandler/repository/persistence/FileContainer.py (15922 => 15923)

--- branches/64/chandler/repository/persistence/FileContainer.py	2007-11-27 19:38:50 UTC (rev 15922)
+++ branches/64/chandler/repository/persistence/FileContainer.py	2007-11-27 19:56:22 UTC (rev 15923)
@@ -198,14 +198,14 @@
         if value is None:
             return False
         
-        zero, self.length, self.timeModified, uuid = unpack('>LLQ16s', value)
+        zero, self.length, self.timeModified, uuid = unpack('>IIQ16s', value)
         self._uuid = UUID(uuid)
 
         return True
 
     def modify(self, length, timeModified):
 
-        data = "" 0L, length, timeModified, self.getKey()._uuid)
+        data = "" 0L, length, timeModified, self.getKey()._uuid)
         self._container.put(self._key, data)
         
         self.length = length
@@ -258,7 +258,7 @@
         super(Block, self).__init__()
 
         self._container = container
-        self._key = pack('>16sll', file.getKey()._uuid, 0L, 0L)
+        self._key = pack('>16sii', file.getKey()._uuid, 0L, 0L)
         self._data = None
         self._position = 0
         self._len = 0
@@ -274,7 +274,7 @@
     def seek(self, position, write=False):
 
         position = int(position)
-        key = pack('>16sll', self._key[0:16], 0,
+        key = pack('>16sii', self._key[0:16], 0,
                    position >> self._container.BLOCK_SHIFT)
 
         if self._data is None or key != self._key:

Modified: branches/64/chandler/repository/persistence/LuceneContainer.py (15922 => 15923)

--- branches/64/chandler/repository/persistence/LuceneContainer.py	2007-11-27 19:38:50 UTC (rev 15922)
+++ branches/64/chandler/repository/persistence/LuceneContainer.py	2007-11-27 19:56:22 UTC (rev 15923)
@@ -169,11 +169,11 @@
         if value is None:
             return 0
         else:
-            return unpack('>l', value)[0]
+            return unpack('>i', value)[0]
 
     def setIndexVersion(self, version):
 
-        self.put(VersionContainer.VERSION_KEY, pack('>l', version),
+        self.put(VersionContainer.VERSION_KEY, pack('>i', version),
                  self._blocks)
         
     def getDirectory(self):

Modified: branches/64/chandler/repository/schema/Types.py (15922 => 15923)

--- branches/64/chandler/repository/schema/Types.py	2007-11-27 19:38:50 UTC (rev 15922)
+++ branches/64/chandler/repository/schema/Types.py	2007-11-27 19:56:22 UTC (rev 15923)
@@ -368,7 +368,7 @@
         return offset+1, data[offset]
 
     def hashValue(self, value):
-        return _hash(pack('>l', value))
+        return _hash(pack('>i', value))
 
 
 class Long(Type):




_______________________________________________
Commits mailing list
[email protected]
http://lists.osafoundation.org/mailman/listinfo/commits

Reply via email to