summaryrefslogtreecommitdiff
path: root/core/fxcodec/codec/cfx_codec_memory.h
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-08-24 19:45:09 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-08-24 19:45:09 +0000
commit16d18d935d055b74e05f615c0325318a329a7fe1 (patch)
treebce3c35b6db03cedd537a67a28cf91eb0b502b1c /core/fxcodec/codec/cfx_codec_memory.h
parent1cb4d6b14cc9375dc04f57d3f2149eccb9e327a8 (diff)
downloadpdfium-16d18d935d055b74e05f615c0325318a329a7fe1.tar.xz
Use span<uint8_t> in more fxcodec code.
There are also small tweaks in tests to ensure strict order of stack variable lifetimes. Change-Id: Ic9d5c6a2bdd378b517be627f8e29f725bafdc2ad Reviewed-on: https://pdfium-review.googlesource.com/41310 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fxcodec/codec/cfx_codec_memory.h')
-rw-r--r--core/fxcodec/codec/cfx_codec_memory.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/core/fxcodec/codec/cfx_codec_memory.h b/core/fxcodec/codec/cfx_codec_memory.h
index 6eee72a32d..e726dc5320 100644
--- a/core/fxcodec/codec/cfx_codec_memory.h
+++ b/core/fxcodec/codec/cfx_codec_memory.h
@@ -6,27 +6,27 @@
#define CORE_FXCODEC_CODEC_CFX_CODEC_MEMORY_H_
#include "core/fxcrt/retain_ptr.h"
+#include "third_party/base/span.h"
class CFX_CodecMemory : public Retainable {
public:
template <typename T, typename... Args>
friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
- uint8_t* GetBuffer() { return buffer_; }
- size_t GetSize() const { return size_; }
+ uint8_t* GetBuffer() { return buffer_.data(); }
+ size_t GetSize() const { return buffer_.size(); }
size_t GetPosition() const { return pos_; }
- bool IsEOF() const { return pos_ >= size_; }
+ bool IsEOF() const { return pos_ >= buffer_.size(); }
size_t ReadBlock(void* buffer, size_t size);
// Sets the cursor position to |pos| if possible.
bool Seek(size_t pos);
private:
- CFX_CodecMemory(uint8_t* buffer, size_t size);
+ explicit CFX_CodecMemory(pdfium::span<uint8_t> buffer);
~CFX_CodecMemory() override;
- uint8_t* const buffer_;
- const size_t size_;
+ pdfium::span<uint8_t> const buffer_;
size_t pos_ = 0;
};