summaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
Diffstat (limited to 'testing')
-rw-r--r--testing/fuzzers/xfa_codec_fuzzer.h4
-rw-r--r--testing/fx_string_testhelpers.cpp21
-rw-r--r--testing/fx_string_testhelpers.h19
3 files changed, 2 insertions, 42 deletions
diff --git a/testing/fuzzers/xfa_codec_fuzzer.h b/testing/fuzzers/xfa_codec_fuzzer.h
index bc40f653af..fe9e72b89d 100644
--- a/testing/fuzzers/xfa_codec_fuzzer.h
+++ b/testing/fuzzers/xfa_codec_fuzzer.h
@@ -9,8 +9,8 @@
#include "core/fxcodec/codec/ccodec_progressivedecoder.h"
#include "core/fxcodec/fx_codec.h"
+#include "core/fxcrt/cfx_readonlymemorystream.h"
#include "core/fxge/dib/cfx_dibitmap.h"
-#include "testing/fx_string_testhelpers.h"
#include "third_party/base/ptr_util.h"
#include "third_party/base/span.h"
@@ -53,7 +53,7 @@ class XFACodecFuzzer {
std::unique_ptr<CCodec_ProgressiveDecoder> decoder =
mgr->CreateProgressiveDecoder();
- auto source = pdfium::MakeRetain<CFX_BufferSeekableReadStream>(
+ auto source = pdfium::MakeRetain<CFX_ReadOnlyMemoryStream>(
pdfium::make_span(data, size));
FXCODEC_STATUS status = decoder->LoadImageInfo(source, type, nullptr, true);
if (status != FXCODEC_STATUS_FRAME_READY)
diff --git a/testing/fx_string_testhelpers.cpp b/testing/fx_string_testhelpers.cpp
index e3c443ac4e..96f2c64535 100644
--- a/testing/fx_string_testhelpers.cpp
+++ b/testing/fx_string_testhelpers.cpp
@@ -22,24 +22,3 @@ CFX_InvalidSeekableReadStream::CFX_InvalidSeekableReadStream(
: data_size_(data_size) {}
CFX_InvalidSeekableReadStream::~CFX_InvalidSeekableReadStream() = default;
-
-CFX_BufferSeekableReadStream::CFX_BufferSeekableReadStream(
- pdfium::span<const uint8_t> data)
- : data_(data) {}
-
-CFX_BufferSeekableReadStream::~CFX_BufferSeekableReadStream() = default;
-
-bool CFX_BufferSeekableReadStream::ReadBlock(void* buffer,
- FX_FILESIZE offset,
- size_t size) {
- if (offset < 0 || static_cast<size_t>(offset) >= data_.size())
- return false;
-
- if (static_cast<size_t>(offset) + size > data_.size())
- size = data_.size() - static_cast<size_t>(offset);
- if (size == 0)
- return false;
-
- memcpy(buffer, &data_[offset], size);
- return true;
-}
diff --git a/testing/fx_string_testhelpers.h b/testing/fx_string_testhelpers.h
index 4cddefab0a..a828d825ab 100644
--- a/testing/fx_string_testhelpers.h
+++ b/testing/fx_string_testhelpers.h
@@ -32,23 +32,4 @@ class CFX_InvalidSeekableReadStream : public IFX_SeekableReadStream {
const FX_FILESIZE data_size_;
};
-class CFX_BufferSeekableReadStream : public IFX_SeekableReadStream {
- public:
- template <typename T, typename... Args>
- friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
-
- // IFX_SeekableReadStream:
- bool ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override;
-
- FX_FILESIZE GetSize() override {
- return static_cast<FX_FILESIZE>(data_.size());
- }
-
- private:
- explicit CFX_BufferSeekableReadStream(pdfium::span<const uint8_t> data);
- ~CFX_BufferSeekableReadStream() override;
-
- pdfium::span<const uint8_t> data_;
-};
-
#endif // TESTING_FX_STRING_TESTHELPERS_H_