about summary refs log tree commit diff
path: root/src/libutil/compression.cc
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2016-05-04T11·36+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2016-05-04T14·15+0200
commit538a64e8c314f23ba0c5d76201f1c20e71884a21 (patch)
tree34bdfda7346d53014619cbfa33bf1398bad4b5e2 /src/libutil/compression.cc
parentb6c768fb6a341bf1c5fe4a2d2a929415e8519b25 (diff)
Add a Store::addToStore() variant that accepts a NAR
As a side effect, this ensures that signatures are propagated when
copying paths between stores.

Also refactored import/export to make use of this.
Diffstat (limited to 'src/libutil/compression.cc')
-rw-r--r--src/libutil/compression.cc16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/libutil/compression.cc b/src/libutil/compression.cc
index ec63855f6c4b..cd2cc9cc10fa 100644
--- a/src/libutil/compression.cc
+++ b/src/libutil/compression.cc
@@ -173,26 +173,26 @@ static ref<std::string> decompressBzip2(const std::string & in)
     }
 }
 
-ref<std::string> compress(const std::string & method, ref<std::string> in)
+ref<std::string> compress(const std::string & method, const std::string & in)
 {
     if (method == "none")
-        return in;
+        return make_ref<std::string>(in);
     else if (method == "xz")
-        return compressXZ(*in);
+        return compressXZ(in);
     else if (method == "bzip2")
-        return compressBzip2(*in);
+        return compressBzip2(in);
     else
         throw UnknownCompressionMethod(format("unknown compression method ‘%s’") % method);
 }
 
-ref<std::string> decompress(const std::string & method, ref<std::string> in)
+ref<std::string> decompress(const std::string & method, const std::string & in)
 {
     if (method == "none")
-        return in;
+        return make_ref<std::string>(in);
     else if (method == "xz")
-        return decompressXZ(*in);
+        return decompressXZ(in);
     else if (method == "bzip2")
-        return decompressBzip2(*in);
+        return decompressBzip2(in);
     else
         throw UnknownCompressionMethod(format("unknown compression method ‘%s’") % method);
 }