Use FxAllocAllocator in core/fxcrt std::vector<> of pure data. Change-Id: I11528b183f2e26c771f7862441345fd9ff6c9c33 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/62630 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fxcrt/cfx_seekablestreamproxy.cpp b/core/fxcrt/cfx_seekablestreamproxy.cpp index 7bba0d8..3b65c14 100644 --- a/core/fxcrt/cfx_seekablestreamproxy.cpp +++ b/core/fxcrt/cfx_seekablestreamproxy.cpp
@@ -19,6 +19,7 @@ #include "build/build_config.h" #include "core/fxcrt/fx_codepage.h" #include "core/fxcrt/fx_extension.h" +#include "core/fxcrt/fx_memory_wrappers.h" #include "third_party/base/stl_util.h" namespace { @@ -217,7 +218,7 @@ size_t iBytes = std::min(size, static_cast<size_t>(GetSize() - pos)); if (iBytes > 0) { - std::vector<uint8_t> buf(iBytes); + std::vector<uint8_t, FxAllocAllocator<uint8_t>> buf(iBytes); size_t iLen = ReadData(buf.data(), iBytes); if (m_wCodePage != FX_CODEPAGE_UTF8)
diff --git a/core/fxcrt/cfx_utf8encoder.h b/core/fxcrt/cfx_utf8encoder.h index d44a829..20afe4c 100644 --- a/core/fxcrt/cfx_utf8encoder.h +++ b/core/fxcrt/cfx_utf8encoder.h
@@ -9,6 +9,7 @@ #include <vector> +#include "core/fxcrt/fx_memory_wrappers.h" #include "core/fxcrt/fx_string.h" class CFX_UTF8Encoder { @@ -25,7 +26,7 @@ } private: - std::vector<uint8_t> m_Buffer; + std::vector<uint8_t, FxAllocAllocator<uint8_t>> m_Buffer; }; #endif // CORE_FXCRT_CFX_UTF8ENCODER_H_
diff --git a/core/fxcrt/xml/cfx_xmlparser.cpp b/core/fxcrt/xml/cfx_xmlparser.cpp index f6056e7..2dcfd9b 100644 --- a/core/fxcrt/xml/cfx_xmlparser.cpp +++ b/core/fxcrt/xml/cfx_xmlparser.cpp
@@ -96,7 +96,7 @@ xml_plane_size_ <= 0) return false; - std::vector<wchar_t> buffer; + std::vector<wchar_t, FxAllocAllocator<wchar_t>> buffer; buffer.resize(pdfium::base::ValueOrDieForType<size_t>(alloc_size_safe)); std::stack<wchar_t> character_to_skip_too_stack;
diff --git a/core/fxcrt/xml/cfx_xmlparser.h b/core/fxcrt/xml/cfx_xmlparser.h index 87ad9d6..ef171c6 100644 --- a/core/fxcrt/xml/cfx_xmlparser.h +++ b/core/fxcrt/xml/cfx_xmlparser.h
@@ -10,6 +10,7 @@ #include <memory> #include <vector> +#include "core/fxcrt/fx_memory_wrappers.h" #include "core/fxcrt/fx_string.h" #include "core/fxcrt/retain_ptr.h" @@ -55,7 +56,7 @@ CFX_XMLNode* current_node_ = nullptr; RetainPtr<CFX_SeekableStreamProxy> stream_; - std::vector<wchar_t> current_text_; + std::vector<wchar_t, FxAllocAllocator<wchar_t>> current_text_; size_t xml_plane_size_ = 1024; int32_t entity_start_ = -1; };