about summary refs log tree commit diff
path: root/src/libstore/store-api.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2008-12-03T16·10+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2008-12-03T16·10+0000
commitff762fb499be220ccd680f3bf68dca44a902a5ff (patch)
tree02f738ec60517e3eadd5b0a2bc2fe5c19c3d954c /src/libstore/store-api.cc
parent1307b222239da8e503d22ad9316789e30b4e2431 (diff)
* Pass HashType values instead of strings.
Diffstat (limited to 'src/libstore/store-api.cc')
-rw-r--r--src/libstore/store-api.cc11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc
index fe4ecfad54..bd330a6da9 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);