diff options
Diffstat (limited to 'xfa/fxfa')
-rw-r--r-- | xfa/fxfa/parser/cxfa_localemgr.cpp | 6 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_xmllocale.cpp | 9 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_xmllocale.h | 4 |
3 files changed, 15 insertions, 4 deletions
diff --git a/xfa/fxfa/parser/cxfa_localemgr.cpp b/xfa/fxfa/parser/cxfa_localemgr.cpp index 277ba38eb9..5ad0ce2438 100644 --- a/xfa/fxfa/parser/cxfa_localemgr.cpp +++ b/xfa/fxfa/parser/cxfa_localemgr.cpp @@ -14,7 +14,6 @@ #include "core/fpdfapi/cpdf_modulemgr.h" #include "core/fxcodec/codec/ccodec_flatemodule.h" #include "core/fxcodec/fx_codec.h" -#include "core/fxcrt/xml/cxml_element.h" #include "fxjs/xfa/cjx_object.h" #include "third_party/base/ptr_util.h" #include "xfa/fxfa/parser/cxfa_acrobat.h" @@ -1080,10 +1079,9 @@ std::unique_ptr<LocaleIface> GetLocaleFromBuffer(const uint8_t* pBuf, if (!pOut) return nullptr; - std::unique_ptr<CXML_Element> pLocale = CXML_Element::Parse(pOut, dwSize); + auto locale = CXFA_XMLLocale::Create(pdfium::make_span(pOut, dwSize)); FX_Free(pOut); - return pLocale ? pdfium::MakeUnique<CXFA_XMLLocale>(std::move(pLocale)) - : nullptr; + return locale; } uint16_t GetLanguage(WideString wsLanguage) { diff --git a/xfa/fxfa/parser/cxfa_xmllocale.cpp b/xfa/fxfa/parser/cxfa_xmllocale.cpp index 659c7bbefe..ce68c71e19 100644 --- a/xfa/fxfa/parser/cxfa_xmllocale.cpp +++ b/xfa/fxfa/parser/cxfa_xmllocale.cpp @@ -16,6 +16,15 @@ #include "xfa/fxfa/parser/cxfa_timezoneprovider.h" #include "xfa/fxfa/parser/xfa_utils.h" +// static +std::unique_ptr<CXFA_XMLLocale> CXFA_XMLLocale::Create( + pdfium::span<uint8_t> data) { + std::unique_ptr<CXML_Element> pLocale = + CXML_Element::Parse(data.data(), data.size()); + return pLocale ? pdfium::MakeUnique<CXFA_XMLLocale>(std::move(pLocale)) + : nullptr; +} + CXFA_XMLLocale::CXFA_XMLLocale(std::unique_ptr<CXML_Element> pLocaleData) : m_pLocaleData(std::move(pLocaleData)) {} diff --git a/xfa/fxfa/parser/cxfa_xmllocale.h b/xfa/fxfa/parser/cxfa_xmllocale.h index 9deaed20d8..d1d21e83f1 100644 --- a/xfa/fxfa/parser/cxfa_xmllocale.h +++ b/xfa/fxfa/parser/cxfa_xmllocale.h @@ -10,11 +10,15 @@ #include <memory> #include "core/fxcrt/locale_iface.h" +#include "third_party/base/ptr_util.h" +#include "third_party/base/span.h" class CXML_Element; class CXFA_XMLLocale : public LocaleIface { public: + static std::unique_ptr<CXFA_XMLLocale> Create(pdfium::span<uint8_t> data); + explicit CXFA_XMLLocale(std::unique_ptr<CXML_Element> pLocaleData); ~CXFA_XMLLocale() override; |