diff mercurial/cffi/bdiff.py @ 43077:687b865b95ad

formatting: byteify all mercurial/ and hgext/ string literals Done with python3.7 contrib/byteify-strings.py -i $(hg files 'set:mercurial/**.py - mercurial/thirdparty/** + hgext/**.py - hgext/fsmonitor/pywatchman/** - mercurial/__init__.py') black -l 80 -t py33 -S $(hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**" - hgext/fsmonitor/pywatchman/**') # skip-blame mass-reformatting only Differential Revision: https://phab.mercurial-scm.org/D6972
author Augie Fackler <augie@google.com>
date Sun, 06 Oct 2019 09:48:39 -0400
parents 2372284d9457
children 521ac0d7047f
line wrap: on
line diff
--- a/mercurial/cffi/bdiff.py	Sun Oct 06 09:45:02 2019 -0400
+++ b/mercurial/cffi/bdiff.py	Sun Oct 06 09:48:39 2019 -0400
@@ -17,11 +17,11 @@
 
 
 def blocks(sa, sb):
-    a = ffi.new("struct bdiff_line**")
-    b = ffi.new("struct bdiff_line**")
-    ac = ffi.new("char[]", str(sa))
-    bc = ffi.new("char[]", str(sb))
-    l = ffi.new("struct bdiff_hunk*")
+    a = ffi.new(b"struct bdiff_line**")
+    b = ffi.new(b"struct bdiff_line**")
+    ac = ffi.new(b"char[]", str(sa))
+    bc = ffi.new(b"char[]", str(sb))
+    l = ffi.new(b"struct bdiff_hunk*")
     try:
         an = lib.bdiff_splitlines(ac, len(sa), a)
         bn = lib.bdiff_splitlines(bc, len(sb), b)
@@ -45,11 +45,11 @@
 
 
 def bdiff(sa, sb):
-    a = ffi.new("struct bdiff_line**")
-    b = ffi.new("struct bdiff_line**")
-    ac = ffi.new("char[]", str(sa))
-    bc = ffi.new("char[]", str(sb))
-    l = ffi.new("struct bdiff_hunk*")
+    a = ffi.new(b"struct bdiff_line**")
+    b = ffi.new(b"struct bdiff_line**")
+    ac = ffi.new(b"char[]", str(sa))
+    bc = ffi.new(b"char[]", str(sb))
+    l = ffi.new(b"struct bdiff_hunk*")
     try:
         an = lib.bdiff_splitlines(ac, len(sa), a)
         bn = lib.bdiff_splitlines(bc, len(sb), b)
@@ -66,7 +66,7 @@
                 lgt = (b[0] + h.b1).l - (b[0] + lb).l
                 rl.append(
                     struct.pack(
-                        ">lll",
+                        b">lll",
                         (a[0] + la).l - a[0].l,
                         (a[0] + h.a1).l - a[0].l,
                         lgt,
@@ -81,4 +81,4 @@
         lib.free(a[0])
         lib.free(b[0])
         lib.bdiff_freehunks(l.next)
-    return "".join(rl)
+    return b"".join(rl)