summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/fpdfapi/page/cpdf_sampledfunc.cpp4
-rw-r--r--core/fxcrt/fx_extension.cpp12
-rw-r--r--core/fxcrt/fx_extension.h4
-rw-r--r--core/fxge/skia/fx_skia_device.cpp2
4 files changed, 11 insertions, 11 deletions
diff --git a/core/fpdfapi/page/cpdf_sampledfunc.cpp b/core/fpdfapi/page/cpdf_sampledfunc.cpp
index 205ce91eaa..cdedc862bb 100644
--- a/core/fpdfapi/page/cpdf_sampledfunc.cpp
+++ b/core/fpdfapi/page/cpdf_sampledfunc.cpp
@@ -125,8 +125,8 @@ bool CPDF_SampledFunc::v_Call(const float* inputs, float* results) const {
if (!range_check.IsValid())
return false;
- const uint8_t* pSampleData = m_pSampleStream->GetData();
- if (!pSampleData)
+ pdfium::span<const uint8_t> pSampleData = m_pSampleStream->GetSpan();
+ if (pSampleData.empty())
return false;
for (uint32_t j = 0; j < m_nOutputs; j++, bitpos += m_nBitsPerSample) {
diff --git a/core/fxcrt/fx_extension.cpp b/core/fxcrt/fx_extension.cpp
index 4448a71a9b..83aee86316 100644
--- a/core/fxcrt/fx_extension.cpp
+++ b/core/fxcrt/fx_extension.cpp
@@ -125,9 +125,9 @@ size_t FXSYS_ToUTF16BE(uint32_t unicode, char* buf) {
return 8;
}
-uint32_t GetBits32(const uint8_t* pData, int bitpos, int nbits) {
+uint32_t GetBits32(pdfium::span<const uint8_t> pData, int bitpos, int nbits) {
ASSERT(0 < nbits && nbits <= 32);
- const uint8_t* dataPtr = &pData[bitpos / 8];
+ size_t bytepos = bitpos / 8;
int bitShift;
int bitMask;
int dstShift;
@@ -142,16 +142,16 @@ uint32_t GetBits32(const uint8_t* pData, int bitpos, int nbits) {
bitMask = (1 << std::min(bitOffset, nbits)) - 1;
dstShift = nbits - bitOffset;
}
- uint32_t result =
- static_cast<uint32_t>((*dataPtr++ >> bitShift & bitMask) << dstShift);
+ uint32_t result = static_cast<uint32_t>(
+ (pData[bytepos++] >> bitShift & bitMask) << dstShift);
while (dstShift >= 8) {
dstShift -= 8;
- result |= *dataPtr++ << dstShift;
+ result |= pData[bytepos++] << dstShift;
}
if (dstShift > 0) {
bitShift = 8 - dstShift;
bitMask = (1 << dstShift) - 1;
- result |= *dataPtr++ >> bitShift & bitMask;
+ result |= pData[bytepos++] >> bitShift & bitMask;
}
return result;
}
diff --git a/core/fxcrt/fx_extension.h b/core/fxcrt/fx_extension.h
index 0f249f89c8..ff96de0f7c 100644
--- a/core/fxcrt/fx_extension.h
+++ b/core/fxcrt/fx_extension.h
@@ -12,6 +12,7 @@
#include <memory>
#include "core/fxcrt/fx_string.h"
+#include "third_party/base/span.h"
#include "third_party/icu/source/common/unicode/uchar.h"
#define FX_INVALID_OFFSET static_cast<uint32_t>(-1)
@@ -82,11 +83,10 @@ inline int FXSYS_DecimalCharToInt(const wchar_t c) {
}
void FXSYS_IntToTwoHexChars(uint8_t c, char* buf);
-
void FXSYS_IntToFourHexChars(uint16_t c, char* buf);
size_t FXSYS_ToUTF16BE(uint32_t unicode, char* buf);
-uint32_t GetBits32(const uint8_t* pData, int bitpos, int nbits);
+uint32_t GetBits32(pdfium::span<const uint8_t> pData, int bitpos, int nbits);
#endif // CORE_FXCRT_FX_EXTENSION_H_
diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp
index 598dc480c2..6dd19eaed9 100644
--- a/core/fxge/skia/fx_skia_device.cpp
+++ b/core/fxge/skia/fx_skia_device.cpp
@@ -406,7 +406,7 @@ bool AddSamples(const CPDF_SampledFunc* pFunc,
colorsMin[i] = pFunc->GetRange(i * 2);
colorsMax[i] = pFunc->GetRange(i * 2 + 1);
}
- const uint8_t* pSampleData = pFunc->GetSampleStream()->GetData();
+ pdfium::span<const uint8_t> pSampleData = pFunc->GetSampleStream()->GetSpan();
for (uint32_t i = 0; i < sampleCount; ++i) {
float floatColors[3];
for (uint32_t j = 0; j < 3; ++j) {