mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-31 11:32:38 +00:00
Use an array for line offset mapping (if file < 4GB)
This commit is contained in:
parent
03713f4a0e
commit
75d1ff49e4
1 changed files with 12 additions and 3 deletions
|
@ -169,9 +169,6 @@ class LineCache (Producer):
|
||||||
Producer.__init__ (self)
|
Producer.__init__ (self)
|
||||||
|
|
||||||
self.logger = logging.getLogger ("linecache")
|
self.logger = logging.getLogger ("linecache")
|
||||||
|
|
||||||
self.offsets = []
|
|
||||||
self.levels = [] # FIXME
|
|
||||||
self.dispatcher = dispatcher
|
self.dispatcher = dispatcher
|
||||||
|
|
||||||
import mmap
|
import mmap
|
||||||
|
@ -181,6 +178,18 @@ class LineCache (Producer):
|
||||||
self.__file_size = self.__fileobj.tell ()
|
self.__file_size = self.__fileobj.tell ()
|
||||||
self.__fileobj.seek (0)
|
self.__fileobj.seek (0)
|
||||||
|
|
||||||
|
from array import array
|
||||||
|
offsets = array ("L")
|
||||||
|
try:
|
||||||
|
offsets.append (self.__file_size)
|
||||||
|
except OverflowError:
|
||||||
|
offsets = []
|
||||||
|
else:
|
||||||
|
del offsets[0]
|
||||||
|
self.offsets = offsets
|
||||||
|
|
||||||
|
self.levels = [] # FIXME
|
||||||
|
|
||||||
def start_loading (self):
|
def start_loading (self):
|
||||||
|
|
||||||
self.logger.debug ("dispatching load process")
|
self.logger.debug ("dispatching load process")
|
||||||
|
|
Loading…
Reference in a new issue