mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-31 03:29:50 +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)
|
||||
|
||||
self.logger = logging.getLogger ("linecache")
|
||||
|
||||
self.offsets = []
|
||||
self.levels = [] # FIXME
|
||||
self.dispatcher = dispatcher
|
||||
|
||||
import mmap
|
||||
|
@ -181,6 +178,18 @@ class LineCache (Producer):
|
|||
self.__file_size = self.__fileobj.tell ()
|
||||
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):
|
||||
|
||||
self.logger.debug ("dispatching load process")
|
||||
|
|
Loading…
Reference in a new issue