Show More
@@ -53,6 +53,16 b' def diff(a, b, sorted=0):' | |||||
53 |
|
53 | |||
54 | return "".join(bin) |
|
54 | return "".join(bin) | |
55 |
|
55 | |||
|
56 | def patchtext(bin): | |||
|
57 | pos = 0 | |||
|
58 | t = [] | |||
|
59 | while pos < len(bin): | |||
|
60 | p1, p2, l = struct.unpack(">lll", bin[pos:pos + 12]) | |||
|
61 | pos += 12 | |||
|
62 | t.append(bin[pos:pos + l]) | |||
|
63 | pos += l | |||
|
64 | return "".join(t) | |||
|
65 | ||||
56 | # This attempts to apply a series of patches in time proportional to |
|
66 | # This attempts to apply a series of patches in time proportional to | |
57 | # the total size of the patches, rather than patches * len(text). This |
|
67 | # the total size of the patches, rather than patches * len(text). This | |
58 | # means rather than shuffling strings around, we shuffle around |
|
68 | # means rather than shuffling strings around, we shuffle around |
General Comments 0
You need to be logged in to leave comments.
Login now