diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2003-10-08T15·06+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2003-10-08T15·06+0000 |
commit | 6baa2c442035fb06652a7fad9d51df1ce41c05f9 (patch) | |
tree | c77e57b30ea01fd7ae76ca04a7d8bbc13a1a3979 /src/hash.cc | |
parent | b9f4942bd2f8aae44db6caa5a4ebe5680880fec2 (diff) |
* Get rid of identifiers since they are redundant now. This greatly
simplifies stuff. * The format of Nix expressions and the database schema changed because of this, so it's best to delete old Nix installations.
Diffstat (limited to 'src/hash.cc')
-rw-r--r-- | src/hash.cc | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/hash.cc b/src/hash.cc index b59c4f214831..752b269125cb 100644 --- a/src/hash.cc +++ b/src/hash.cc @@ -54,11 +54,11 @@ Hash parseHash(const string & s) { Hash hash; if (s.length() != Hash::hashSize * 2) - throw BadRefError("invalid hash: " + s); + throw Error(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 BadRefError("invalid hash: " + s); + throw Error(format("invalid hash `%1%'") % s); istringstream str(s2); int n; str >> hex >> n; @@ -89,15 +89,15 @@ Hash hashString(const string & s) } -Hash hashFile(const string & fileName) +Hash hashFile(const Path & path) { Hash hash; - FILE * file = fopen(fileName.c_str(), "rb"); + FILE * file = fopen(path.c_str(), "rb"); if (!file) - throw SysError("file `" + fileName + "' does not exist"); + throw SysError(format("file `%1%' does not exist") % path); int err = md5_stream(file, hash.hash); fclose(file); - if (err) throw SysError("cannot hash file " + fileName); + if (err) throw SysError(format("cannot hash file `%1%'") % path); return hash; } @@ -113,7 +113,7 @@ struct HashSink : DumpSink }; -Hash hashPath(const string & path) +Hash hashPath(const Path & path) { Hash hash; HashSink sink; |