##// 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 class chunkbuffer(object):
1292 1292 Returns less than L bytes if the iterator runs dry.
1293 1293
1294 1294 If size parameter is omitted, read everything"""
1295 if l is None:
1296 return ''.join(self.iter)
1297
1295 1298 left = l
1296 1299 buf = []
1297 1300 queue = self._queue
1298 while left is None or left > 0:
1301 while left > 0:
1299 1302 # refill the queue
1300 1303 if not queue:
1301 1304 target = 2**18
@@ -1308,9 +1311,8 class chunkbuffer(object):
1308 1311 break
1309 1312
1310 1313 chunk = queue.popleft()
1311 if left is not None:
1312 1314 left -= len(chunk)
1313 if left is not None and left < 0:
1315 if left < 0:
1314 1316 queue.appendleft(chunk[left:])
1315 1317 buf.append(chunk[:left])
1316 1318 else:
General Comments 0
You need to be logged in to leave comments. Login now