summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/cxfa_localemgr.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2017-05-18 15:51:20 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-05-19 01:39:40 +0000
commit76020fc9751e55661d1c01b6cd92dfcb1fd56e6a (patch)
tree59d5251b23f5acb78891bf2911a79f2c70812c1c /xfa/fxfa/parser/cxfa_localemgr.cpp
parent22644731e0e46eae1f50927376e557c7d64db1d5 (diff)
downloadpdfium-76020fc9751e55661d1c01b6cd92dfcb1fd56e6a.tar.xz
Move CCodec_ModuleMgr ownership to CPDF_ModuleMgr.
More straight forward than CFX_GEModule owning in and CPDF_ModuleMgr holding a pointer to it. Remove assumptions that the codec modules may return nullptr, and do IWYU. Change-Id: Iba7fc3c7ec223fd6d29a1ab74ed13d35689bc5d5 Reviewed-on: https://pdfium-review.googlesource.com/5654 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser/cxfa_localemgr.cpp')
-rw-r--r--xfa/fxfa/parser/cxfa_localemgr.cpp20
1 files changed, 7 insertions, 13 deletions
diff --git a/xfa/fxfa/parser/cxfa_localemgr.cpp b/xfa/fxfa/parser/cxfa_localemgr.cpp
index 0a691a6ceb..fbb12e2b48 100644
--- a/xfa/fxfa/parser/cxfa_localemgr.cpp
+++ b/xfa/fxfa/parser/cxfa_localemgr.cpp
@@ -11,9 +11,9 @@
#include <memory>
#include <utility>
+#include "core/fpdfapi/cpdf_modulemgr.h"
#include "core/fxcodec/fx_codec.h"
#include "core/fxcrt/xml/cxml_element.h"
-#include "core/fxge/cfx_gemodule.h"
#include "third_party/base/ptr_util.h"
#include "xfa/fxfa/parser/cxfa_node.h"
#include "xfa/fxfa/parser/cxfa_nodelocale.h"
@@ -1056,23 +1056,17 @@ static std::unique_ptr<IFX_Locale> XFA_GetLocaleFromBuffer(const uint8_t* pBuf,
int nBufLen) {
if (!pBuf || nBufLen <= 0)
return nullptr;
- CFX_GEModule* pGeModule = CFX_GEModule::Get();
- if (!pGeModule)
- return nullptr;
-
- CCodec_ModuleMgr* pCodecMgr = pGeModule->GetCodecModule();
- if (!pCodecMgr)
- return nullptr;
- std::unique_ptr<CXML_Element> pLocale;
uint8_t* pOut = nullptr;
uint32_t dwSize;
+ CCodec_ModuleMgr* pCodecMgr = CPDF_ModuleMgr::Get()->GetCodecModule();
pCodecMgr->GetFlateModule()->FlateOrLZWDecode(false, pBuf, nBufLen, true, 0,
0, 0, 0, 0, pOut, dwSize);
- if (pOut) {
- pLocale = CXML_Element::Parse(pOut, dwSize);
- FX_Free(pOut);
- }
+ if (!pOut)
+ return nullptr;
+
+ std::unique_ptr<CXML_Element> pLocale = CXML_Element::Parse(pOut, dwSize);
+ FX_Free(pOut);
return pLocale ? pdfium::MakeUnique<CXFA_XMLLocale>(std::move(pLocale))
: nullptr;
}