Fix warnings from python difflib.
git-svn-id: svn://svn.chromium.org/llvm-project/cfe/trunk/tools/clang-format@285291 0b72dbe1-c17f-4bc7-b9db-2b4152be0356
diff --git a/clang-format.py b/clang-format.py
index 6a57406..5a5f99b 100644
--- a/clang-format.py
+++ b/clang-format.py
@@ -51,8 +51,8 @@
def main():
# Get the current text.
encoding = vim.eval("&encoding")
- buf = vim.current.buffer
- text = unicode('\n'.join(buf), encoding)
+ buf = [ unicode(line, encoding) for line in vim.current.buffer ]
+ text = '\n'.join(buf)
# Determine range to format.
if vim.eval('exists("l:lines")') == '1':
@@ -99,7 +99,7 @@
lines = stdout.decode(encoding).split('\n')
output = json.loads(lines[0])
lines = lines[1:]
- sequence = difflib.SequenceMatcher(None, vim.current.buffer, lines)
+ sequence = difflib.SequenceMatcher(None, buf, lines)
for op in reversed(sequence.get_opcodes()):
if op[0] is not 'equal':
vim.current.buffer[op[1]:op[2]] = lines[op[3]:op[4]]