summaryrefslogtreecommitdiff
path: root/fxjs/cjs_globalvariablearray.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fxjs/cjs_globalvariablearray.cpp')
-rw-r--r--fxjs/cjs_globalvariablearray.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/fxjs/cjs_globalvariablearray.cpp b/fxjs/cjs_globalvariablearray.cpp
index c4ac00cc9a..e8155b6dc0 100644
--- a/fxjs/cjs_globalvariablearray.cpp
+++ b/fxjs/cjs_globalvariablearray.cpp
@@ -15,10 +15,14 @@ CJS_GlobalVariableArray::CJS_GlobalVariableArray() {}
CJS_GlobalVariableArray::~CJS_GlobalVariableArray() {}
-void CJS_GlobalVariableArray::Copy(const CJS_GlobalVariableArray& array) {
+CJS_GlobalVariableArray& CJS_GlobalVariableArray::operator=(
+ const CJS_GlobalVariableArray& that) {
+ if (this == &that)
+ return *this;
+
m_Array.clear();
- for (int i = 0, sz = array.Count(); i < sz; i++) {
- CJS_KeyValue* pOldObjData = array.GetAt(i);
+ for (int i = 0, sz = that.Count(); i < sz; i++) {
+ CJS_KeyValue* pOldObjData = that.GetAt(i);
switch (pOldObjData->nType) {
case JS_GlobalDataType::NUMBER: {
auto pNewObjData = pdfium::MakeUnique<CJS_KeyValue>();
@@ -45,7 +49,7 @@ void CJS_GlobalVariableArray::Copy(const CJS_GlobalVariableArray& array) {
auto pNewObjData = pdfium::MakeUnique<CJS_KeyValue>();
pNewObjData->sKey = pOldObjData->sKey;
pNewObjData->nType = pOldObjData->nType;
- pNewObjData->objData.Copy(pOldObjData->objData);
+ pNewObjData->objData = pOldObjData->objData;
Add(std::move(pNewObjData));
} break;
case JS_GlobalDataType::NULLOBJ: {
@@ -56,6 +60,7 @@ void CJS_GlobalVariableArray::Copy(const CJS_GlobalVariableArray& array) {
} break;
}
}
+ return *this;
}
void CJS_GlobalVariableArray::Add(std::unique_ptr<CJS_KeyValue> pKeyValue) {