summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/fxcrt/xml/cfx_xmlinstruction.cpp2
-rw-r--r--core/fxcrt/xml/cfx_xmlnode.cpp18
-rw-r--r--core/fxcrt/xml/cfx_xmlnode.h4
-rw-r--r--fpdfsdk/fsdk_actionhandler.cpp9
-rw-r--r--fpdfsdk/fsdk_actionhandler.h6
5 files changed, 21 insertions, 18 deletions
diff --git a/core/fxcrt/xml/cfx_xmlinstruction.cpp b/core/fxcrt/xml/cfx_xmlinstruction.cpp
index dabd538b4b..35b68e4d7d 100644
--- a/core/fxcrt/xml/cfx_xmlinstruction.cpp
+++ b/core/fxcrt/xml/cfx_xmlinstruction.cpp
@@ -62,7 +62,7 @@ void CFX_XMLInstruction::Save(
AttributeToString(it.first, it.second).AsStringView());
}
- for (auto target : m_TargetData) {
+ for (const WideString& target : m_TargetData) {
WideString ws = L" \"";
ws += target;
ws += L"\"";
diff --git a/core/fxcrt/xml/cfx_xmlnode.cpp b/core/fxcrt/xml/cfx_xmlnode.cpp
index 1851a4d81e..5e787ed2b9 100644
--- a/core/fxcrt/xml/cfx_xmlnode.cpp
+++ b/core/fxcrt/xml/cfx_xmlnode.cpp
@@ -110,16 +110,18 @@ std::unique_ptr<CFX_XMLNode> CFX_XMLNode::Clone() {
void CFX_XMLNode::Save(const RetainPtr<CFX_SeekableStreamProxy>& pXMLStream) {}
-WideString CFX_XMLNode::EncodeEntities(WideString value) {
- value.Replace(L"&", L"&amp;");
- value.Replace(L"<", L"&lt;");
- value.Replace(L">", L"&gt;");
- value.Replace(L"\'", L"&apos;");
- value.Replace(L"\"", L"&quot;");
- return value;
+WideString CFX_XMLNode::EncodeEntities(const WideString& value) {
+ WideString ret = value;
+ ret.Replace(L"&", L"&amp;");
+ ret.Replace(L"<", L"&lt;");
+ ret.Replace(L">", L"&gt;");
+ ret.Replace(L"\'", L"&apos;");
+ ret.Replace(L"\"", L"&quot;");
+ return ret;
}
-WideString CFX_XMLNode::AttributeToString(WideString name, WideString value) {
+WideString CFX_XMLNode::AttributeToString(const WideString& name,
+ const WideString& value) {
WideString ret = L" ";
ret += name;
ret += L"=\"";
diff --git a/core/fxcrt/xml/cfx_xmlnode.h b/core/fxcrt/xml/cfx_xmlnode.h
index cf2158af5b..76625e3ca2 100644
--- a/core/fxcrt/xml/cfx_xmlnode.h
+++ b/core/fxcrt/xml/cfx_xmlnode.h
@@ -45,8 +45,8 @@ class CFX_XMLNode {
void DeleteChildren();
protected:
- WideString AttributeToString(WideString name, WideString value);
- WideString EncodeEntities(WideString value);
+ WideString AttributeToString(const WideString& name, const WideString& value);
+ WideString EncodeEntities(const WideString& value);
private:
CFX_XMLNode* parent_ = nullptr;
diff --git a/fpdfsdk/fsdk_actionhandler.cpp b/fpdfsdk/fsdk_actionhandler.cpp
index c0e413f158..305d905c85 100644
--- a/fpdfsdk/fsdk_actionhandler.cpp
+++ b/fpdfsdk/fsdk_actionhandler.cpp
@@ -525,7 +525,7 @@ void CPDFSDK_ActionHandler::DoAction_ResetForm(
void CPDFSDK_ActionHandler::RunScriptForAction(
const CPDF_Action& action,
CPDFSDK_FormFillEnvironment* pFormFillEnv,
- std::function<void(IJS_EventContext* context)> cb) {
+ const RunScriptCallback& cb) {
if (!pFormFillEnv->IsJSPlatformPresent())
return;
@@ -536,10 +536,9 @@ void CPDFSDK_ActionHandler::RunScriptForAction(
RunScript(pFormFillEnv, swJS, cb);
}
-void CPDFSDK_ActionHandler::RunScript(
- CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const WideString& script,
- std::function<void(IJS_EventContext* context)> cb) {
+void CPDFSDK_ActionHandler::RunScript(CPDFSDK_FormFillEnvironment* pFormFillEnv,
+ const WideString& script,
+ const RunScriptCallback& cb) {
IJS_Runtime* pRuntime = pFormFillEnv->GetIJSRuntime();
IJS_EventContext* pContext = pRuntime->NewEventContext();
diff --git a/fpdfsdk/fsdk_actionhandler.h b/fpdfsdk/fsdk_actionhandler.h
index 1aaf2f903d..0e5af1a41a 100644
--- a/fpdfsdk/fsdk_actionhandler.h
+++ b/fpdfsdk/fsdk_actionhandler.h
@@ -57,12 +57,14 @@ class CPDFSDK_ActionHandler {
PDFSDK_FieldAction* data);
private:
+ using RunScriptCallback = std::function<void(IJS_EventContext* context)>;
+
void RunScriptForAction(const CPDF_Action& action,
CPDFSDK_FormFillEnvironment* pFormFillEnv,
- std::function<void(IJS_EventContext* context)> cb);
+ const RunScriptCallback& cb);
void RunScript(CPDFSDK_FormFillEnvironment* pFormFillEnv,
const WideString& script,
- std::function<void(IJS_EventContext* context)> cb);
+ const RunScriptCallback& cb);
bool ExecuteDocumentOpenAction(const CPDF_Action& action,
CPDFSDK_FormFillEnvironment* pFormFillEnv,