Skip to content

Commit

Permalink
Update parsing/tests in records.py
Browse files Browse the repository at this point in the history
  • Loading branch information
sydp committed Nov 4, 2024
1 parent ec7300b commit 36237cb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions dfindexeddb/indexeddb/chromium/record.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ class SchemaVersionKey(BaseIndexedDBKey):

def DecodeValue(self, decoder: utils.LevelDBDecoder) -> int:
"""Decodes the schema version value."""
return decoder.DecodeVarint()[1]
return decoder.DecodeInt()[1]

@classmethod
def FromDecoder(
Expand All @@ -456,7 +456,7 @@ class MaxDatabaseIdKey(BaseIndexedDBKey):

def DecodeValue(self, decoder: utils.LevelDBDecoder) -> int:
"""Decodes the maximum database value."""
return decoder.DecodeVarint()[1]
return decoder.DecodeInt()[1]

@classmethod
def FromDecoder(
Expand All @@ -476,7 +476,7 @@ class DataVersionKey(BaseIndexedDBKey):

def DecodeValue(self, decoder: utils.LevelDBDecoder) -> int:
"""Decodes the data version value."""
return decoder.DecodeUint64Varint()[1]
return decoder.DecodeInt()[1]

@classmethod
def FromDecoder(
Expand Down Expand Up @@ -638,7 +638,7 @@ def DecodeValue(self, decoder: utils.LevelDBDecoder) -> int:
The value is the corresponding database ID.
"""
return decoder.DecodeVarint()[1]
return decoder.DecodeInt()[1]

@classmethod
def FromDecoder(
Expand Down Expand Up @@ -785,7 +785,7 @@ class ObjectStoreNamesKey(BaseIndexedDBKey):

def DecodeValue(self, decoder: utils.LevelDBDecoder) -> int:
"""Decodes the object store names value."""
return decoder.DecodeVarint()[1]
return decoder.DecodeInt()[1]

@classmethod
def FromDecoder(cls, decoder: utils.LevelDBDecoder, key_prefix: KeyPrefix,
Expand All @@ -810,7 +810,7 @@ class IndexNamesKey(BaseIndexedDBKey):

def DecodeValue(self, decoder: utils.LevelDBDecoder) -> int:
"""Decodes the index names value."""
return decoder.DecodeVarint()[1]
return decoder.DecodeInt()[1]

@classmethod
def FromDecoder(cls, decoder: utils.LevelDBDecoder, key_prefix: KeyPrefix,
Expand Down Expand Up @@ -847,7 +847,7 @@ def DecodeValue(
return decoder.DecodeString()[1]
if (self.metadata_type ==
definitions.DatabaseMetaDataKeyType.MAX_ALLOCATED_OBJECT_STORE_ID):
return decoder.DecodeVarint()[1]
return decoder.DecodeInt()[1]
if (self.metadata_type ==
definitions.DatabaseMetaDataKeyType.IDB_INTEGER_VERSION):
return decoder.DecodeVarint()[1]
Expand Down
2 changes: 1 addition & 1 deletion tests/dfindexeddb/indexeddb/chromium/record.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def test_data_version_key(self):
expected_key = record.DataVersionKey(
offset=4, key_prefix=record.KeyPrefix(
offset=0, database_id=0, object_store_id=0, index_id=0))
expected_value = 20
expected_value = 6424509460

record_bytes = ((b'\x00\x00\x00\x00\x02'), (b'\x14\x00\x00\x00\x0f'))
parsed_key = record.DataVersionKey.FromBytes(record_bytes[0])
Expand Down

0 comments on commit 36237cb

Please sign in to comment.