Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(458)

Unified Diff: xfa/fxfa/parser/xfa_localemgr.cpp

Issue 2227883002: Use smart pointers for class owned pointers in xfa/fxfa (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: remove deleters Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« xfa/fxfa/include/xfa_ffdocview.h ('K') | « xfa/fxfa/parser/xfa_locale.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fxfa/parser/xfa_localemgr.cpp
diff --git a/xfa/fxfa/parser/xfa_localemgr.cpp b/xfa/fxfa/parser/xfa_localemgr.cpp
index 2d2bddd44a41dec09ec06660a18d89c6ac9e02e4..999e0f27aa070d80bc884a4d371c45e90161be56 100644
--- a/xfa/fxfa/parser/xfa_localemgr.cpp
+++ b/xfa/fxfa/parser/xfa_localemgr.cpp
@@ -6,6 +6,9 @@
#include "xfa/fxfa/parser/xfa_localemgr.h"
+#include <memory>
+#include <utility>
+
#include "core/fxcodec/include/fx_codec.h"
#include "core/fxcrt/include/fx_xml.h"
#include "core/fxge/include/cfx_gemodule.h"
@@ -1042,20 +1045,18 @@ static IFX_Locale* XFA_GetLocaleFromBuffer(const uint8_t* pBuf, int nBufLen) {
if (!pCodecMgr) {
return nullptr;
}
- CXML_Element* pLocale = nullptr;
+ std::unique_ptr<CXML_Element> pLocale;
uint8_t* pOut = nullptr;
uint32_t dwSize;
pCodecMgr->GetFlateModule()->FlateOrLZWDecode(FALSE, pBuf, nBufLen, TRUE, 0,
0, 0, 0, 0, pOut, dwSize);
if (pOut) {
- pLocale = CXML_Element::Parse(pOut, dwSize);
+ pLocale.reset(CXML_Element::Parse(pOut, dwSize));
FX_Free(pOut);
}
- if (pLocale) {
- return new CXFA_XMLLocale(pLocale);
- }
- return nullptr;
+ return pLocale ? new CXFA_XMLLocale(std::move(pLocale)) : nullptr;
}
+
static uint16_t XFA_GetLanguage(CFX_WideString wsLanguage) {
uint16_t dwLangueID = XFA_LANGID_en_US;
if (wsLanguage.GetLength() < 2) {
« xfa/fxfa/include/xfa_ffdocview.h ('K') | « xfa/fxfa/parser/xfa_locale.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698