aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/serialise.cc
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2022-03-10 17:03:16 +0000
committerJohn Ericson <John.Ericson@Obsidian.Systems>2022-03-10 17:10:15 +0000
commite5c42bba9bf76d00fb15ec9a179bf91aa81c38c6 (patch)
tree7597549f36313859d15cb4ae80c04af955c9a223 /src/libutil/serialise.cc
parent1ef88da3503b88f289a15786dfd48821cf5b6502 (diff)
parent4d98143914120d0163f5c50f30ce8a5289433f8f (diff)
Merge remote-tracking branch 'upstream/master' into indexed-store-path-outputs
Diffstat (limited to 'src/libutil/serialise.cc')
-rw-r--r--src/libutil/serialise.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/libutil/serialise.cc b/src/libutil/serialise.cc
index 16f3476c2..6445b3f1b 100644
--- a/src/libutil/serialise.cc
+++ b/src/libutil/serialise.cc
@@ -110,7 +110,7 @@ std::string Source::drain()
{
StringSink s;
drainInto(s);
- return *s.s;
+ return std::move(s.s);
}
@@ -325,7 +325,7 @@ void writeString(std::string_view data, Sink & sink)
}
-Sink & operator << (Sink & sink, const string & s)
+Sink & operator << (Sink & sink, std::string_view s)
{
writeString(s, sink);
return sink;
@@ -391,7 +391,7 @@ size_t readString(char * buf, size_t max, Source & source)
}
-string readString(Source & source, size_t max)
+std::string readString(Source & source, size_t max)
{
auto len = readNum<size_t>(source);
if (len > max) throw SerialisationError("string is too long");
@@ -401,7 +401,7 @@ string readString(Source & source, size_t max)
return res;
}
-Source & operator >> (Source & in, string & s)
+Source & operator >> (Source & in, std::string & s)
{
s = readString(in);
return in;
@@ -450,11 +450,11 @@ Error readError(Source & source)
void StringSink::operator () (std::string_view data)
{
static bool warned = false;
- if (!warned && s->size() > threshold) {
+ if (!warned && s.size() > threshold) {
warnLargeDump();
warned = true;
}
- s->append(data);
+ s.append(data);
}
size_t ChainSource::read(char * data, size_t len)