summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BUILD.gn6
-rw-r--r--core/fxcrt/cfx_seekablemultistream.cpp (renamed from xfa/fxfa/cxfa_fileread.cpp)27
-rw-r--r--core/fxcrt/cfx_seekablemultistream.h (renamed from xfa/fxfa/cxfa_fileread.h)12
-rw-r--r--core/fxcrt/cfx_seekablemultistream_unittest.cpp (renamed from xfa/fxfa/cxfa_ffapp_unittest.cpp)11
-rw-r--r--xfa/fxfa/cxfa_ffdoc.cpp4
5 files changed, 31 insertions, 29 deletions
diff --git a/BUILD.gn b/BUILD.gn
index 7d98e1f37a..2715b55824 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -819,6 +819,8 @@ static_library("fxcrt") {
"core/fxcrt/cfx_fixedbufgrow.h",
"core/fxcrt/cfx_memorystream.cpp",
"core/fxcrt/cfx_memorystream.h",
+ "core/fxcrt/cfx_seekablemultistream.cpp",
+ "core/fxcrt/cfx_seekablemultistream.h",
"core/fxcrt/cfx_utf8decoder.cpp",
"core/fxcrt/cfx_utf8decoder.h",
"core/fxcrt/cfx_widetextbuf.cpp",
@@ -1727,8 +1729,6 @@ if (pdf_enable_xfa) {
"xfa/fxfa/cxfa_ffwidget.h",
"xfa/fxfa/cxfa_ffwidgethandler.cpp",
"xfa/fxfa/cxfa_ffwidgethandler.h",
- "xfa/fxfa/cxfa_fileread.cpp",
- "xfa/fxfa/cxfa_fileread.h",
"xfa/fxfa/cxfa_fontmgr.cpp",
"xfa/fxfa/cxfa_fontmgr.h",
"xfa/fxfa/cxfa_fwladapterwidgetmgr.cpp",
@@ -1962,6 +1962,7 @@ test("pdfium_unittests") {
"core/fxcodec/jbig2/JBig2_BitStream_unittest.cpp",
"core/fxcodec/jbig2/JBig2_Image_unittest.cpp",
"core/fxcrt/bytestring_unittest.cpp",
+ "core/fxcrt/cfx_seekablemultistream_unittest.cpp",
"core/fxcrt/fx_bidi_unittest.cpp",
"core/fxcrt/fx_coordinates_unittest.cpp",
"core/fxcrt/fx_extension_unittest.cpp",
@@ -2010,7 +2011,6 @@ test("pdfium_unittests") {
"xfa/fgas/crt/cfgas_formatstring_unittest.cpp",
"xfa/fgas/layout/cfx_rtfbreak_unittest.cpp",
"xfa/fwl/cfx_barcode_unittest.cpp",
- "xfa/fxfa/cxfa_ffapp_unittest.cpp",
"xfa/fxfa/cxfa_ffbarcode_unittest.cpp",
"xfa/fxfa/cxfa_textparser_unittest.cpp",
"xfa/fxfa/fm2js/cxfa_fmlexer_unittest.cpp",
diff --git a/xfa/fxfa/cxfa_fileread.cpp b/core/fxcrt/cfx_seekablemultistream.cpp
index 12e23646d1..12682d7678 100644
--- a/xfa/fxfa/cxfa_fileread.cpp
+++ b/core/fxcrt/cfx_seekablemultistream.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fxfa/cxfa_fileread.h"
+#include "core/fxcrt/cfx_seekablemultistream.h"
#include <algorithm>
@@ -12,23 +12,26 @@
#include "third_party/base/logging.h"
#include "third_party/base/stl_util.h"
-CXFA_FileRead::CXFA_FileRead(const std::vector<CPDF_Stream*>& streams) {
+CFX_SeekableMultiStream::CFX_SeekableMultiStream(
+ const std::vector<CPDF_Stream*>& streams) {
for (CPDF_Stream* pStream : streams) {
m_Data.push_back(pdfium::MakeRetain<CPDF_StreamAcc>(pStream));
m_Data.back()->LoadAllData();
}
}
-CXFA_FileRead::~CXFA_FileRead() {}
+CFX_SeekableMultiStream::~CFX_SeekableMultiStream() {}
-FX_FILESIZE CXFA_FileRead::GetSize() {
+FX_FILESIZE CFX_SeekableMultiStream::GetSize() {
uint32_t dwSize = 0;
for (const auto& acc : m_Data)
dwSize += acc->GetSize();
return dwSize;
}
-bool CXFA_FileRead::ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) {
+bool CFX_SeekableMultiStream::ReadBlock(void* buffer,
+ FX_FILESIZE offset,
+ size_t size) {
int32_t iCount = pdfium::CollectionSize<int32_t>(m_Data);
int32_t index = 0;
while (index < iCount) {
@@ -56,27 +59,27 @@ bool CXFA_FileRead::ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) {
return false;
}
-size_t CXFA_FileRead::ReadBlock(void* buffer, size_t size) {
+size_t CFX_SeekableMultiStream::ReadBlock(void* buffer, size_t size) {
NOTREACHED();
return 0;
}
-FX_FILESIZE CXFA_FileRead::GetPosition() {
+FX_FILESIZE CFX_SeekableMultiStream::GetPosition() {
return 0;
}
-bool CXFA_FileRead::IsEOF() {
+bool CFX_SeekableMultiStream::IsEOF() {
return false;
}
-bool CXFA_FileRead::Flush() {
+bool CFX_SeekableMultiStream::Flush() {
NOTREACHED();
return false;
}
-bool CXFA_FileRead::WriteBlock(const void* pData,
- FX_FILESIZE offset,
- size_t size) {
+bool CFX_SeekableMultiStream::WriteBlock(const void* pData,
+ FX_FILESIZE offset,
+ size_t size) {
NOTREACHED();
return false;
}
diff --git a/xfa/fxfa/cxfa_fileread.h b/core/fxcrt/cfx_seekablemultistream.h
index 62fa4c67bb..9138d7c321 100644
--- a/xfa/fxfa/cxfa_fileread.h
+++ b/core/fxcrt/cfx_seekablemultistream.h
@@ -4,8 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FXFA_CXFA_FILEREAD_H_
-#define XFA_FXFA_CXFA_FILEREAD_H_
+#ifndef CORE_FXCRT_CFX_SEEKABLEMULTISTREAM_H_
+#define CORE_FXCRT_CFX_SEEKABLEMULTISTREAM_H_
#include <vector>
@@ -15,10 +15,10 @@
class CPDF_Stream;
class CPDF_StreamAcc;
-class CXFA_FileRead : public IFX_SeekableStream {
+class CFX_SeekableMultiStream : public IFX_SeekableStream {
public:
- explicit CXFA_FileRead(const std::vector<CPDF_Stream*>& streams);
- ~CXFA_FileRead() override;
+ explicit CFX_SeekableMultiStream(const std::vector<CPDF_Stream*>& streams);
+ ~CFX_SeekableMultiStream() override;
// IFX_SeekableReadStream
FX_FILESIZE GetPosition() override;
@@ -33,4 +33,4 @@ class CXFA_FileRead : public IFX_SeekableStream {
std::vector<RetainPtr<CPDF_StreamAcc>> m_Data;
};
-#endif // XFA_FXFA_CXFA_FILEREAD_H_
+#endif // CORE_FXCRT_CFX_SEEKABLEMULTISTREAM_H_
diff --git a/xfa/fxfa/cxfa_ffapp_unittest.cpp b/core/fxcrt/cfx_seekablemultistream_unittest.cpp
index bd35956c39..89213b13af 100644
--- a/xfa/fxfa/cxfa_ffapp_unittest.cpp
+++ b/core/fxcrt/cfx_seekablemultistream_unittest.cpp
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "xfa/fxfa/cxfa_ffapp.h"
+#include "core/fxcrt/cfx_seekablemultistream.h"
#include <memory>
#include <vector>
@@ -13,11 +13,10 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/test_support.h"
#include "third_party/base/ptr_util.h"
-#include "xfa/fxfa/cxfa_fileread.h"
-TEST(CXFAFileReadTest, NoStreams) {
+TEST(CFX_SeekableMultiStreamTest, NoStreams) {
std::vector<CPDF_Stream*> streams;
- auto fileread = pdfium::MakeRetain<CXFA_FileRead>(streams);
+ auto fileread = pdfium::MakeRetain<CFX_SeekableMultiStream>(streams);
uint8_t output_buffer[16];
memset(output_buffer, 0xbd, sizeof(output_buffer));
@@ -29,7 +28,7 @@ TEST(CXFAFileReadTest, EmptyStreams) {
std::vector<CPDF_Stream*> streams;
auto stream1 = pdfium::MakeUnique<CPDF_Stream>();
streams.push_back(stream1.get());
- auto fileread = pdfium::MakeRetain<CXFA_FileRead>(streams);
+ auto fileread = pdfium::MakeRetain<CFX_SeekableMultiStream>(streams);
uint8_t output_buffer[16];
memset(output_buffer, 0xbd, sizeof(output_buffer));
@@ -54,7 +53,7 @@ TEST(CXFAFileReadTest, NormalStreams) {
streams.push_back(stream1.get());
streams.push_back(stream2.get());
streams.push_back(stream3.get());
- auto fileread = pdfium::MakeRetain<CXFA_FileRead>(streams);
+ auto fileread = pdfium::MakeRetain<CFX_SeekableMultiStream>(streams);
uint8_t output_buffer[16];
memset(output_buffer, 0xbd, sizeof(output_buffer));
diff --git a/xfa/fxfa/cxfa_ffdoc.cpp b/xfa/fxfa/cxfa_ffdoc.cpp
index 640ac39178..d53f1b2ad7 100644
--- a/xfa/fxfa/cxfa_ffdoc.cpp
+++ b/xfa/fxfa/cxfa_ffdoc.cpp
@@ -16,6 +16,7 @@
#include "core/fpdfdoc/cpdf_nametree.h"
#include "core/fxcrt/cfx_checksumcontext.h"
#include "core/fxcrt/cfx_memorystream.h"
+#include "core/fxcrt/cfx_seekablemultistream.h"
#include "core/fxcrt/fx_extension.h"
#include "core/fxcrt/fx_memory.h"
#include "core/fxcrt/xml/cfx_xmlelement.h"
@@ -26,7 +27,6 @@
#include "xfa/fxfa/cxfa_ffdocview.h"
#include "xfa/fxfa/cxfa_ffnotify.h"
#include "xfa/fxfa/cxfa_ffwidget.h"
-#include "xfa/fxfa/cxfa_fileread.h"
#include "xfa/fxfa/cxfa_fontmgr.h"
#include "xfa/fxfa/parser/cxfa_dataexporter.h"
#include "xfa/fxfa/parser/cxfa_dataimporter.h"
@@ -316,7 +316,7 @@ bool CXFA_FFDoc::OpenDoc(CPDF_Document* pPDFDoc) {
return false;
m_pPDFDoc = pPDFDoc;
- m_pStream = pdfium::MakeRetain<CXFA_FileRead>(xfaStreams);
+ m_pStream = pdfium::MakeRetain<CFX_SeekableMultiStream>(xfaStreams);
return true;
}