From: Artem Bityutskiy Date: Mon, 6 May 2013 12:13:49 +0000 (+0300) Subject: TransRead: allow reading entire file X-Git-Tag: v2.5~43 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9c2a07ac844774c62b86da6e590744aedb09a67f;p=tools%2Fbmap-tools.git TransRead: allow reading entire file The 'read()' method of python file objects does not require the user specifying the size, and allows for negative size as well. In this case it just reads entire file. Ament TransRead to also follow this convention. Change-Id: I3c0c645d458654711f3dc7a832aaec427d4abd00 Signed-off-by: Artem Bityutskiy --- diff --git a/bmaptools/TransRead.py b/bmaptools/TransRead.py index 834f6c1..fd184da 100644 --- a/bmaptools/TransRead.py +++ b/bmaptools/TransRead.py @@ -266,10 +266,13 @@ class TransRead: self._open_compressed_file() - def read(self, size): + def read(self, size = -1): """ Read the data from the file or URL and and uncompress it on-the-fly if necessary. """ + if size < 0: + size = 0xFFFFFFFFFFFFFFFF + buf = self._transfile_obj.read(size) self._pos += len(buf)