1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-17 09:22:42 +01:00

Codechange: use std::span over char* for writing the buffers

This commit is contained in:
Rubidium
2025-05-04 11:10:32 +02:00
committed by rubidium42
parent 6817f52d9b
commit 4255a94779
4 changed files with 12 additions and 19 deletions

View File

@@ -32,12 +32,12 @@
/**
* Append buffer.
*/
void InPlaceBuilder::PutBuffer(const char *str, size_type len)
void InPlaceBuilder::PutBuffer(std::span<const char> str)
{
auto unused = this->GetBytesUnused();
if (len > unused) NOT_REACHED();
std::copy(str, str + len, this->dest.data() + this->position);
this->position += len;
if (str.size() > unused) NOT_REACHED();
std::ranges::copy(str, this->dest.data() + this->position);
this->position += str.size();
}
/**