Replace spancpy() with fxcrt::Copy() where possible.
Remaining usages should be places where the return value was used, or
in some templates. This is more consistent with the future vocabulary
to be used in Chrome. It also can avoid some explicit span calls.
Change-Id: I4872c8448cc606b1f3a36f3e73d7372b67026ab1
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/120852
Reviewed-by: Thomas Sepez <tsepez@google.com>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fdrm/fx_crypt.cpp b/core/fdrm/fx_crypt.cpp
index 134aceb..49f2a90 100644
--- a/core/fdrm/fx_crypt.cpp
+++ b/core/fdrm/fx_crypt.cpp
@@ -9,7 +9,7 @@
#include <utility>
#include "core/fxcrt/compiler_specific.h"
-#include "core/fxcrt/span_util.h"
+#include "core/fxcrt/stl_util.h"
#define GET_UINT32(n, b, i) \
UNSAFE_TODO({ \
@@ -200,7 +200,7 @@
const pdfium::span<uint8_t> buffer_span = pdfium::make_span(context->buffer);
if (left && data.size() >= fill) {
- fxcrt::spancpy(buffer_span.subspan(left), data.first(fill));
+ fxcrt::Copy(data.first(fill), buffer_span.subspan(left));
md5_process(context, context->buffer);
data = data.subspan(fill);
left = 0;
@@ -209,8 +209,9 @@
md5_process(context, data.data());
data = data.subspan(64);
}
- if (!data.empty())
- fxcrt::spancpy(buffer_span.subspan(left), data);
+ if (!data.empty()) {
+ fxcrt::Copy(data, buffer_span.subspan(left));
+ }
}
void CRYPT_MD5Finish(CRYPT_md5_context* context, uint8_t digest[16]) {
diff --git a/core/fdrm/fx_crypt_sha.cpp b/core/fdrm/fx_crypt_sha.cpp
index 963a0da..3b47e03 100644
--- a/core/fdrm/fx_crypt_sha.cpp
+++ b/core/fdrm/fx_crypt_sha.cpp
@@ -8,7 +8,6 @@
#include "core/fxcrt/compiler_specific.h"
#include "core/fxcrt/fx_memcpy_wrappers.h"
-#include "core/fxcrt/span_util.h"
#include "core/fxcrt/stl_util.h"
#define SHA_GET_UINT32(n, b, i) \
@@ -376,14 +375,14 @@
const auto block_span = pdfium::make_span(context->block);
context->total_bytes += data.size();
if (context->blkused && data.size() < 64 - context->blkused) {
- fxcrt::spancpy(block_span.subspan(context->blkused), data);
+ fxcrt::Copy(data, block_span.subspan(context->blkused));
context->blkused += data.size();
return;
}
std::array<uint32_t, 16> wordblock;
while (data.size() >= 64 - context->blkused) {
- fxcrt::spancpy(block_span.subspan(context->blkused),
- data.first(64 - context->blkused));
+ fxcrt::Copy(data.first(64 - context->blkused),
+ block_span.subspan(context->blkused));
data = data.subspan(64 - context->blkused);
for (int i = 0; i < 16; i++) {
wordblock[i] = (((uint32_t)context->block[i * 4 + 0]) << 24) |
@@ -394,7 +393,7 @@
SHATransform(context->h, wordblock);
context->blkused = 0;
}
- fxcrt::spancpy(block_span, data);
+ fxcrt::Copy(data, block_span);
context->blkused = static_cast<uint32_t>(data.size());
}
@@ -461,7 +460,7 @@
uint32_t fill = 64 - left;
context->total_bytes += data.size();
if (left && data.size() >= fill) {
- fxcrt::spancpy(buffer_span.subspan(left), data.first(fill));
+ fxcrt::Copy(data.first(fill), buffer_span.subspan(left));
sha256_process(context, buffer_span);
data = data.subspan(fill);
left = 0;
@@ -471,7 +470,7 @@
data = data.subspan(64u);
}
if (!data.empty()) {
- fxcrt::spancpy(buffer_span.subspan(left), data);
+ fxcrt::Copy(data, buffer_span.subspan(left));
}
}
@@ -527,7 +526,7 @@
uint32_t fill = 128 - left;
context->total_bytes += data.size();
if (left && data.size() >= fill) {
- fxcrt::spancpy(buffer_span.subspan(left), data.first(fill));
+ fxcrt::Copy(data.first(fill), buffer_span.subspan(left));
sha384_process(context, buffer_span);
data = data.subspan(fill);
left = 0;
@@ -537,7 +536,7 @@
data = data.subspan(128);
}
if (!data.empty()) {
- fxcrt::spancpy(buffer_span.subspan(left), data);
+ fxcrt::Copy(data, buffer_span.subspan(left));
}
}
diff --git a/core/fpdfapi/page/cpdf_colorspace.cpp b/core/fpdfapi/page/cpdf_colorspace.cpp
index f250880..b3b68a4 100644
--- a/core/fpdfapi/page/cpdf_colorspace.cpp
+++ b/core/fpdfapi/page/cpdf_colorspace.cpp
@@ -45,7 +45,6 @@
#include "core/fxcrt/maybe_owned.h"
#include "core/fxcrt/notreached.h"
#include "core/fxcrt/scoped_set_insertion.h"
-#include "core/fxcrt/span_util.h"
#include "core/fxcrt/stl_util.h"
#include "core/fxge/dib/fx_dib.h"
@@ -458,7 +457,7 @@
PatternValue::~PatternValue() = default;
void PatternValue::SetComps(pdfium::span<const float> comps) {
- fxcrt::spancpy(pdfium::make_span(m_Comps), comps);
+ fxcrt::Copy(comps, m_Comps);
}
// static
diff --git a/core/fpdfapi/page/cpdf_dib.cpp b/core/fpdfapi/page/cpdf_dib.cpp
index 421af3f..6bb3c2e 100644
--- a/core/fpdfapi/page/cpdf_dib.cpp
+++ b/core/fpdfapi/page/cpdf_dib.cpp
@@ -39,7 +39,6 @@
#include "core/fxcrt/data_vector.h"
#include "core/fxcrt/fx_memcpy_wrappers.h"
#include "core/fxcrt/fx_safe_types.h"
-#include "core/fxcrt/span_util.h"
#include "core/fxcrt/stl_util.h"
#include "core/fxge/calculate_pitch.h"
#include "core/fxge/dib/cfx_dibitmap.h"
@@ -1185,9 +1184,8 @@
pSrcLine = remaining_bytes.first(src_pitch_value);
} else {
temp_buffer = DataVector<uint8_t>(src_pitch_value);
- pdfium::span<uint8_t> result = temp_buffer;
- fxcrt::spancpy(result, remaining_bytes);
- pSrcLine = result;
+ fxcrt::Copy(remaining_bytes, temp_buffer);
+ pSrcLine = temp_buffer;
}
}
@@ -1205,9 +1203,8 @@
return pdfium::make_span(m_LineBuf).first(src_pitch_value);
}
if (!m_bColorKey) {
- pdfium::span<uint8_t> result = m_LineBuf;
- fxcrt::spancpy(result, pSrcLine.first(src_pitch_value));
- return result.first(src_pitch_value);
+ fxcrt::Copy(pSrcLine.first(src_pitch_value), m_LineBuf);
+ return pdfium::make_span(m_LineBuf).first(src_pitch_value);
}
uint32_t reset_argb = Get1BitResetValue();
uint32_t set_argb = Get1BitSetValue();
@@ -1222,7 +1219,7 @@
if (m_bpc * m_nComponents <= 8) {
pdfium::span<uint8_t> result = m_LineBuf;
if (m_bpc == 8) {
- fxcrt::spancpy(result, pSrcLine.first(src_pitch_value));
+ fxcrt::Copy(pSrcLine.first(src_pitch_value), result);
result = result.first(src_pitch_value);
} else {
uint64_t src_bit_pos = 0;
diff --git a/core/fpdfapi/page/cpdf_image.cpp b/core/fpdfapi/page/cpdf_image.cpp
index 7f5e61a..9dd8428 100644
--- a/core/fpdfapi/page/cpdf_image.cpp
+++ b/core/fpdfapi/page/cpdf_image.cpp
@@ -34,6 +34,7 @@
#include "core/fxcrt/fx_stream.h"
#include "core/fxcrt/numerics/safe_conversions.h"
#include "core/fxcrt/span_util.h"
+#include "core/fxcrt/stl_util.h"
#include "core/fxge/dib/cfx_dibitmap.h"
#include "core/fxge/dib/fx_dib.h"
@@ -279,8 +280,8 @@
if (pMaskBitmap->GetFormat() != FXDIB_Format::k1bppMask) {
mask_buf.resize(Fx2DSizeOrDie(mask_width, mask_height));
for (int32_t a = 0; a < mask_height; a++) {
- fxcrt::spancpy(pdfium::make_span(mask_buf).subspan(a * mask_width),
- pMaskBitmap->GetScanline(a).first(mask_width));
+ fxcrt::Copy(pMaskBitmap->GetScanline(a).first(mask_width),
+ pdfium::make_span(mask_buf).subspan(a * mask_width));
}
}
pMaskDict->SetNewFor<CPDF_Number>(
diff --git a/core/fpdfapi/parser/cpdf_crypto_handler.cpp b/core/fpdfapi/parser/cpdf_crypto_handler.cpp
index 0855bee..7e84901 100644
--- a/core/fpdfapi/parser/cpdf_crypto_handler.cpp
+++ b/core/fpdfapi/parser/cpdf_crypto_handler.cpp
@@ -26,7 +26,7 @@
#include "core/fxcrt/check.h"
#include "core/fxcrt/check_op.h"
#include "core/fxcrt/fx_memcpy_wrappers.h"
-#include "core/fxcrt/span_util.h"
+#include "core/fxcrt/stl_util.h"
namespace {
@@ -332,7 +332,7 @@
DCHECK(cipher != Cipher::kRC4 || (key.size() >= 5 && key.size() <= 16));
if (m_Cipher != Cipher::kNone) {
- fxcrt::spancpy(pdfium::make_span(m_EncryptKey), key.first(m_KeyLen));
+ fxcrt::Copy(key.first(m_KeyLen), m_EncryptKey);
}
if (m_Cipher == Cipher::kAES) {
m_pAESContext.reset(FX_Alloc(CRYPT_aes_context, 1));
diff --git a/core/fpdfapi/parser/cpdf_security_handler.cpp b/core/fpdfapi/parser/cpdf_security_handler.cpp
index 83047c2..b3a01fd 100644
--- a/core/fpdfapi/parser/cpdf_security_handler.cpp
+++ b/core/fpdfapi/parser/cpdf_security_handler.cpp
@@ -83,7 +83,7 @@
CRYPT_MD5Generate(digest_span, digest);
}
}
- fxcrt::spancpy(key, digest_span);
+ fxcrt::Copy(digest_span, key);
}
bool IsValidKeyLengthForCipher(CPDF_CryptoHandler::Cipher cipher,
@@ -676,8 +676,8 @@
// to 15 should be random data.
uint32_t random_value;
FX_Random_GenerateMT(pdfium::span_from_ref(random_value));
- fxcrt::spancpy(pdfium::make_span(buf).subspan(12, 4),
- pdfium::byte_span_from_ref(random_value));
+ fxcrt::Copy(pdfium::byte_span_from_ref(random_value),
+ pdfium::make_span(buf).subspan(12, 4));
CRYPT_aes_context aes = {};
CRYPT_AESSetKey(&aes, m_EncryptKey.data(), m_EncryptKey.size());
diff --git a/core/fpdfapi/parser/fpdf_parser_decode.cpp b/core/fpdfapi/parser/fpdf_parser_decode.cpp
index 4d0cb88..d4ec899 100644
--- a/core/fpdfapi/parser/fpdf_parser_decode.cpp
+++ b/core/fpdfapi/parser/fpdf_parser_decode.cpp
@@ -289,7 +289,7 @@
fxcrt::Fill(dest_span.subspan(dest_count + copy_len, delta), 0);
}
auto copy_span = src_span.subspan(i + 1, copy_len);
- fxcrt::spancpy(dest_span.subspan(dest_count), copy_span);
+ fxcrt::Copy(copy_span, dest_span.subspan(dest_count));
dest_count += src_span[i] + 1;
i += src_span[i] + 2;
} else {
diff --git a/core/fpdfapi/render/cpdf_rendershading.cpp b/core/fpdfapi/render/cpdf_rendershading.cpp
index 4601d39..9cabf3f 100644
--- a/core/fpdfapi/render/cpdf_rendershading.cpp
+++ b/core/fpdfapi/render/cpdf_rendershading.cpp
@@ -32,6 +32,7 @@
#include "core/fxcrt/numerics/clamped_math.h"
#include "core/fxcrt/span.h"
#include "core/fxcrt/span_util.h"
+#include "core/fxcrt/stl_util.h"
#include "core/fxcrt/unowned_ptr.h"
#include "core/fxge/cfx_defaultrenderdevice.h"
#include "core/fxge/cfx_fillrenderoptions.h"
@@ -836,13 +837,12 @@
for (i = 0; i < 4; i++) {
tempCoords[i] = coords[(flag * 3 + i) % 12];
}
- fxcrt::spancpy(pdfium::make_span(coords), pdfium::make_span(tempCoords));
+ fxcrt::Copy(tempCoords, coords);
std::array<CoonColor, 2> tempColors = {{
patch.patch_colors[flag],
patch.patch_colors[(flag + 1) % 4],
}};
- fxcrt::spancpy(pdfium::make_span(patch.patch_colors),
- pdfium::make_span(tempColors));
+ fxcrt::Copy(tempColors, patch.patch_colors);
}
for (i = iStartPoint; i < point_count; i++) {
if (!stream.CanReadCoords())
diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp
index 94ab6c1..90fbc06 100644
--- a/core/fpdfapi/render/cpdf_renderstatus.cpp
+++ b/core/fpdfapi/render/cpdf_renderstatus.cpp
@@ -61,7 +61,7 @@
#include "core/fxcrt/fx_system.h"
#include "core/fxcrt/notreached.h"
#include "core/fxcrt/span.h"
-#include "core/fxcrt/span_util.h"
+#include "core/fxcrt/stl_util.h"
#include "core/fxcrt/unowned_ptr.h"
#include "core/fxge/cfx_defaultrenderdevice.h"
#include "core/fxge/cfx_fillrenderoptions.h"
@@ -1417,7 +1417,7 @@
dest_buf[i] = transfers[src_buf[i]];
}
} else {
- fxcrt::spancpy(dest_buf, src_buf.first(dest_pitch * height));
+ fxcrt::Copy(src_buf.first(dest_pitch * height), dest_buf);
}
return result_mask;
}
diff --git a/core/fxcodec/basic/basicmodule.cpp b/core/fxcodec/basic/basicmodule.cpp
index 5099727..0592762 100644
--- a/core/fxcodec/basic/basicmodule.cpp
+++ b/core/fxcodec/basic/basicmodule.cpp
@@ -16,7 +16,6 @@
#include "core/fxcrt/fx_safe_types.h"
#include "core/fxcrt/numerics/safe_conversions.h"
#include "core/fxcrt/raw_span.h"
-#include "core/fxcrt/span_util.h"
#include "core/fxcrt/stl_util.h"
namespace fxcodec {
@@ -146,8 +145,8 @@
pdfium::checked_cast<uint32_t>(m_SrcBuf.size() - m_SrcOffset);
m_bEOD = true;
}
- auto copy_span = m_SrcBuf.subspan(m_SrcOffset, copy_len);
- fxcrt::spancpy(scan_span.subspan(col_pos), copy_span);
+ fxcrt::Copy(m_SrcBuf.subspan(m_SrcOffset, copy_len),
+ scan_span.subspan(col_pos));
col_pos += copy_len;
UpdateOperator((uint8_t)copy_len);
} else if (m_Operator > 128) {
diff --git a/core/fxcodec/bmp/cfx_bmpdecompressor.cpp b/core/fxcodec/bmp/cfx_bmpdecompressor.cpp
index dc3d064..dfce910 100644
--- a/core/fxcodec/bmp/cfx_bmpdecompressor.cpp
+++ b/core/fxcodec/bmp/cfx_bmpdecompressor.cpp
@@ -436,8 +436,8 @@
case 24:
case 32:
// TODO(crbug.com/pdfium/1901): Apply bitfields.
- fxcrt::spancpy(pdfium::make_span(out_row_buffer_),
- pdfium::make_span(dest_buf).first(src_row_bytes_));
+ fxcrt::Copy(pdfium::make_span(dest_buf).first(src_row_bytes_),
+ out_row_buffer_);
idx += src_row_bytes_;
break;
}
@@ -508,8 +508,8 @@
if (!ReadAllOrNone(second_part))
return BmpDecoder::Status::kContinue;
- fxcrt::spancpy(pdfium::make_span(out_row_buffer_).subspan(col_num_),
- pdfium::make_span(second_part).first(first_part));
+ fxcrt::Copy(pdfium::make_span(second_part).first(first_part),
+ pdfium::make_span(out_row_buffer_).subspan(col_num_));
for (size_t i = col_num_; i < col_num_ + first_part; ++i) {
if (!ValidateColorIndex(out_row_buffer_[i]))
diff --git a/core/fxcodec/cfx_codec_memory.cpp b/core/fxcodec/cfx_codec_memory.cpp
index 8ac15d5..38a0b4d 100644
--- a/core/fxcodec/cfx_codec_memory.cpp
+++ b/core/fxcodec/cfx_codec_memory.cpp
@@ -7,6 +7,7 @@
#include <algorithm>
#include "core/fxcrt/span_util.h"
+#include "core/fxcrt/stl_util.h"
CFX_CodecMemory::CFX_CodecMemory(size_t buffer_size)
: buffer_(FX_Alloc(uint8_t, buffer_size)), size_(buffer_size) {}
@@ -26,7 +27,7 @@
return 0;
size_t bytes_to_read = std::min(buffer.size(), size_ - pos_);
- fxcrt::spancpy(buffer, GetBufferSpan().subspan(pos_, bytes_to_read));
+ fxcrt::Copy(GetBufferSpan().subspan(pos_, bytes_to_read), buffer);
pos_ += bytes_to_read;
return bytes_to_read;
}
diff --git a/core/fxcodec/flate/flatemodule.cpp b/core/fxcodec/flate/flatemodule.cpp
index a11b7e2..75f0b28 100644
--- a/core/fxcodec/flate/flatemodule.cpp
+++ b/core/fxcodec/flate/flatemodule.cpp
@@ -365,7 +365,7 @@
break;
}
default: {
- fxcrt::spancpy(dest_span, remaining_src_span);
+ fxcrt::Copy(remaining_src_span, dest_span);
break;
}
}
@@ -692,7 +692,7 @@
FlateOutput(m_pFlate.get(), m_PredictRaw);
PNG_PredictLine(m_Scanline, m_PredictRaw, m_LastLine, row_size,
bytes_per_pixel);
- fxcrt::spancpy(m_LastLine.span(), m_Scanline.first(m_PredictPitch));
+ fxcrt::Copy(m_Scanline.first(m_PredictPitch), m_LastLine.span());
break;
}
case PredictorType::kFlate: {
@@ -711,9 +711,9 @@
size_t bytes_to_go = m_Pitch;
size_t read_leftover = m_LeftOver > bytes_to_go ? bytes_to_go : m_LeftOver;
if (read_leftover) {
- fxcrt::spancpy(
- m_Scanline.span(),
- m_PredictBuffer.subspan(m_PredictPitch - m_LeftOver, read_leftover));
+ fxcrt::Copy(
+ m_PredictBuffer.subspan(m_PredictPitch - m_LeftOver, read_leftover),
+ m_Scanline.span());
m_LeftOver -= read_leftover;
bytes_to_go -= read_leftover;
}
@@ -726,7 +726,7 @@
FlateOutput(m_pFlate.get(), m_PredictRaw);
PNG_PredictLine(m_PredictBuffer, m_PredictRaw, m_LastLine, row_size,
bytes_per_pixel);
- fxcrt::spancpy(m_LastLine.span(), m_PredictBuffer.span());
+ fxcrt::Copy(m_PredictBuffer.span(), m_LastLine.span());
bytes_to_go = CopyAndAdvanceLine(bytes_to_go);
}
break;
@@ -748,8 +748,8 @@
size_t FlatePredictorScanlineDecoder::CopyAndAdvanceLine(size_t bytes_to_go) {
size_t read_bytes = std::min<size_t>(m_PredictPitch, bytes_to_go);
- fxcrt::spancpy(m_Scanline.subspan(m_Pitch - bytes_to_go),
- m_PredictBuffer.first(read_bytes));
+ fxcrt::Copy(m_PredictBuffer.first(read_bytes),
+ m_Scanline.subspan(m_Pitch - bytes_to_go));
m_LeftOver += m_PredictPitch - read_bytes;
return bytes_to_go - read_bytes;
}
diff --git a/core/fxcodec/gif/cfx_gifcontext_unittest.cpp b/core/fxcodec/gif/cfx_gifcontext_unittest.cpp
index de75522..ce43750 100644
--- a/core/fxcodec/gif/cfx_gifcontext_unittest.cpp
+++ b/core/fxcodec/gif/cfx_gifcontext_unittest.cpp
@@ -11,7 +11,6 @@
#include "core/fxcodec/cfx_codec_memory.h"
#include "core/fxcrt/data_vector.h"
-#include "core/fxcrt/span_util.h"
#include "core/fxcrt/stl_util.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -29,7 +28,7 @@
CFX_CodecMemory* InputBuffer() const { return input_buffer_.Get(); }
void SetTestInputBuffer(pdfium::span<const uint8_t> input) {
auto pMemory = pdfium::MakeRetain<CFX_CodecMemory>(input.size());
- fxcrt::spancpy(pMemory->GetBufferSpan(), input);
+ fxcrt::Copy(input, pMemory->GetBufferSpan());
SetInputBuffer(std::move(pMemory));
}
};
diff --git a/core/fxcodec/progressive_decoder.cpp b/core/fxcodec/progressive_decoder.cpp
index c15c4ec..83398e2 100644
--- a/core/fxcodec/progressive_decoder.cpp
+++ b/core/fxcodec/progressive_decoder.cpp
@@ -483,7 +483,7 @@
const int32_t left = m_GifFrameRect.left;
const pdfium::span<uint8_t> decode_span = m_DecodeBuf;
fxcrt::Fill(decode_span.first(m_SrcWidth), pal_index);
- fxcrt::spancpy(decode_span.subspan(left), row_buf.first(img_width));
+ fxcrt::Copy(row_buf.first(img_width), decode_span.subspan(left));
bool bLastPass = (row_num % 2) == 1;
int32_t line = row_num + m_GifFrameRect.top;
@@ -541,7 +541,7 @@
RetainPtr<CFX_DIBitmap> pDIBitmap = m_pDeviceBitmap;
DCHECK(pDIBitmap);
- fxcrt::spancpy(pdfium::make_span(m_DecodeBuf), row_buf.first(m_ScanlineSize));
+ fxcrt::Copy(row_buf.first(m_ScanlineSize), m_DecodeBuf);
int src_top = m_clipBox.top;
int src_bottom = m_clipBox.bottom;
@@ -730,7 +730,7 @@
m_pBmpContext = std::move(pBmpContext);
if (!palette.empty()) {
m_SrcPalette.resize(palette.size());
- fxcrt::spancpy(pdfium::make_span(m_SrcPalette), palette);
+ fxcrt::Copy(palette, m_SrcPalette);
} else {
m_SrcPalette.clear();
}
diff --git a/core/fxcrt/binary_buffer.cpp b/core/fxcrt/binary_buffer.cpp
index ad46c9b..fe54180 100644
--- a/core/fxcrt/binary_buffer.cpp
+++ b/core/fxcrt/binary_buffer.cpp
@@ -11,6 +11,7 @@
#include "core/fxcrt/fx_safe_types.h"
#include "core/fxcrt/span_util.h"
+#include "core/fxcrt/stl_util.h"
namespace fxcrt {
@@ -95,7 +96,7 @@
return;
ExpandBuf(span.size());
- fxcrt::spancpy(pdfium::make_span(m_buffer).subspan(GetSize()), span);
+ fxcrt::Copy(span, pdfium::make_span(m_buffer).subspan(GetSize()));
m_DataSize += span.size();
}
diff --git a/core/fxcrt/cfx_memorystream.cpp b/core/fxcrt/cfx_memorystream.cpp
index 32bb360..6595184 100644
--- a/core/fxcrt/cfx_memorystream.cpp
+++ b/core/fxcrt/cfx_memorystream.cpp
@@ -10,7 +10,7 @@
#include <utility>
#include "core/fxcrt/fx_safe_types.h"
-#include "core/fxcrt/span_util.h"
+#include "core/fxcrt/stl_util.h"
CFX_MemoryStream::CFX_MemoryStream() = default;
@@ -51,8 +51,8 @@
m_nCurPos = new_pos.ValueOrDie();
// Safe to cast `offset` because it was used to calculate `new_pos` above, and
// `new_pos` is valid.
- fxcrt::spancpy(buffer,
- GetSpan().subspan(static_cast<size_t>(offset), buffer.size()));
+ fxcrt::Copy(GetSpan().subspan(static_cast<size_t>(offset), buffer.size()),
+ buffer);
return true;
}
@@ -97,8 +97,8 @@
// Safe to cast `offset` because it was used to calculate `safe_new_pos`
// above, and `safe_new_pos` is valid.
- fxcrt::spancpy(pdfium::make_span(m_data).subspan(static_cast<size_t>(offset)),
- buffer);
+ fxcrt::Copy(buffer,
+ pdfium::make_span(m_data).subspan(static_cast<size_t>(offset)));
m_nCurSize = std::max(m_nCurSize, m_nCurPos);
return true;
diff --git a/core/fxcrt/cfx_read_only_span_stream.cpp b/core/fxcrt/cfx_read_only_span_stream.cpp
index 13c84b9..47429a5 100644
--- a/core/fxcrt/cfx_read_only_span_stream.cpp
+++ b/core/fxcrt/cfx_read_only_span_stream.cpp
@@ -8,7 +8,7 @@
#include "core/fxcrt/fx_safe_types.h"
#include "core/fxcrt/numerics/safe_conversions.h"
-#include "core/fxcrt/span_util.h"
+#include "core/fxcrt/stl_util.h"
CFX_ReadOnlySpanStream::CFX_ReadOnlySpanStream(pdfium::span<const uint8_t> span)
: span_(span) {}
@@ -29,7 +29,9 @@
if (!pos.IsValid() || pos.ValueOrDie() > span_.size())
return false;
- fxcrt::spancpy(buffer, span_.subspan(pdfium::checked_cast<size_t>(offset),
- buffer.size()));
+ fxcrt::Copy(
+ span_.subspan(pdfium::checked_cast<size_t>(offset), buffer.size()),
+ buffer);
+
return true;
}
diff --git a/core/fxcrt/fixed_size_data_vector_unittest.cpp b/core/fxcrt/fixed_size_data_vector_unittest.cpp
index 546ef37..9116d1c 100644
--- a/core/fxcrt/fixed_size_data_vector_unittest.cpp
+++ b/core/fxcrt/fixed_size_data_vector_unittest.cpp
@@ -9,7 +9,7 @@
#include <utility>
#include "core/fxcrt/span.h"
-#include "core/fxcrt/span_util.h"
+#include "core/fxcrt/stl_util.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -27,7 +27,7 @@
ASSERT_EQ(4u, vec.span().size());
constexpr int kData[] = {1, 2, 3, 4};
- fxcrt::spancpy(vec.span(), pdfium::make_span(kData));
+ fxcrt::Copy(kData, vec.span());
EXPECT_THAT(vec.span(), testing::ElementsAre(1, 2, 3, 4));
}
@@ -39,7 +39,7 @@
EXPECT_THAT(vec.span(), testing::ElementsAre(0, 0, 0, 0));
constexpr int kData[] = {1, 2, 3, 4};
- fxcrt::spancpy(vec.span(), pdfium::make_span(kData));
+ fxcrt::Copy(kData, vec.span());
EXPECT_THAT(vec.span(), testing::ElementsAre(1, 2, 3, 4));
}
@@ -51,7 +51,7 @@
EXPECT_THAT(vec.span(), testing::ElementsAre(0, 0, 0, 0));
constexpr int kData[] = {1, 2, 3, 4};
- fxcrt::spancpy(vec.span(), pdfium::make_span(kData));
+ fxcrt::Copy(kData, vec.span());
EXPECT_THAT(vec.span(), testing::ElementsAre(1, 2, 3, 4));
}
@@ -68,7 +68,7 @@
constexpr int kData[] = {1, 2, 3, 4};
auto vec = FixedSizeDataVector<int>::Uninit(4);
ASSERT_EQ(4u, vec.span().size());
- fxcrt::spancpy(vec.span(), pdfium::make_span(kData));
+ fxcrt::Copy(kData, vec.span());
const int* const original_data_ptr = vec.span().data();
FixedSizeDataVector<int> vec2(std::move(vec));
@@ -99,7 +99,7 @@
auto vec2 = FixedSizeDataVector<int>::Zeroed(4);
constexpr int kData[] = {1, 2, 3, 4};
ASSERT_EQ(4u, vec2.span().size());
- fxcrt::spancpy(vec2.span(), pdfium::make_span(kData));
+ fxcrt::Copy(kData, vec2.span());
vec = std::move(vec2);
EXPECT_TRUE(vec2.empty());
diff --git a/core/fxcrt/fx_string.cpp b/core/fxcrt/fx_string.cpp
index c9b04a7..0215441 100644
--- a/core/fxcrt/fx_string.cpp
+++ b/core/fxcrt/fx_string.cpp
@@ -17,7 +17,7 @@
#include "core/fxcrt/compiler_specific.h"
#include "core/fxcrt/fx_extension.h"
#include "core/fxcrt/span.h"
-#include "core/fxcrt/span_util.h"
+#include "core/fxcrt/stl_util.h"
#include "core/fxcrt/string_view_template.h"
#include "core/fxcrt/utf16.h"
#include "core/fxcrt/widestring.h"
@@ -182,7 +182,7 @@
int i = scaled / scale;
FXSYS_itoa(i, buf2, 10);
size_t len = strlen(buf2);
- fxcrt::spancpy(buf.subspan(buf_size), pdfium::make_span(buf2).first(len));
+ fxcrt::Copy(pdfium::make_span(buf2).first(len), buf.subspan(buf_size));
buf_size += len;
int fraction = scaled % scale;
if (fraction == 0) {
diff --git a/core/fxge/cfx_cliprgn.cpp b/core/fxge/cfx_cliprgn.cpp
index a855b4e..ed4c513 100644
--- a/core/fxge/cfx_cliprgn.cpp
+++ b/core/fxge/cfx_cliprgn.cpp
@@ -12,7 +12,7 @@
#include "core/fxcrt/check_op.h"
#include "core/fxcrt/notreached.h"
-#include "core/fxcrt/span_util.h"
+#include "core/fxcrt/stl_util.h"
#include "core/fxge/dib/cfx_dibitmap.h"
CFX_ClipRgn::CFX_ClipRgn(int width, int height) : m_Box(0, 0, width, height) {}
@@ -51,7 +51,7 @@
m_Mask->GetWritableScanline(row - m_Box.top);
pdfium::span<const uint8_t> src_scan =
pOldMask->GetScanline(row - mask_rect.top);
- fxcrt::spancpy(dest_scan, src_scan.subspan(offset, m_Box.Width()));
+ fxcrt::Copy(src_scan.subspan(offset, m_Box.Width()), dest_scan);
}
}
diff --git a/core/fxge/dib/cfx_bitmapstorer.cpp b/core/fxge/dib/cfx_bitmapstorer.cpp
index a04d978..50c88d8 100644
--- a/core/fxge/dib/cfx_bitmapstorer.cpp
+++ b/core/fxge/dib/cfx_bitmapstorer.cpp
@@ -9,7 +9,7 @@
#include <utility>
#include "core/fxcrt/check_op.h"
-#include "core/fxcrt/span_util.h"
+#include "core/fxcrt/stl_util.h"
#include "core/fxge/dib/cfx_dibitmap.h"
CFX_BitmapStorer::CFX_BitmapStorer() = default;
@@ -27,8 +27,9 @@
void CFX_BitmapStorer::ComposeScanline(int line,
pdfium::span<const uint8_t> scanline) {
pdfium::span<uint8_t> dest_buf = m_pBitmap->GetWritableScanline(line);
- if (!dest_buf.empty())
- fxcrt::spancpy(dest_buf, scanline);
+ if (!dest_buf.empty()) {
+ fxcrt::Copy(scanline, dest_buf);
+ }
}
bool CFX_BitmapStorer::SetInfo(int width,
diff --git a/core/fxge/dib/cfx_dibbase.cpp b/core/fxge/dib/cfx_dibbase.cpp
index 196c5da..2f9a8aa 100644
--- a/core/fxge/dib/cfx_dibbase.cpp
+++ b/core/fxge/dib/cfx_dibbase.cpp
@@ -170,9 +170,8 @@
int src_left,
int src_top) {
for (int row = 0; row < height; ++row) {
- fxcrt::spancpy(
- dest_buf.subspan(Fx2DSizeOrDie(row, dest_pitch)),
- pSrcBitmap->GetScanline(src_top + row).subspan(src_left, width));
+ fxcrt::Copy(pSrcBitmap->GetScanline(src_top + row).subspan(src_left, width),
+ dest_buf.subspan(Fx2DSizeOrDie(row, dest_pitch)));
}
}
@@ -288,9 +287,9 @@
}
} else {
for (int row = 0; row < height; ++row) {
- fxcrt::spancpy(
- dest_buf.subspan(Fx2DSizeOrDie(row, dest_pitch)),
- pSrcBitmap->GetScanline(src_top + row).subspan(src_left, width));
+ fxcrt::Copy(
+ pSrcBitmap->GetScanline(src_top + row).subspan(src_left, width),
+ dest_buf.subspan(Fx2DSizeOrDie(row, dest_pitch)));
}
}
}
@@ -472,9 +471,9 @@
const size_t x_offset = Fx2DSizeOrDie(src_left, 3);
const size_t byte_count = Fx2DSizeOrDie(width, 3);
for (int row = 0; row < height; ++row) {
- fxcrt::spancpy(
- dest_buf.subspan(Fx2DSizeOrDie(row, dest_pitch)),
- pSrcBitmap->GetScanline(src_top + row).subspan(x_offset, byte_count));
+ fxcrt::Copy(
+ pSrcBitmap->GetScanline(src_top + row).subspan(x_offset, byte_count),
+ dest_buf.subspan(Fx2DSizeOrDie(row, dest_pitch)));
}
}
diff --git a/core/fxge/dib/cfx_imagetransformer.cpp b/core/fxge/dib/cfx_imagetransformer.cpp
index 5311434..46812b7 100644
--- a/core/fxge/dib/cfx_imagetransformer.cpp
+++ b/core/fxge/dib/cfx_imagetransformer.cpp
@@ -18,7 +18,7 @@
#include "core/fxcrt/fx_system.h"
#include "core/fxcrt/notreached.h"
#include "core/fxcrt/numerics/safe_conversions.h"
-#include "core/fxcrt/span_util.h"
+#include "core/fxcrt/stl_util.h"
#include "core/fxge/dib/cfx_dibitmap.h"
#include "core/fxge/dib/cfx_imagestretcher.h"
#include "core/fxge/dib/fx_dib.h"
@@ -285,7 +285,7 @@
if (m_Storer.GetBitmap()->HasPalette()) {
pdfium::span<const uint32_t> palette =
m_Storer.GetBitmap()->GetPaletteSpan();
- fxcrt::spancpy(pdfium::make_span(argb), palette.first(argb.size()));
+ fxcrt::Copy(palette.first(argb.size()), argb);
} else {
for (uint32_t i = 0; i < argb.size(); ++i) {
argb[i] = ArgbEncode(0xff, i, i, i);
diff --git a/core/fxge/dib/cfx_scanlinecompositor.cpp b/core/fxge/dib/cfx_scanlinecompositor.cpp
index 74a6a49..2b5f0c0 100644
--- a/core/fxge/dib/cfx_scanlinecompositor.cpp
+++ b/core/fxge/dib/cfx_scanlinecompositor.cpp
@@ -12,7 +12,7 @@
#include "core/fxcrt/check_op.h"
#include "core/fxcrt/compiler_specific.h"
#include "core/fxcrt/fx_memcpy_wrappers.h"
-#include "core/fxcrt/span_util.h"
+#include "core/fxcrt/stl_util.h"
#include "core/fxge/dib/blend.h"
#include "core/fxge/dib/fx_dib.h"
@@ -2288,7 +2288,7 @@
return;
}
pdfium::span<uint32_t> pPalette = m_SrcPalette.Make32BitPalette(pal_count);
- fxcrt::spancpy(pPalette, src_palette.first(pal_count));
+ fxcrt::Copy(src_palette.first(pal_count), pPalette);
return;
}
if (bIsDestBpp8) {
diff --git a/core/fxge/win32/cfx_psrenderer.cpp b/core/fxge/win32/cfx_psrenderer.cpp
index dfe0a79..b98d855 100644
--- a/core/fxge/win32/cfx_psrenderer.cpp
+++ b/core/fxge/win32/cfx_psrenderer.cpp
@@ -24,7 +24,7 @@
#include "core/fxcrt/fx_stream.h"
#include "core/fxcrt/numerics/safe_conversions.h"
#include "core/fxcrt/span.h"
-#include "core/fxcrt/span_util.h"
+#include "core/fxcrt/stl_util.h"
#include "core/fxge/cfx_fillrenderoptions.h"
#include "core/fxge/cfx_font.h"
#include "core/fxge/cfx_fontcache.h"
@@ -873,8 +873,7 @@
result.data.resize(safe_size.ValueOrDie());
auto dest_span = pdfium::make_span(result.data);
for (int row = 0; row < height; row++) {
- pdfium::span<const uint8_t> src_scan = src->GetScanline(row);
- fxcrt::spancpy(dest_span.subspan(row * pitch, pitch), src_scan);
+ fxcrt::Copy(src->GetScanline(row), dest_span.subspan(row * pitch, pitch));
}
return result;
}
diff --git a/fpdfsdk/cpdfsdk_helpers.cpp b/fpdfsdk/cpdfsdk_helpers.cpp
index 383d7d1..cab740e 100644
--- a/fpdfsdk/cpdfsdk_helpers.cpp
+++ b/fpdfsdk/cpdfsdk_helpers.cpp
@@ -25,6 +25,7 @@
#include "core/fxcrt/fx_memcpy_wrappers.h"
#include "core/fxcrt/numerics/safe_conversions.h"
#include "core/fxcrt/span_util.h"
+#include "core/fxcrt/stl_util.h"
#include "core/fxcrt/unowned_ptr.h"
#include "fpdfsdk/cpdfsdk_formfillenvironment.h"
@@ -68,9 +69,9 @@
stream_acc->LoadAllDataRaw();
pdfium::span<const uint8_t> stream_data_span = stream_acc->GetSpan();
- if (!buffer.empty() && buffer.size() <= stream_data_span.size())
- fxcrt::spancpy(buffer, stream_data_span);
-
+ if (!buffer.empty() && buffer.size() <= stream_data_span.size()) {
+ fxcrt::Copy(stream_data_span, buffer);
+ }
return pdfium::checked_cast<unsigned long>(stream_data_span.size());
}
diff --git a/fpdfsdk/fpdf_dataavail_embeddertest.cpp b/fpdfsdk/fpdf_dataavail_embeddertest.cpp
index 8a130d8..5f71ea2 100644
--- a/fpdfsdk/fpdf_dataavail_embeddertest.cpp
+++ b/fpdfsdk/fpdf_dataavail_embeddertest.cpp
@@ -11,7 +11,7 @@
#include "core/fxcrt/bytestring.h"
#include "core/fxcrt/compiler_specific.h"
#include "core/fxcrt/numerics/safe_conversions.h"
-#include "core/fxcrt/span_util.h"
+#include "core/fxcrt/stl_util.h"
#include "public/fpdf_doc.h"
#include "public/fpdfview.h"
#include "testing/embedder_test.h"
@@ -115,8 +115,8 @@
if (end <= pos)
return 0;
const unsigned long bytes_to_copy = end - pos;
- fxcrt::spancpy(UNSAFE_TODO(pdfium::make_span(pBuf, size)),
- file_contents().subspan(pos, bytes_to_copy));
+ fxcrt::Copy(file_contents().subspan(pos, bytes_to_copy),
+ UNSAFE_TODO(pdfium::make_span(pBuf, size)));
SetDataAvailable(pos, bytes_to_copy);
return static_cast<int>(bytes_to_copy);
}
diff --git a/fpdfsdk/fpdf_text.cpp b/fpdfsdk/fpdf_text.cpp
index 87c4716..79bed84 100644
--- a/fpdfsdk/fpdf_text.cpp
+++ b/fpdfsdk/fpdf_text.cpp
@@ -345,8 +345,8 @@
ByteString str = textpage->GetPageText(start_index, char_count).ToUCS2LE();
auto str_span = fxcrt::reinterpret_span<const unsigned short>(str.span());
- // Hard CHECK() in spancpy if retrieved text is too long.
- fxcrt::spancpy(result_span, str_span);
+ // Hard CHECK() in Copy() if retrieved text is too long.
+ fxcrt::Copy(str_span, result_span);
return pdfium::checked_cast<int>(str_span.size());
}
@@ -404,7 +404,7 @@
if (copy_span.size() > buffer_span.size()) {
copy_span = copy_span.first(buffer_span.size());
}
- fxcrt::spancpy(buffer_span, copy_span);
+ fxcrt::Copy(copy_span, buffer_span);
return pdfium::checked_cast<int>(copy_span.size());
}
@@ -516,7 +516,7 @@
UNSAFE_BUFFERS(pdfium::make_span(buffer, buflen));
size_t size = std::min(url_span.size(), result_span.size());
- fxcrt::spancpy(result_span, url_span.first(size));
+ fxcrt::Copy(url_span.first(size), result_span);
return pdfium::checked_cast<int>(size);
}
diff --git a/fpdfsdk/fpdf_view.cpp b/fpdfsdk/fpdf_view.cpp
index f14219a..7b2a3bc 100644
--- a/fpdfsdk/fpdf_view.cpp
+++ b/fpdfsdk/fpdf_view.cpp
@@ -41,7 +41,6 @@
#include "core/fxcrt/numerics/safe_conversions.h"
#include "core/fxcrt/ptr_util.h"
#include "core/fxcrt/span.h"
-#include "core/fxcrt/span_util.h"
#include "core/fxcrt/stl_util.h"
#include "core/fxcrt/unowned_ptr.h"
#include "core/fxge/cfx_defaultrenderdevice.h"
@@ -1282,7 +1281,7 @@
// SAFETY: required from caller.
auto buffer_span =
UNSAFE_BUFFERS(pdfium::make_span(static_cast<char*>(buffer), *buflen));
- fxcrt::spancpy(buffer_span, utf16Name.span());
+ fxcrt::Copy(utf16Name.span(), buffer_span);
*buflen = len;
} else {
*buflen = -1;
@@ -1357,8 +1356,8 @@
fxcrt::CollectionSize<unsigned long>(trailer_ends);
if (buffer && length >= trailer_ends_len) {
// SAFETY: required from caller.
- fxcrt::spancpy(UNSAFE_BUFFERS(pdfium::make_span(buffer, length)),
- pdfium::make_span(trailer_ends));
+ fxcrt::Copy(trailer_ends,
+ UNSAFE_BUFFERS(pdfium::make_span(buffer, length)));
}
return trailer_ends_len;
diff --git a/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp b/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp
index b6f407d..c0d52c6 100644
--- a/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp
+++ b/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp
@@ -25,7 +25,7 @@
#include <stdint.h>
#include "core/fxcrt/data_vector.h"
-#include "core/fxcrt/span_util.h"
+#include "core/fxcrt/stl_util.h"
#include "fxbarcode/pdf417/BC_PDF417BarcodeRow.h"
CBC_BarcodeMatrix::CBC_BarcodeMatrix(size_t width, size_t height)
@@ -40,7 +40,8 @@
DataVector<uint8_t> CBC_BarcodeMatrix::toBitArray() {
DataVector<uint8_t> bit_array(m_width * m_height);
pdfium::span<uint8_t> bit_array_span(bit_array);
- for (size_t i = 0; i < m_height; ++i)
- fxcrt::spancpy(bit_array_span.subspan(i * m_width), m_matrix[i]->GetRow());
+ for (size_t i = 0; i < m_height; ++i) {
+ fxcrt::Copy(m_matrix[i]->GetRow(), bit_array_span.subspan(i * m_width));
+ }
return bit_array;
}
diff --git a/fxbarcode/qrcode/BC_QRCoderEncoder.cpp b/fxbarcode/qrcode/BC_QRCoderEncoder.cpp
index 96454f5..4f663e5 100644
--- a/fxbarcode/qrcode/BC_QRCoderEncoder.cpp
+++ b/fxbarcode/qrcode/BC_QRCoderEncoder.cpp
@@ -34,7 +34,6 @@
#include "core/fxcrt/check_op.h"
#include "core/fxcrt/data_vector.h"
#include "core/fxcrt/fx_string.h"
-#include "core/fxcrt/span_util.h"
#include "core/fxcrt/stl_util.h"
#include "fxbarcode/common/BC_CommonByteMatrix.h"
#include "fxbarcode/common/reedsolomon/BC_ReedSolomon.h"
@@ -322,9 +321,9 @@
return false;
DataVector<uint8_t> dataBytes(numDataBytesInBlock);
- fxcrt::spancpy(
- pdfium::make_span(dataBytes),
- bits->GetArray().subspan(dataBytesOffset, numDataBytesInBlock));
+ fxcrt::Copy(bits->GetArray().subspan(dataBytesOffset, numDataBytesInBlock),
+ dataBytes);
+
DataVector<uint8_t> ecBytes = GenerateECBytes(dataBytes, numEcBytesInBlock);
if (ecBytes.empty())
return false;
diff --git a/testing/utils/file_util.cpp b/testing/utils/file_util.cpp
index 9150e24..adda83d 100644
--- a/testing/utils/file_util.cpp
+++ b/testing/utils/file_util.cpp
@@ -10,7 +10,8 @@
#include <vector>
#include "core/fxcrt/numerics/safe_conversions.h"
-#include "core/fxcrt/span_util.h"
+#include "core/fxcrt/span.h"
+#include "core/fxcrt/stl_util.h"
#include "testing/utils/path_service.h"
std::vector<uint8_t> GetFileContents(const char* filename) {
@@ -54,8 +55,8 @@
int FileAccessForTesting::GetBlockImpl(unsigned long pos,
unsigned char* pBuf,
unsigned long size) {
- fxcrt::spancpy(pdfium::make_span(pBuf, size),
- pdfium::make_span(file_contents_).subspan(pos, size));
+ fxcrt::Copy(pdfium::make_span(file_contents_).subspan(pos, size),
+ pdfium::make_span(pBuf, size));
return size ? 1 : 0;
}
diff --git a/xfa/fde/cfde_texteditengine.cpp b/xfa/fde/cfde_texteditengine.cpp
index c5be19f..ae7f71d 100644
--- a/xfa/fde/cfde_texteditengine.cpp
+++ b/xfa/fde/cfde_texteditengine.cpp
@@ -14,7 +14,7 @@
#include "core/fxcrt/compiler_specific.h"
#include "core/fxcrt/fx_extension.h"
#include "core/fxcrt/numerics/safe_conversions.h"
-#include "core/fxcrt/span_util.h"
+#include "core/fxcrt/stl_util.h"
#include "core/fxge/text_char_pos.h"
#include "xfa/fde/cfde_textout.h"
#include "xfa/fde/cfde_wordbreak_data.h"
@@ -328,8 +328,9 @@
previous_text = GetText();
// Copy the new text into the gap.
- fxcrt::spancpy(pdfium::make_span(content_).subspan(gap_position_),
- text.span().first(length));
+ fxcrt::Copy(text.span().first(length),
+ pdfium::make_span(content_).subspan(gap_position_));
+
gap_position_ += length;
gap_size_ -= length;
text_length_ += length;
diff --git a/xfa/fgas/font/cfgas_fontmgr.cpp b/xfa/fgas/font/cfgas_fontmgr.cpp
index 083bb4c..8c01e59 100644
--- a/xfa/fgas/font/cfgas_fontmgr.cpp
+++ b/xfa/fgas/font/cfgas_fontmgr.cpp
@@ -29,7 +29,6 @@
#include "core/fxcrt/fx_system.h"
#include "core/fxcrt/numerics/safe_conversions.h"
#include "core/fxcrt/span.h"
-#include "core/fxcrt/span_util.h"
#include "core/fxcrt/stl_util.h"
#include "core/fxge/cfx_font.h"
#include "core/fxge/cfx_fontmapper.h"
@@ -748,20 +747,18 @@
// pdfium::span.
std::optional<std::array<uint32_t, 4>> unicode_range =
pFace->GetOs2UnicodeRange();
- auto usb_span = pdfium::make_span(pFont->m_dwUsb);
if (unicode_range.has_value()) {
- fxcrt::spancpy(usb_span, pdfium::make_span(unicode_range.value()));
+ fxcrt::Copy(unicode_range.value(), pFont->m_dwUsb);
} else {
- fxcrt::Fill(usb_span, 0);
+ fxcrt::Fill(pFont->m_dwUsb, 0);
}
std::optional<std::array<uint32_t, 2>> code_page_range =
pFace->GetOs2CodePageRange();
- auto csb_span = pdfium::make_span(pFont->m_dwCsb);
if (code_page_range.has_value()) {
- fxcrt::spancpy(csb_span, pdfium::make_span(code_page_range.value()));
+ fxcrt::Copy(code_page_range.value(), pFont->m_dwCsb);
} else {
- fxcrt::Fill(csb_span, 0);
+ fxcrt::Fill(pFont->m_dwCsb, 0);
}
static constexpr uint32_t kNameTag =
diff --git a/xfa/fgas/graphics/cfgas_gegraphics.cpp b/xfa/fgas/graphics/cfgas_gegraphics.cpp
index f200d93..616e5ff 100644
--- a/xfa/fgas/graphics/cfgas_gegraphics.cpp
+++ b/xfa/fgas/graphics/cfgas_gegraphics.cpp
@@ -259,9 +259,9 @@
auto mask = pdfium::MakeRetain<CFX_DIBitmap>();
CHECK(mask->Create(data.width, data.height, FXDIB_Format::k1bppMask));
- fxcrt::spancpy(
- mask->GetWritableBuffer(),
- pdfium::make_span(data.maskBits).first(mask->GetPitch() * data.height));
+ fxcrt::Copy(
+ pdfium::make_span(data.maskBits).first(mask->GetPitch() * data.height),
+ mask->GetWritableBuffer());
const CFX_FloatRect rectf =
matrix.TransformRect(path.GetPath().GetBoundingBox());
const FX_RECT rect = rectf.ToRoundedFxRect();