summaryrefslogtreecommitdiff
path: root/core/fxcrt
diff options
context:
space:
mode:
authorNicolás Peña <npm@chromium.org>2017-03-23 14:31:11 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-03-23 14:43:07 +0000
commit4650ded3dccefca89b4ef4757bae49a21b4a786d (patch)
tree4bb47204c8864a568c29c6ffb3982499547ddc4c /core/fxcrt
parentcdba747a53082a7f36534dffa6a3ad01628e53c3 (diff)
downloadpdfium-4650ded3dccefca89b4ef4757bae49a21b4a786d.tar.xz
Revert "Remove CFX_FixedBufGrow"
This reverts commit 55d1d0191ea8316df32858d8cc62fb7c620e8613. Reason for revert: Slowing down corpus tests by a lot on Mac/Win Original change's description: > Remove CFX_FixedBufGrow > > This Cl replaces the CFX_FixedBufGrow class with std::vector. > > Change-Id: I85c85b7a8de4794840b561e09841bb464cfa9dfe > Reviewed-on: https://pdfium-review.googlesource.com/3138 > Reviewed-by: Tom Sepez <tsepez@chromium.org> > Commit-Queue: dsinclair <dsinclair@chromium.org> > TBR=tsepez@chromium.org,dsinclair@chromium.org,pdfium-reviews@googlegroups.com # Not skipping CQ checks because original CL landed > 1 day ago. Change-Id: Iaee27570f140b2033b5d8fb8f3077fc839558d64 Reviewed-on: https://pdfium-review.googlesource.com/3158 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
Diffstat (limited to 'core/fxcrt')
-rw-r--r--core/fxcrt/fx_basic.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/core/fxcrt/fx_basic.h b/core/fxcrt/fx_basic.h
index 2786918fd1..076766a0a2 100644
--- a/core/fxcrt/fx_basic.h
+++ b/core/fxcrt/fx_basic.h
@@ -317,6 +317,23 @@ class CFX_ArrayTemplate : public CFX_BasicArray {
}
};
+template <class DataType, int FixedSize>
+class CFX_FixedBufGrow {
+ public:
+ explicit CFX_FixedBufGrow(int data_size) {
+ if (data_size > FixedSize) {
+ m_pGrowData.reset(FX_Alloc(DataType, data_size));
+ return;
+ }
+ FXSYS_memset(m_FixedData, 0, sizeof(DataType) * FixedSize);
+ }
+ operator DataType*() { return m_pGrowData ? m_pGrowData.get() : m_FixedData; }
+
+ private:
+ DataType m_FixedData[FixedSize];
+ std::unique_ptr<DataType, FxFreeDeleter> m_pGrowData;
+};
+
class CFX_BitStream {
public:
void Init(const uint8_t* pData, uint32_t dwSize);