summaryrefslogtreecommitdiff
path: root/fxjs/cjs_globaldata.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-06-19 17:33:32 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-06-19 17:33:32 +0000
commite005dc33c31a2e701e1af3a0a3e5775cabbf1ddd (patch)
tree6cf7623219078464910ee438311e24121c8af2a0 /fxjs/cjs_globaldata.cpp
parented1c58049f0c164969946b6ad0ff06d952ab1949 (diff)
downloadpdfium-e005dc33c31a2e701e1af3a0a3e5775cabbf1ddd.tar.xz
Move fxcrt::{Byte,Wide}Strings with std::move().chromium/3466
Remove some string copies in barcode that were noticed whilst looking for moves. Change-Id: Ieda34d00f633576ba1f0dca283dcdabfb36f236c Reviewed-on: https://pdfium-review.googlesource.com/35410 Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fxjs/cjs_globaldata.cpp')
-rw-r--r--fxjs/cjs_globaldata.cpp31
1 files changed, 12 insertions, 19 deletions
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;