summaryrefslogtreecommitdiffstats
path: root/src/base64.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-11 16:46:30 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-11 16:46:30 +0000
commit8e1187a02b785e56d798660a9a292ca385e1f6aa (patch)
treeb035593aa2ae37c25aeb28b537a3223c52532ab1 /src/base64.h
parentAdding upstream version 1.61.0. (diff)
downloadnghttp2-upstream/1.62.1.tar.xz
nghttp2-upstream/1.62.1.zip
Adding upstream version 1.62.1.upstream/1.62.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/base64.h')
-rw-r--r--src/base64.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/base64.h b/src/base64.h
index 1bd51af..8789427 100644
--- a/src/base64.h
+++ b/src/base64.h
@@ -204,18 +204,19 @@ template <typename InputIt> std::string decode(InputIt first, InputIt last) {
}
template <typename InputIt>
-StringRef decode(BlockAllocator &balloc, InputIt first, InputIt last) {
+std::span<const uint8_t> decode(BlockAllocator &balloc, InputIt first,
+ InputIt last) {
auto len = std::distance(first, last);
if (len % 4 != 0) {
- return StringRef::from_lit("");
+ return {};
}
auto iov = make_byte_ref(balloc, len / 4 * 3 + 1);
- auto p = iov.base;
+ auto p = std::begin(iov);
p = decode(first, last, p);
*p = '\0';
- return StringRef{iov.base, p};
+ return {std::begin(iov), p};
}
} // namespace base64