From 538a64e8c314f23ba0c5d76201f1c20e71884a21 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 4 May 2016 13:36:54 +0200 Subject: 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. --- src/libutil/compression.cc | 16 ++++++++-------- src/libutil/compression.hh | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'src/libutil') diff --git a/src/libutil/compression.cc b/src/libutil/compression.cc index ec63855f6c..cd2cc9cc10 100644 --- a/src/libutil/compression.cc +++ b/src/libutil/compression.cc @@ -173,26 +173,26 @@ static ref decompressBzip2(const std::string & in) } } -ref compress(const std::string & method, ref in) +ref compress(const std::string & method, const std::string & in) { if (method == "none") - return in; + return make_ref(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 decompress(const std::string & method, ref in) +ref decompress(const std::string & method, const std::string & in) { if (method == "none") - return in; + return make_ref(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); } diff --git a/src/libutil/compression.hh b/src/libutil/compression.hh index 33c465df84..ed3c463865 100644 --- a/src/libutil/compression.hh +++ b/src/libutil/compression.hh @@ -7,9 +7,9 @@ namespace nix { -ref compress(const std::string & method, ref in); +ref compress(const std::string & method, const std::string & in); -ref decompress(const std::string & method, ref in); +ref decompress(const std::string & method, const std::string & in); MakeError(UnknownCompressionMethod, Error); -- cgit 1.4.1