diff options
author | tsepez <tsepez@chromium.org> | 2016-05-17 16:24:34 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-17 16:24:34 -0700 |
commit | 56286b311543331d02fee90b832d66389a307961 (patch) | |
tree | 250cc5a2eed0a796115316511a9917e2af3814e5 /xfa/fxjse/class.cpp | |
parent | 0c268e941972fd808d06033b68e22ec2c6648188 (diff) | |
download | pdfium-56286b311543331d02fee90b832d66389a307961.tar.xz |
Remove some CFX_ArrayTemplate<> usage from fxjse
Allows use of otherwise incompatible unique_ptrs.
Review-Url: https://codereview.chromium.org/1992513002
Diffstat (limited to 'xfa/fxjse/class.cpp')
-rw-r--r-- | xfa/fxjse/class.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/xfa/fxjse/class.cpp b/xfa/fxjse/class.cpp index d6744a6112..d5c9b2debc 100644 --- a/xfa/fxjse/class.cpp +++ b/xfa/fxjse/class.cpp @@ -305,16 +305,15 @@ CFXJSE_Class* CFXJSE_Class::Create(CFXJSE_Context* lpContext, const_cast<FXJSE_CLASS*>(lpClassDefinition)))); } pClass->m_hTemplate.Reset(lpContext->m_pIsolate, hFunctionTemplate); - lpContext->m_rgClasses.Add(pClass); + lpContext->m_rgClasses.push_back(std::unique_ptr<CFXJSE_Class>(pClass)); return pClass; } + CFXJSE_Class* CFXJSE_Class::GetClassFromContext(CFXJSE_Context* pContext, const CFX_ByteStringC& szName) { - for (int count = pContext->m_rgClasses.GetSize(), i = 0; i < count; i++) { - CFXJSE_Class* pClass = pContext->m_rgClasses[i]; - if (pClass->m_szClassName == szName) { - return pClass; - } + for (const auto& pClass : pContext->m_rgClasses) { + if (pClass->m_szClassName == szName) + return pClass.get(); } - return NULL; + return nullptr; } |