summaryrefslogtreecommitdiff
path: root/core/fxcrt/cfx_blockbuffer.h
diff options
context:
space:
mode:
authordan sinclair <dsinclair@chromium.org>2017-04-06 13:27:22 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-04-06 17:44:36 +0000
commit25553aa8f74ddccbfcb3bb7b8f55d3f2ac00338f (patch)
treeb01028aa6efe8a7e6d3b9d403807d158e9a82698 /core/fxcrt/cfx_blockbuffer.h
parentad22ac47b9e215df35ecf5e3071124a4ab821181 (diff)
downloadpdfium-25553aa8f74ddccbfcb3bb7b8f55d3f2ac00338f.tar.xz
Remove the length reference from XMLSyntaxParser
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 <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
Diffstat (limited to 'core/fxcrt/cfx_blockbuffer.h')
-rw-r--r--core/fxcrt/cfx_blockbuffer.h32
1 files changed, 15 insertions, 17 deletions
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<wchar_t*, int32_t> 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<wchar_t*, size_t> 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<int32_t, int32_t> TextDataIndex2BufIndex(
- const int32_t iIndex) const;
+ std::pair<size_t, size_t> TextDataIndex2BufIndex(const size_t iIndex) const;
std::vector<std::unique_ptr<wchar_t, FxFreeDeleter>> 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_