From 6e3556ab1214bfe256f2bb9c14144202f10e5e42 Mon Sep 17 00:00:00 2001 From: Aaron Griffith Date: Mon, 6 May 2013 18:11:45 -0300 Subject: [PATCH] nbt timestamps are probably signed (like time_t) Besides, we get overflow errors with utime on windows for large unsigned 32-bit integers. --- overviewer_core/nbt.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/overviewer_core/nbt.py b/overviewer_core/nbt.py index 3d69f8b..cadeccf 100644 --- a/overviewer_core/nbt.py +++ b/overviewer_core/nbt.py @@ -199,7 +199,8 @@ class MCRFileReader(object): listing chunks contained in the file. """ - _table_format = struct.Struct(">1024I") + _location_table_format = struct.Struct(">1024I") + _timestamp_table_format = struct.Struct(">1024i") _chunk_header_format = struct.Struct(">I B") def __init__(self, fileobj): @@ -217,8 +218,8 @@ class MCRFileReader(object): raise CorruptRegionError("invalid timestamp table") # turn this data into a useful list - self._locations = self._table_format.unpack(location_data) - self._timestamps = self._table_format.unpack(timestamp_data) + self._locations = self._location_table_format.unpack(location_data) + self._timestamps = self._timestamp_table_format.unpack(timestamp_data) def close(self): """Close the region file and free any resources associated