about summary refs log tree commit diff
path: root/src/libutil/hash.cc
diff options
context:
space:
mode:
authorJörg Thalheim <joerg@thalheim.io>2017-07-30T11·27+0100
committerJörg Thalheim <joerg@thalheim.io>2017-07-30T11·32+0100
commit2fd8f8bb99a2832b3684878c020ba47322e79332 (patch)
tree65a667fbc746f4ff8efcaca3c0a58565985f26a5 /src/libutil/hash.cc
parentc7654bc491d9ce7c1fbadecd7769418fa79a2060 (diff)
Replace Unicode quotes in user-facing strings by ASCII
Relevant RFC: NixOS/rfcs#4

$ ag -l | xargs sed -i -e "/\"/s/’/'/g;/\"/s/‘/'/g"
Diffstat (limited to 'src/libutil/hash.cc')
-rw-r--r--src/libutil/hash.cc18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/libutil/hash.cc b/src/libutil/hash.cc
index e16c3b6ea93f..11e3c9dca58a 100644
--- a/src/libutil/hash.cc
+++ b/src/libutil/hash.cc
@@ -133,14 +133,14 @@ Hash::Hash(const std::string & s, HashType type)
 
     if (colon == string::npos) {
         if (type == htUnknown)
-            throw BadHash("hash ‘%s’ does not include a type", s);
+            throw BadHash("hash '%s' does not include a type", s);
     } else {
         string hts = string(s, 0, colon);
         this->type = parseHashType(hts);
         if (this->type == htUnknown)
-            throw BadHash("unknown hash type ‘%s’", hts);
+            throw BadHash("unknown hash type '%s'", hts);
         if (type != htUnknown && type != this->type)
-            throw BadHash("hash ‘%s’ should have type ‘%s’", s, printHashType(type));
+            throw BadHash("hash '%s' should have type '%s'", s, printHashType(type));
         pos = colon + 1;
     }
 
@@ -154,7 +154,7 @@ Hash::Hash(const std::string & s, HashType type)
             if (c >= '0' && c <= '9') return c - '0';
             if (c >= 'A' && c <= 'F') return c - 'A' + 10;
             if (c >= 'a' && c <= 'f') return c - 'a' + 10;
-            throw BadHash("invalid base-16 hash ‘%s’", s);
+            throw BadHash("invalid base-16 hash '%s'", s);
         };
 
         for (unsigned int i = 0; i < hashSize; i++) {
@@ -172,7 +172,7 @@ Hash::Hash(const std::string & s, HashType type)
             for (digit = 0; digit < base32Chars.size(); ++digit) /* !!! slow */
                 if (base32Chars[digit] == c) break;
             if (digit >= 32)
-                throw BadHash("invalid base-32 hash ‘%s’", s);
+                throw BadHash("invalid base-32 hash '%s'", s);
             unsigned int b = n * 5;
             unsigned int i = b / 8;
             unsigned int j = b % 8;
@@ -182,7 +182,7 @@ Hash::Hash(const std::string & s, HashType type)
                 hash[i + 1] |= digit >> (8 - j);
             } else {
                 if (digit >> (8 - j))
-                    throw BadHash("invalid base-32 hash ‘%s’", s);
+                    throw BadHash("invalid base-32 hash '%s'", s);
             }
         }
     }
@@ -194,7 +194,7 @@ Hash::Hash(const std::string & s, HashType type)
     }
 
     else
-        throw BadHash("hash ‘%s’ has wrong length for hash type ‘%s’", s, printHashType(type));
+        throw BadHash("hash '%s' has wrong length for hash type '%s'", s, printHashType(type));
 }
 
 
@@ -253,13 +253,13 @@ Hash hashFile(HashType ht, const Path & path)
     start(ht, ctx);
 
     AutoCloseFD fd = open(path.c_str(), O_RDONLY | O_CLOEXEC);
-    if (!fd) throw SysError(format("opening file ‘%1%’") % path);
+    if (!fd) throw SysError(format("opening file '%1%'") % path);
 
     unsigned char buf[8192];
     ssize_t n;
     while ((n = read(fd.get(), buf, sizeof(buf)))) {
         checkInterrupt();
-        if (n == -1) throw SysError(format("reading file ‘%1%’") % path);
+        if (n == -1) throw SysError(format("reading file '%1%'") % path);
         update(ht, ctx, buf, n);
     }