pdfium/testing/string_write_stream.cpp
Tom Sepez d2acd3a130 Avoid reinterpret span when casting to bytes
Most reinterpret_span<> usage should be avoided, and there are better
functions for the single-byte conversions in span.h itself.

Change-Id: I5ed8311855756c4696c14fa5e8e4da1ed9938924
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/120630
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Thomas Sepez <tsepez@google.com>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
2024-06-19 04:58:24 +00:00

20 lines
568 B
C++

// Copyright 2018 The PDFium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "testing/string_write_stream.h"
#include "core/fxcrt/bytestring.h"
#include "core/fxcrt/span_util.h"
#include "core/fxcrt/widestring.h"
StringWriteStream::StringWriteStream() = default;
StringWriteStream::~StringWriteStream() = default;
bool StringWriteStream::WriteBlock(pdfium::span<const uint8_t> buffer) {
auto chars = pdfium::as_chars(buffer);
stream_.write(chars.data(), chars.size());
return true;
}