diff options
Diffstat (limited to 'src/libutil/hash.cc')
-rw-r--r-- | src/libutil/hash.cc | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/libutil/hash.cc b/src/libutil/hash.cc index 27bd010956b1..49e781980f3a 100644 --- a/src/libutil/hash.cc +++ b/src/libutil/hash.cc @@ -88,11 +88,11 @@ Hash parseHash(const string & s) { string::size_type colon = s.find(':'); if (colon == string::npos) - throw BadHash(format("invalid hash '%s'") % s); + throw BadHash(format("invalid hash ‘%s’") % s); string hts = string(s, 0, colon); HashType ht = parseHashType(hts); if (ht == htUnknown) - throw BadHash(format("unknown hash type '%s'") % hts); + throw BadHash(format("unknown hash type ‘%s’") % hts); return parseHash16or32(ht, string(s, colon + 1)); } @@ -101,11 +101,11 @@ Hash parseHash(HashType ht, const string & s) { Hash hash(ht); if (s.length() != hash.hashSize * 2) - throw BadHash(format("invalid hash '%1%'") % s); + throw BadHash(format("invalid hash ‘%1%’") % s); for (unsigned int i = 0; i < hash.hashSize; i++) { string s2(s, i * 2, 2); if (!isxdigit(s2[0]) || !isxdigit(s2[1])) - throw BadHash(format("invalid hash '%1%'") % s); + throw BadHash(format("invalid hash ‘%1%’") % s); istringstream_nocopy str(s2); int n; str >> std::hex >> n; @@ -160,7 +160,7 @@ Hash parseHash32(HashType ht, const string & s) for (digit = 0; digit < base32Chars.size(); ++digit) /* !!! slow */ if (base32Chars[digit] == c) break; if (digit >= 32) - throw BadHash(format("invalid base-32 hash '%1%'") % s); + throw BadHash(format("invalid base-32 hash ‘%1%’") % s); unsigned int b = n * 5; unsigned int i = b / 8; unsigned int j = b % 8; @@ -182,7 +182,7 @@ Hash parseHash16or32(HashType ht, const string & s) /* base-32 representation */ hash = parseHash32(ht, s); else - throw BadHash(format("hash '%1%' has wrong length for hash type '%2%'") + throw BadHash(format("hash ‘%1%’ has wrong length for hash type ‘%2%’") % s % printHashType(ht)); return hash; } @@ -256,13 +256,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); } |