equal
deleted
inserted
replaced
95 end = pos + plen |
95 end = pos + plen |
96 last = 0 |
96 last = 0 |
97 while pos < end: |
97 while pos < end: |
98 m.seek(pos) |
98 m.seek(pos) |
99 try: |
99 try: |
100 p1, p2, l = struct.unpack(">lll", m.read(12)) |
100 p1, p2, l = struct.unpack(b">lll", m.read(12)) |
101 except struct.error: |
101 except struct.error: |
102 raise mpatchError("patch cannot be decoded") |
102 raise mpatchError(b"patch cannot be decoded") |
103 _pull(new, frags, p1 - last) # what didn't change |
103 _pull(new, frags, p1 - last) # what didn't change |
104 _pull([], frags, p2 - p1) # what got deleted |
104 _pull([], frags, p2 - p1) # what got deleted |
105 new.append((l, pos + 12)) # what got added |
105 new.append((l, pos + 12)) # what got added |
106 pos += l + 12 |
106 pos += l + 12 |
107 last = p2 |
107 last = p2 |
118 binend = len(delta) |
118 binend = len(delta) |
119 data = 12 |
119 data = 12 |
120 |
120 |
121 while data <= binend: |
121 while data <= binend: |
122 decode = delta[bin : bin + 12] |
122 decode = delta[bin : bin + 12] |
123 start, end, length = struct.unpack(">lll", decode) |
123 start, end, length = struct.unpack(b">lll", decode) |
124 if start > end: |
124 if start > end: |
125 break |
125 break |
126 bin = data + length |
126 bin = data + length |
127 data = bin + 12 |
127 data = bin + 12 |
128 outlen += start - last |
128 outlen += start - last |
129 last = end |
129 last = end |
130 outlen += length |
130 outlen += length |
131 |
131 |
132 if bin != binend: |
132 if bin != binend: |
133 raise mpatchError("patch cannot be decoded") |
133 raise mpatchError(b"patch cannot be decoded") |
134 |
134 |
135 outlen += orig - last |
135 outlen += orig - last |
136 return outlen |
136 return outlen |