summaryrefslogtreecommitdiff
path: root/core/fpdfapi/page
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi/page')
-rw-r--r--core/fpdfapi/page/cpdf_psengine.cpp7
-rw-r--r--core/fpdfapi/page/cpdf_psengine.h2
-rw-r--r--core/fpdfapi/page/cpdf_psfunc.cpp3
3 files changed, 5 insertions, 7 deletions
diff --git a/core/fpdfapi/page/cpdf_psengine.cpp b/core/fpdfapi/page/cpdf_psengine.cpp
index 7ce3a604a1..adfd45e877 100644
--- a/core/fpdfapi/page/cpdf_psengine.cpp
+++ b/core/fpdfapi/page/cpdf_psengine.cpp
@@ -190,10 +190,9 @@ int CPDF_PSEngine::PopInt() {
return static_cast<int>(Pop());
}
-bool CPDF_PSEngine::Parse(const char* str, int size) {
- CPDF_SimpleParser parser(reinterpret_cast<const uint8_t*>(str), size);
- ByteStringView word = parser.GetWord();
- return word == "{" ? m_MainProc.Parse(&parser, 0) : false;
+bool CPDF_PSEngine::Parse(const ByteStringView& view) {
+ CPDF_SimpleParser parser(view);
+ return parser.GetWord() == "{" && m_MainProc.Parse(&parser, 0);
}
bool CPDF_PSEngine::DoOperator(PDF_PSOP op) {
diff --git a/core/fpdfapi/page/cpdf_psengine.h b/core/fpdfapi/page/cpdf_psengine.h
index 63d91d0757..8a054cc9e6 100644
--- a/core/fpdfapi/page/cpdf_psengine.h
+++ b/core/fpdfapi/page/cpdf_psengine.h
@@ -109,7 +109,7 @@ class CPDF_PSEngine {
CPDF_PSEngine();
~CPDF_PSEngine();
- bool Parse(const char* str, int size);
+ bool Parse(const ByteStringView& str);
bool Execute();
bool DoOperator(PDF_PSOP op);
void Reset() { m_StackCount = 0; }
diff --git a/core/fpdfapi/page/cpdf_psfunc.cpp b/core/fpdfapi/page/cpdf_psfunc.cpp
index 9f101eb91b..af996c056c 100644
--- a/core/fpdfapi/page/cpdf_psfunc.cpp
+++ b/core/fpdfapi/page/cpdf_psfunc.cpp
@@ -16,8 +16,7 @@ CPDF_PSFunc::~CPDF_PSFunc() {}
bool CPDF_PSFunc::v_Init(CPDF_Object* pObj) {
auto pAcc = pdfium::MakeRetain<CPDF_StreamAcc>(pObj->AsStream());
pAcc->LoadAllDataFiltered();
- return m_PS.Parse(reinterpret_cast<const char*>(pAcc->GetData()),
- pAcc->GetSize());
+ return m_PS.Parse(pAcc->GetDataView());
}
bool CPDF_PSFunc::v_Call(float* inputs, float* results) const {