chiark / gitweb /
fshash.in: Introduce dummy conversions between binary and text strings.
authorMark Wooding <mdw@distorted.org.uk>
Sat, 1 Jun 2024 03:25:30 +0000 (04:25 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 9 Jun 2024 11:10:59 +0000 (12:10 +0100)
fshash.in

index 1f1a34d3b005e864c5a55fbfbd04bcd02d218880..3d57292c9cf1f8d6ff856ebdb95ad03e04f7cb57 100644 (file)
--- a/fshash.in
+++ b/fshash.in
@@ -41,6 +41,8 @@ VERSION = '@VERSION@'
 ###--------------------------------------------------------------------------
 ### Utilities.
 
+def bin(x): return x
+def text(x): return x
 def excval(): return exc_info()[1]
 
 QUIS = OS.path.basename(argv[0])
@@ -302,7 +304,7 @@ class HashCache (object):
       fi.st = None
       fi.err = excval()
       return None
-    hash = B.hexlify(hash)
+    hash = text(B.hexlify(hash))
 
     ## Insert a record into the database.
     if me._db:
@@ -448,7 +450,7 @@ class Reporter (object):
         suffix = ''
         seq = 0
         while True:
-          vino = '%08x' % (Z.crc32(fi.name + suffix) & 0xffffffff)
+          vino = '%08x' % (Z.crc32(bin(fi.name + suffix)) & 0xffffffff)
           if vino not in me._vinomap: break
           suffix = '\0%d' % seq
           seq += 1