summaryrefslogtreecommitdiff
path: root/fxjs
diff options
context:
space:
mode:
Diffstat (limited to 'fxjs')
-rw-r--r--fxjs/cfxjse_formcalc_context.cpp8
-rw-r--r--fxjs/cfxjse_resolveprocessor.cpp20
-rw-r--r--fxjs/cjs_globaldata.cpp31
-rw-r--r--fxjs/cjs_globaldata.h16
-rw-r--r--fxjs/cjs_publicmethods.cpp8
-rw-r--r--fxjs/xfa/cjx_layoutpseudomodel.cpp4
-rw-r--r--fxjs/xfa/cjx_object.cpp4
7 files changed, 37 insertions, 54 deletions
diff --git a/fxjs/cfxjse_formcalc_context.cpp b/fxjs/cfxjse_formcalc_context.cpp
index 181d9a1dce..3ed8a78da3 100644
--- a/fxjs/cfxjse_formcalc_context.cpp
+++ b/fxjs/cfxjse_formcalc_context.cpp
@@ -3807,16 +3807,14 @@ void CFXJSE_FormCalcContext::Format(CFXJSE_Value* pThis,
wsPattern = L"num{" + wsPattern + L"}";
} break;
default: {
- WideString wsTestPattern;
- wsTestPattern = L"num{" + wsPattern + L"}";
+ WideString wsTestPattern = L"num{" + wsPattern + L"}";
CXFA_LocaleValue tempLocaleValue(XFA_VT_FLOAT, wsValue, wsTestPattern,
pLocale, pMgr);
if (tempLocaleValue.IsValid()) {
- wsPattern = wsTestPattern;
+ wsPattern = std::move(wsTestPattern);
patternType = XFA_VT_FLOAT;
} else {
- wsTestPattern = L"text{" + wsPattern + L"}";
- wsPattern = wsTestPattern;
+ wsPattern = L"text{" + wsPattern + L"}";
patternType = XFA_VT_TEXT;
}
} break;
diff --git a/fxjs/cfxjse_resolveprocessor.cpp b/fxjs/cfxjse_resolveprocessor.cpp
index 46163b55fc..0419b79053 100644
--- a/fxjs/cfxjse_resolveprocessor.cpp
+++ b/fxjs/cfxjse_resolveprocessor.cpp
@@ -179,7 +179,7 @@ bool CFXJSE_ResolveProcessor::ResolveNumberSign(CFXJSE_ResolveNodeData& rnd) {
rndFind.m_dwStyles = rnd.m_dwStyles;
rndFind.m_dwStyles |= XFA_RESOLVENODE_TagName;
rndFind.m_dwStyles &= ~XFA_RESOLVENODE_Attributes;
- rndFind.m_wsName = wsName;
+ rndFind.m_wsName = std::move(wsName);
rndFind.m_uHashName = static_cast<XFA_HashCode>(
FX_HashCode_GetW(rndFind.m_wsName.AsStringView(), false));
rndFind.m_wsCondition = wsCondition;
@@ -255,10 +255,9 @@ bool CFXJSE_ResolveProcessor::ResolveNormal(CFXJSE_ResolveNodeData& rnd) {
} else {
rndFind.m_CurObject = pVariablesNode;
SetStylesForChild(dwStyles, rndFind);
- WideString wsSaveCondition = rndFind.m_wsCondition;
- rndFind.m_wsCondition.clear();
+ WideString wsSaveCondition = std::move(rndFind.m_wsCondition);
ResolveNormal(rndFind);
- rndFind.m_wsCondition = wsSaveCondition;
+ rndFind.m_wsCondition = std::move(wsSaveCondition);
rnd.m_Objects.insert(rnd.m_Objects.end(), rndFind.m_Objects.begin(),
rndFind.m_Objects.end());
rndFind.m_Objects.clear();
@@ -290,11 +289,9 @@ bool CFXJSE_ResolveProcessor::ResolveNormal(CFXJSE_ResolveNodeData& rnd) {
}
rndFind.m_CurObject = child;
- WideString wsSaveCondition = rndFind.m_wsCondition;
- rndFind.m_wsCondition.clear();
+ WideString wsSaveCondition = std::move(rndFind.m_wsCondition);
ResolveNormal(rndFind);
-
- rndFind.m_wsCondition = wsSaveCondition;
+ rndFind.m_wsCondition = std::move(wsSaveCondition);
rnd.m_Objects.insert(rnd.m_Objects.end(), rndFind.m_Objects.begin(),
rndFind.m_Objects.end());
rndFind.m_Objects.clear();
@@ -425,15 +422,12 @@ bool CFXJSE_ResolveProcessor::ResolveNormal(CFXJSE_ResolveNodeData& rnd) {
}
if (bInnerSearch) {
rndFind.m_CurObject = child;
- WideString wsOriginCondition = rndFind.m_wsCondition;
- rndFind.m_wsCondition.clear();
-
+ WideString wsOriginCondition = std::move(rndFind.m_wsCondition);
uint32_t dwOriginStyle = rndFind.m_dwStyles;
rndFind.m_dwStyles = dwOriginStyle | XFA_RESOLVENODE_ALL;
ResolveNormal(rndFind);
-
rndFind.m_dwStyles = dwOriginStyle;
- rndFind.m_wsCondition = wsOriginCondition;
+ rndFind.m_wsCondition = std::move(wsOriginCondition);
rnd.m_Objects.insert(rnd.m_Objects.end(), rndFind.m_Objects.begin(),
rndFind.m_Objects.end());
rndFind.m_Objects.clear();
diff --git a/fxjs/cjs_globaldata.cpp b/fxjs/cjs_globaldata.cpp
index 59ada3b8d1..de240cf453 100644
--- a/fxjs/cjs_globaldata.cpp
+++ b/fxjs/cjs_globaldata.cpp
@@ -90,9 +90,8 @@ CJS_GlobalData_Element* CJS_GlobalData::GetGlobalVariable(
return iter != m_arrayGlobalData.end() ? iter->get() : nullptr;
}
-void CJS_GlobalData::SetGlobalVariableNumber(const ByteString& propname,
+void CJS_GlobalData::SetGlobalVariableNumber(ByteString sPropName,
double dData) {
- ByteString sPropName(propname);
if (!TrimPropName(&sPropName))
return;
@@ -102,15 +101,14 @@ void CJS_GlobalData::SetGlobalVariableNumber(const ByteString& propname,
return;
}
auto pNewData = pdfium::MakeUnique<CJS_GlobalData_Element>();
- pNewData->data.sKey = sPropName;
+ pNewData->data.sKey = std::move(sPropName);
pNewData->data.nType = JS_GlobalDataType::NUMBER;
pNewData->data.dData = dData;
m_arrayGlobalData.push_back(std::move(pNewData));
}
-void CJS_GlobalData::SetGlobalVariableBoolean(const ByteString& propname,
+void CJS_GlobalData::SetGlobalVariableBoolean(ByteString sPropName,
bool bData) {
- ByteString sPropName(propname);
if (!TrimPropName(&sPropName))
return;
@@ -120,15 +118,14 @@ void CJS_GlobalData::SetGlobalVariableBoolean(const ByteString& propname,
return;
}
auto pNewData = pdfium::MakeUnique<CJS_GlobalData_Element>();
- pNewData->data.sKey = sPropName;
+ pNewData->data.sKey = std::move(sPropName);
pNewData->data.nType = JS_GlobalDataType::BOOLEAN;
pNewData->data.bData = bData;
m_arrayGlobalData.push_back(std::move(pNewData));
}
-void CJS_GlobalData::SetGlobalVariableString(const ByteString& propname,
+void CJS_GlobalData::SetGlobalVariableString(ByteString sPropName,
const ByteString& sData) {
- ByteString sPropName(propname);
if (!TrimPropName(&sPropName))
return;
@@ -138,16 +135,15 @@ void CJS_GlobalData::SetGlobalVariableString(const ByteString& propname,
return;
}
auto pNewData = pdfium::MakeUnique<CJS_GlobalData_Element>();
- pNewData->data.sKey = sPropName;
+ pNewData->data.sKey = std::move(sPropName);
pNewData->data.nType = JS_GlobalDataType::STRING;
pNewData->data.sData = sData;
m_arrayGlobalData.push_back(std::move(pNewData));
}
void CJS_GlobalData::SetGlobalVariableObject(
- const ByteString& propname,
+ ByteString sPropName,
const CJS_GlobalVariableArray& array) {
- ByteString sPropName(propname);
if (!TrimPropName(&sPropName))
return;
@@ -157,14 +153,13 @@ void CJS_GlobalData::SetGlobalVariableObject(
return;
}
auto pNewData = pdfium::MakeUnique<CJS_GlobalData_Element>();
- pNewData->data.sKey = sPropName;
+ pNewData->data.sKey = std::move(sPropName);
pNewData->data.nType = JS_GlobalDataType::OBJECT;
pNewData->data.objData.Copy(array);
m_arrayGlobalData.push_back(std::move(pNewData));
}
-void CJS_GlobalData::SetGlobalVariableNull(const ByteString& propname) {
- ByteString sPropName(propname);
+void CJS_GlobalData::SetGlobalVariableNull(ByteString sPropName) {
if (!TrimPropName(&sPropName))
return;
@@ -173,14 +168,13 @@ void CJS_GlobalData::SetGlobalVariableNull(const ByteString& propname) {
return;
}
auto pNewData = pdfium::MakeUnique<CJS_GlobalData_Element>();
- pNewData->data.sKey = sPropName;
+ pNewData->data.sKey = std::move(sPropName);
pNewData->data.nType = JS_GlobalDataType::NULLOBJ;
m_arrayGlobalData.push_back(std::move(pNewData));
}
-bool CJS_GlobalData::SetGlobalVariablePersistent(const ByteString& propname,
+bool CJS_GlobalData::SetGlobalVariablePersistent(ByteString sPropName,
bool bPersistent) {
- ByteString sPropName(propname);
if (!TrimPropName(&sPropName))
return false;
@@ -192,8 +186,7 @@ bool CJS_GlobalData::SetGlobalVariablePersistent(const ByteString& propname,
return true;
}
-bool CJS_GlobalData::DeleteGlobalVariable(const ByteString& propname) {
- ByteString sPropName(propname);
+bool CJS_GlobalData::DeleteGlobalVariable(ByteString sPropName) {
if (!TrimPropName(&sPropName))
return false;
diff --git a/fxjs/cjs_globaldata.h b/fxjs/cjs_globaldata.h
index b9a4b2123e..9ce4358fd4 100644
--- a/fxjs/cjs_globaldata.h
+++ b/fxjs/cjs_globaldata.h
@@ -29,16 +29,14 @@ class CJS_GlobalData {
static CJS_GlobalData* GetRetainedInstance(CPDFSDK_FormFillEnvironment* pApp);
void Release();
- void SetGlobalVariableNumber(const ByteString& propname, double dData);
- void SetGlobalVariableBoolean(const ByteString& propname, bool bData);
- void SetGlobalVariableString(const ByteString& propname,
- const ByteString& sData);
- void SetGlobalVariableObject(const ByteString& propname,
+ void SetGlobalVariableNumber(ByteString propname, double dData);
+ void SetGlobalVariableBoolean(ByteString propname, bool bData);
+ void SetGlobalVariableString(ByteString propname, const ByteString& sData);
+ void SetGlobalVariableObject(ByteString propname,
const CJS_GlobalVariableArray& array);
- void SetGlobalVariableNull(const ByteString& propname);
- bool SetGlobalVariablePersistent(const ByteString& propname,
- bool bPersistent);
- bool DeleteGlobalVariable(const ByteString& propname);
+ void SetGlobalVariableNull(ByteString propname);
+ bool SetGlobalVariablePersistent(ByteString propname, bool bPersistent);
+ bool DeleteGlobalVariable(ByteString propname);
int32_t GetSize() const;
CJS_GlobalData_Element* GetAt(int index) const;
diff --git a/fxjs/cjs_publicmethods.cpp b/fxjs/cjs_publicmethods.cpp
index 908611b0d6..4630445a35 100644
--- a/fxjs/cjs_publicmethods.cpp
+++ b/fxjs/cjs_publicmethods.cpp
@@ -14,6 +14,7 @@
#include <limits>
#include <sstream>
#include <string>
+#include <utility>
#include <vector>
#include "core/fpdfdoc/cpdf_interform.h"
@@ -1192,13 +1193,12 @@ double CJS_PublicMethods::MakeInterDate(const WideString& strValue) {
WideString sTemp;
for (const auto& c : strValue) {
if (c == L' ' || c == L':') {
- wsArray.push_back(sTemp);
- sTemp.clear();
+ wsArray.push_back(std::move(sTemp));
continue;
}
sTemp += c;
}
- wsArray.push_back(sTemp);
+ wsArray.push_back(std::move(sTemp));
if (wsArray.size() != 8)
return 0;
@@ -1471,7 +1471,7 @@ CJS_Return CJS_PublicMethods::AFSpecial_KeystrokeEx(
}
iIndexMask++;
}
- wideChange = wChange;
+ wideChange = std::move(wChange);
return CJS_Return();
}
diff --git a/fxjs/xfa/cjx_layoutpseudomodel.cpp b/fxjs/xfa/cjx_layoutpseudomodel.cpp
index a5dcf98b00..e448aea252 100644
--- a/fxjs/xfa/cjx_layoutpseudomodel.cpp
+++ b/fxjs/xfa/cjx_layoutpseudomodel.cpp
@@ -7,6 +7,7 @@
#include "fxjs/xfa/cjx_layoutpseudomodel.h"
#include <set>
+#include <utility>
#include "core/fxcrt/fx_coordinates.h"
#include "fxjs/cfxjse_engine.h"
@@ -84,10 +85,9 @@ CJS_Return CJX_LayoutPseudoModel::HWXY(
if (params.size() >= 2) {
WideString tmp_unit = runtime->ToWideString(params[1]);
if (!tmp_unit.IsEmpty())
- unit = tmp_unit;
+ unit = std::move(tmp_unit);
}
int32_t iIndex = params.size() >= 3 ? runtime->ToInt32(params[2]) : 0;
-
CXFA_LayoutProcessor* pDocLayout = GetDocument()->GetLayoutProcessor();
if (!pDocLayout)
return CJS_Return();
diff --git a/fxjs/xfa/cjx_object.cpp b/fxjs/xfa/cjx_object.cpp
index a6b1d122ae..2cf6f6755d 100644
--- a/fxjs/xfa/cjx_object.cpp
+++ b/fxjs/xfa/cjx_object.cpp
@@ -1175,9 +1175,9 @@ void CJX_Object::Script_Attribute_String(CFXJSE_Value* pValue,
WideString wsSOM;
if (!wsValue.IsEmpty()) {
if (wsValue[0] == '#')
- wsID = WideString(wsValue.c_str() + 1, wsValue.GetLength() - 1);
+ wsID = wsValue.Mid(1, wsValue.GetLength() - 1);
else
- wsSOM = wsValue;
+ wsSOM = std::move(wsValue);
}
CXFA_Node* pProtoNode = nullptr;