From 86e7dff2fcb120a51ed9bb7b4fcf13d699ffa4fc Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 5 Oct 2023 10:52:09 +0200 Subject: [PATCH] util/TextFile: add missing cast --- src/util/TextFile.hxx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/util/TextFile.hxx b/src/util/TextFile.hxx index d29d7ffd0..c7a849229 100644 --- a/src/util/TextFile.hxx +++ b/src/util/TextFile.hxx @@ -11,16 +11,17 @@ char * ReadBufferedLine(B &buffer) { auto r = buffer.Read(); - char *newline = reinterpret_cast(std::memchr(r.data(), '\n', r.size())); + char *data = reinterpret_cast(r.data()); + char *newline = reinterpret_cast(std::memchr(data, '\n', r.size())); if (newline == nullptr) return nullptr; - buffer.Consume(newline + 1 - r.data()); + buffer.Consume(newline + 1 - data); - if (newline > r.data() && newline[-1] == '\r') + if (newline > data && newline[-1] == '\r') --newline; *newline = 0; - return r.data(); + return data; } #endif