summaryrefslogtreecommitdiff
path: root/core/fxcrt/cfx_memorystream.h
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-08-13 18:34:58 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-08-13 18:34:58 +0000
commit19b70815b4d1ce20b6eb865580435a11d8b3c8d0 (patch)
tree4615f1183d4e83cce961b893b04fb304e9c2d639 /core/fxcrt/cfx_memorystream.h
parent0c7cf97859dd38f2cd94532cdd423abff7130853 (diff)
downloadpdfium-19b70815b4d1ce20b6eb865580435a11d8b3c8d0.tar.xz
Split CFX_MemoryStream::m_dwFlags into two bools.chromium/3522
Make them const, and remove m_nGrowSize which is always the same value. Also remove unused method and make GetBuffer() non-const. Change-Id: I272aa4c268c4a887e155800b7c8c10892b343465 Reviewed-on: https://pdfium-review.googlesource.com/39877 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fxcrt/cfx_memorystream.h')
-rw-r--r--core/fxcrt/cfx_memorystream.h12
1 files changed, 4 insertions, 8 deletions
diff --git a/core/fxcrt/cfx_memorystream.h b/core/fxcrt/cfx_memorystream.h
index 64ea2cd5b5..3726b897c4 100644
--- a/core/fxcrt/cfx_memorystream.h
+++ b/core/fxcrt/cfx_memorystream.h
@@ -14,8 +14,6 @@
class CFX_MemoryStream : public IFX_SeekableStream {
public:
- enum Type { kConsecutive = 1 << 0, kTakeOver = 1 << 1 };
-
template <typename T, typename... Args>
friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
@@ -31,9 +29,7 @@ class CFX_MemoryStream : public IFX_SeekableStream {
// Sets the cursor position to |pos| if possible
bool Seek(size_t pos);
- bool IsConsecutive() const { return !!(m_dwFlags & Type::kConsecutive); }
-
- uint8_t* GetBuffer() const {
+ uint8_t* GetBuffer() {
return !m_Blocks.empty() ? m_Blocks.front() : nullptr;
}
@@ -47,9 +43,9 @@ class CFX_MemoryStream : public IFX_SeekableStream {
std::vector<uint8_t*> m_Blocks;
size_t m_nTotalSize;
size_t m_nCurSize;
- size_t m_nCurPos;
- size_t m_nGrowSize;
- uint32_t m_dwFlags;
+ size_t m_nCurPos = 0;
+ const bool m_bConsecutive;
+ const bool m_bTakeOver; // Owns the data in |m_Blocks|.
};
#endif // CORE_FXCRT_CFX_MEMORYSTREAM_H_