diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2008-12-03T16·10+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2008-12-03T16·10+0000 |
commit | ff762fb499be220ccd680f3bf68dca44a902a5ff (patch) | |
tree | 02f738ec60517e3eadd5b0a2bc2fe5c19c3d954c /src/libstore/store-api.cc | |
parent | 1307b222239da8e503d22ad9316789e30b4e2431 (diff) |
* Pass HashType values instead of strings.
Diffstat (limited to 'src/libstore/store-api.cc')
-rw-r--r-- | src/libstore/store-api.cc | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc index fe4ecfad5443..bd330a6da9a7 100644 --- a/src/libstore/store-api.cc +++ b/src/libstore/store-api.cc @@ -183,20 +183,21 @@ Path makeStorePath(const string & type, Path makeFixedOutputPath(bool recursive, - string hashAlgo, Hash hash, string name) + HashType hashAlgo, Hash hash, string name) { - return hashAlgo == "sha256" && recursive + return hashAlgo == htSHA256 && recursive ? makeStorePath("source", hash, name) : makeStorePath("output:out", hashString(htSHA256, - "fixed:out:" + (recursive ? (string) "r:" : "") + hashAlgo + ":" + printHash(hash) + ":"), + "fixed:out:" + (recursive ? (string) "r:" : "") + + printHashType(hashAlgo) + ":" + printHash(hash) + ":"), name); } std::pair<Path, Hash> computeStorePathForPath(const Path & srcPath, - bool recursive, string hashAlgo, PathFilter & filter) + bool recursive, HashType hashAlgo, PathFilter & filter) { - HashType ht(parseHashType(hashAlgo)); + HashType ht(hashAlgo); Hash h = recursive ? hashPath(ht, srcPath, filter) : hashFile(ht, srcPath); string name = baseNameOf(srcPath); Path dstPath = makeFixedOutputPath(recursive, hashAlgo, h, name); |