##// END OF EJS Templates
util.chunkbuffer: special case reading everything...
Gregory Szorc -
r26478:a3f7e546 default
parent child Browse files
Show More
@@ -1292,10 +1292,13 b' class chunkbuffer(object):'
1292 Returns less than L bytes if the iterator runs dry.
1292 Returns less than L bytes if the iterator runs dry.
1293
1293
1294 If size parameter is omitted, read everything"""
1294 If size parameter is omitted, read everything"""
1295 if l is None:
1296 return ''.join(self.iter)
1297
1295 left = l
1298 left = l
1296 buf = []
1299 buf = []
1297 queue = self._queue
1300 queue = self._queue
1298 while left is None or left > 0:
1301 while left > 0:
1299 # refill the queue
1302 # refill the queue
1300 if not queue:
1303 if not queue:
1301 target = 2**18
1304 target = 2**18
@@ -1308,9 +1311,8 b' class chunkbuffer(object):'
1308 break
1311 break
1309
1312
1310 chunk = queue.popleft()
1313 chunk = queue.popleft()
1311 if left is not None:
1314 left -= len(chunk)
1312 left -= len(chunk)
1315 if left < 0:
1313 if left is not None and left < 0:
1314 queue.appendleft(chunk[left:])
1316 queue.appendleft(chunk[left:])
1315 buf.append(chunk[:left])
1317 buf.append(chunk[:left])
1316 else:
1318 else:
General Comments 0
You need to be logged in to leave comments. Login now