From 25553aa8f74ddccbfcb3bb7b8f55d3f2ac00338f Mon Sep 17 00:00:00 2001 From: dan sinclair Date: Thu, 6 Apr 2017 13:27:22 -0400 Subject: Remove the length reference from XMLSyntaxParser MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This Cl removes the reference to the length of the CFX_BlockBuffer that was stored and manipulated in CFDE_XMLSyntaxParser. Methods have been added to BlockBuffer to satisify the usages in the syntax parser. Change-Id: I1107c343ce267283c4c45aa3ae1bbfa93c24079f Reviewed-on: https://pdfium-review.googlesource.com/3816 Commit-Queue: dsinclair Reviewed-by: Nicolás Peña --- core/fxcrt/cfx_blockbuffer.h | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) (limited to 'core/fxcrt/cfx_blockbuffer.h') diff --git a/core/fxcrt/cfx_blockbuffer.h b/core/fxcrt/cfx_blockbuffer.h index e7e493ca86..867449074d 100644 --- a/core/fxcrt/cfx_blockbuffer.h +++ b/core/fxcrt/cfx_blockbuffer.h @@ -21,33 +21,31 @@ class CFX_BlockBuffer { ~CFX_BlockBuffer(); bool InitBuffer(); - bool IsInitialized() { return m_iBufferSize / GetAllocStep() >= 1; } + bool IsInitialized() { return m_BufferSize / GetAllocStep() >= 1; } - std::pair GetAvailableBlock(); - int32_t GetAllocStep() const; - - // This is ... scary. This returns a ref, which the XMLSyntaxParser stores - // and modifies. - int32_t& GetDataLengthRef() { return m_iDataLength; } + std::pair GetAvailableBlock(); + size_t GetAllocStep() const; + size_t GetDataLength() const { return m_DataLength; } + void IncrementDataLength() { m_DataLength++; } + bool IsEmpty() const { return m_DataLength == 0; } void Reset(bool bReserveData) { if (!bReserveData) - m_iStartPosition = 0; - m_iDataLength = 0; + m_StartPosition = 0; + m_DataLength = 0; } - void SetTextChar(int32_t iIndex, wchar_t ch); - int32_t DeleteTextChars(int32_t iCount); - CFX_WideString GetTextData(int32_t iStart, int32_t iLength) const; + void SetTextChar(size_t iIndex, wchar_t ch); + void DeleteTextChars(size_t iCount); + CFX_WideString GetTextData(size_t iStart, size_t iLength) const; private: - std::pair TextDataIndex2BufIndex( - const int32_t iIndex) const; + std::pair TextDataIndex2BufIndex(const size_t iIndex) const; std::vector> m_BlockArray; - int32_t m_iDataLength; - int32_t m_iBufferSize; - int32_t m_iStartPosition; + size_t m_DataLength; + size_t m_BufferSize; + size_t m_StartPosition; }; #endif // CORE_FXCRT_CFX_BLOCKBUFFER_H_ -- cgit v1.2.3