diff options
Diffstat (limited to 'src/libutil')
-rw-r--r-- | src/libutil/compression.cc | 16 | ||||
-rw-r--r-- | src/libutil/compression.hh | 4 |
2 files changed, 10 insertions, 10 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); } diff --git a/src/libutil/compression.hh b/src/libutil/compression.hh index 33c465df8455..ed3c463865c1 100644 --- a/src/libutil/compression.hh +++ b/src/libutil/compression.hh @@ -7,9 +7,9 @@ namespace nix { -ref<std::string> compress(const std::string & method, ref<std::string> in); +ref<std::string> compress(const std::string & method, const std::string & in); -ref<std::string> decompress(const std::string & method, ref<std::string> in); +ref<std::string> decompress(const std::string & method, const std::string & in); MakeError(UnknownCompressionMethod, Error); |