summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
authorHenrique Nakashima <hnakashima@chromium.org>2018-07-11 22:35:59 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-07-11 22:35:59 +0000
commitd8882193737ae167a33c1bf7a5cdb64543ad0301 (patch)
tree2198fb918f27ab645fc27fa0b2bd774d94b62e03 /fpdfsdk
parentebfd26c38c3788d8924a0fc26ba17c50ae9eebaa (diff)
downloadpdfium-d8882193737ae167a33c1bf7a5cdb64543ad0301.tar.xz
Inline GetMarkParamPairAtIndex into FPDFPageObjMark_GetParamKey.
Bug: pdfium:1037 Change-Id: Iddc0d51874cf22d24ddf634ff767cd08807a4904 Reviewed-on: https://pdfium-review.googlesource.com/37630 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'fpdfsdk')
-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