diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-03-30 16:12:02 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-03-30 20:26:02 +0000 |
commit | 0bb1333a9eff1190ddd68f34c71d6a779c69dfef (patch) | |
tree | 5a46946c4852f147309e2b1389e6f42d6553abf7 /fpdfsdk/javascript/JS_GlobalData.cpp | |
parent | 908c848202ef137e98d96f82a4eadfae551403b7 (diff) | |
download | pdfium-0bb1333a9eff1190ddd68f34c71d6a779c69dfef.tar.xz |
Add some calls to MakeUnique
This CL replaces some new's with pdfium::MakeUnique.
Change-Id: I50faf3ed55e7730b094c14a7989a9dd51cf33cbb
Reviewed-on: https://pdfium-review.googlesource.com/3430
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fpdfsdk/javascript/JS_GlobalData.cpp')
-rw-r--r-- | fpdfsdk/javascript/JS_GlobalData.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/fpdfsdk/javascript/JS_GlobalData.cpp b/fpdfsdk/javascript/JS_GlobalData.cpp index 048fca0591..14202646c5 100644 --- a/fpdfsdk/javascript/JS_GlobalData.cpp +++ b/fpdfsdk/javascript/JS_GlobalData.cpp @@ -9,6 +9,7 @@ #include <utility> #include "core/fdrm/crypto/fx_crypt.h" +#include "third_party/base/ptr_util.h" #include "third_party/base/stl_util.h" #define JS_MAXGLOBALDATA (1024 * 4 - 8) @@ -104,7 +105,7 @@ void CJS_GlobalData::SetGlobalVariableNumber(const CFX_ByteString& propname, pData->data.dData = dData; return; } - std::unique_ptr<CJS_GlobalData_Element> pNewData(new CJS_GlobalData_Element); + auto pNewData = pdfium::MakeUnique<CJS_GlobalData_Element>(); pNewData->data.sKey = sPropName; pNewData->data.nType = JS_GlobalDataType::NUMBER; pNewData->data.dData = dData; @@ -122,7 +123,7 @@ void CJS_GlobalData::SetGlobalVariableBoolean(const CFX_ByteString& propname, pData->data.bData = bData; return; } - std::unique_ptr<CJS_GlobalData_Element> pNewData(new CJS_GlobalData_Element); + auto pNewData = pdfium::MakeUnique<CJS_GlobalData_Element>(); pNewData->data.sKey = sPropName; pNewData->data.nType = JS_GlobalDataType::BOOLEAN; pNewData->data.bData = bData; @@ -140,7 +141,7 @@ void CJS_GlobalData::SetGlobalVariableString(const CFX_ByteString& propname, pData->data.sData = sData; return; } - std::unique_ptr<CJS_GlobalData_Element> pNewData(new CJS_GlobalData_Element); + auto pNewData = pdfium::MakeUnique<CJS_GlobalData_Element>(); pNewData->data.sKey = sPropName; pNewData->data.nType = JS_GlobalDataType::STRING; pNewData->data.sData = sData; @@ -159,7 +160,7 @@ void CJS_GlobalData::SetGlobalVariableObject( pData->data.objData.Copy(array); return; } - std::unique_ptr<CJS_GlobalData_Element> pNewData(new CJS_GlobalData_Element); + auto pNewData = pdfium::MakeUnique<CJS_GlobalData_Element>(); pNewData->data.sKey = sPropName; pNewData->data.nType = JS_GlobalDataType::OBJECT; pNewData->data.objData.Copy(array); @@ -175,7 +176,7 @@ void CJS_GlobalData::SetGlobalVariableNull(const CFX_ByteString& propname) { pData->data.nType = JS_GlobalDataType::NULLOBJ; return; } - std::unique_ptr<CJS_GlobalData_Element> pNewData(new CJS_GlobalData_Element); + auto pNewData = pdfium::MakeUnique<CJS_GlobalData_Element>(); pNewData->data.sKey = sPropName; pNewData->data.nType = JS_GlobalDataType::NULLOBJ; m_arrayGlobalData.push_back(std::move(pNewData)); |