X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=bup.git;a=blobdiff_plain;f=lib%2Fbup%2Fhashsplit.py;fp=lib%2Fbup%2Fhashsplit.py;h=0ae6acdb669a624a58688e3bc760ba01d0a35ddd;hp=dc3a538fe52d329537a3021c289dca16c9692de7;hb=bd08128284ab3c4444f09071e7deeb3fb0684ce4;hpb=bf67f94dd4f4096de4eee07a7dc377d6c889a016;ds=sidebyside diff --git a/lib/bup/hashsplit.py b/lib/bup/hashsplit.py index dc3a538..0ae6acd 100644 --- a/lib/bup/hashsplit.py +++ b/lib/bup/hashsplit.py @@ -3,7 +3,8 @@ from __future__ import absolute_import import io, math, os from bup import _helpers, compat, helpers -from bup.compat import buffer, join_bytes +from bup._helpers import cat_bytes +from bup.compat import buffer, py_maj from bup.helpers import sc_page_size @@ -29,10 +30,14 @@ class Buf: def put(self, s): if s: - self.data = join_bytes(buffer(self.data, self.start), s) + remaining = len(self.data) - self.start + self.data = cat_bytes(self.data, self.start, remaining, + s, 0, len(s)) self.start = 0 def peek(self, count): + if count <= 256: + return self.data[self.start : self.start + count] return buffer(self.data, self.start, count) def eat(self, count):