summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fpdfsdk/fpdf_editpage.cpp31
1 files changed, 11 insertions, 20 deletions
diff --git a/fpdfsdk/fpdf_editpage.cpp b/fpdfsdk/fpdf_editpage.cpp
index 2ace03cccd..4df5505cca 100644
--- a/fpdfsdk/fpdf_editpage.cpp
+++ b/fpdfsdk/fpdf_editpage.cpp
@@ -109,22 +109,6 @@ const CPDF_Dictionary* GetMarkParamDict(FPDF_PAGEOBJECTMARK mark) {
return pMarkItem->GetParam();
}
-const std::pair<const ByteString, std::unique_ptr<CPDF_Object>>*
-GetMarkParamPairAtIndex(FPDF_PAGEOBJECTMARK mark, unsigned long index) {
- const CPDF_Dictionary* pParams = GetMarkParamDict(mark);
- if (!pParams)
- return nullptr;
-
- for (auto& it : *pParams) {
- if (index == 0)
- return &it;
-
- --index;
- }
-
- return nullptr;
-}
-
CPDF_Dictionary* GetOrCreateMarkParamsDict(FPDF_DOCUMENT document,
FPDF_PAGEOBJECTMARK mark) {
CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
@@ -367,12 +351,19 @@ FPDFPageObjMark_GetParamKey(FPDF_PAGEOBJECTMARK mark,
unsigned long index,
void* buffer,
unsigned long buflen) {
- auto* param_pair = GetMarkParamPairAtIndex(mark, index);
- if (!param_pair)
+ const CPDF_Dictionary* pParams = GetMarkParamDict(mark);
+ if (!pParams)
return 0;
- return Utf16EncodeMaybeCopyAndReturnLength(
- WideString::FromUTF8(param_pair->first.AsStringView()), buffer, buflen);
+ for (auto& it : *pParams) {
+ if (index == 0) {
+ return Utf16EncodeMaybeCopyAndReturnLength(
+ WideString::FromUTF8(it.first.AsStringView()), buffer, buflen);
+ }
+ --index;
+ }
+
+ return 0;
}
FPDF_EXPORT FPDF_OBJECT_TYPE FPDF_CALLCONV