Skip to content

Commit ecd4fb1

Browse files
committed
OrcLib: UncompressWofStream: replace NTFSStream with ByteStream
1 parent 7b33095 commit ecd4fb1

File tree

2 files changed

+14
-17
lines changed

2 files changed

+14
-17
lines changed

src/OrcLib/UncompressWofStream.cpp

+11-11
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313

1414
#include "ByteStream.h"
1515
#include "NTFSCompression.h"
16-
#include "NTFSStream.h"
1716
#include "Stream/StreamConcept.h"
1817
#include "Stream/ByteStreamConcept.h"
18+
#include "ByteStream.h"
1919
#include "Utils/BufferView.h"
2020
#include "VolumeReader.h"
2121

@@ -25,7 +25,7 @@ using namespace Orc;
2525
namespace {
2626

2727
std::unique_ptr<UncompressWofStream::WofStreamT>
28-
CreateWofStream(const std::shared_ptr<NTFSStream>& ntfsStream, WofAlgorithm algorithm, uint64_t uncompressedSize)
28+
CreateWofStream(const std::shared_ptr<ByteStream>& rawStream, WofAlgorithm algorithm, uint64_t uncompressedSize)
2929
{
3030
std::error_code ec;
3131

@@ -38,10 +38,10 @@ CreateWofStream(const std::shared_ptr<NTFSStream>& ntfsStream, WofAlgorithm algo
3838

3939
auto wofStream = std::make_unique<UncompressWofStream::WofStreamT>(
4040
std::move(decompressor),
41-
ByteStreamConcept(ntfsStream),
41+
ByteStreamConcept(rawStream),
4242
0,
4343
algorithm,
44-
ntfsStream->GetSize(),
44+
rawStream->GetSize(),
4545
uncompressedSize,
4646
ec);
4747
if (ec)
@@ -61,7 +61,7 @@ UncompressWofStream::UncompressWofStream()
6161
: ChainingStream()
6262
, m_buffer()
6363
, m_wofStream()
64-
, m_ntfsStream()
64+
, m_rawStream()
6565
, m_uncompressedSize(0)
6666
, m_algorithm(WofAlgorithm::kUnknown)
6767
{
@@ -108,23 +108,23 @@ HRESULT UncompressWofStream::Open(const std::shared_ptr<ByteStream>& pChained)
108108
}
109109

110110
HRESULT UncompressWofStream::Open(
111-
const std::shared_ptr<NTFSStream>& ntfsStream,
111+
const std::shared_ptr<ByteStream>& rawStream,
112112
WofAlgorithm algorithm,
113113
uint64_t uncompressedSize)
114114
{
115-
HRESULT hr = Open(ntfsStream);
115+
HRESULT hr = Open(rawStream);
116116
if (FAILED(hr))
117117
{
118118
return hr;
119119
}
120120

121-
m_wofStream = CreateWofStream(ntfsStream, algorithm, uncompressedSize);
121+
m_wofStream = CreateWofStream(rawStream, algorithm, uncompressedSize);
122122
if (!m_wofStream)
123123
{
124124
return E_FAIL;
125125
}
126126

127-
m_ntfsStream = ntfsStream;
127+
m_rawStream = rawStream;
128128
m_algorithm = algorithm;
129129
m_uncompressedSize = uncompressedSize;
130130
return S_OK;
@@ -143,7 +143,7 @@ HRESULT UncompressWofStream::Read_(
143143

144144
if (!m_wofStream)
145145
{
146-
m_wofStream = CreateWofStream(m_ntfsStream, m_algorithm, m_uncompressedSize);
146+
m_wofStream = CreateWofStream(m_rawStream, m_algorithm, m_uncompressedSize);
147147
if (!m_wofStream)
148148
{
149149
return E_FAIL;
@@ -189,7 +189,7 @@ HRESULT UncompressWofStream::SetFilePointer(
189189

190190
if (!m_wofStream)
191191
{
192-
m_wofStream = CreateWofStream(m_ntfsStream, m_algorithm, m_uncompressedSize);
192+
m_wofStream = CreateWofStream(m_rawStream, m_algorithm, m_uncompressedSize);
193193
if (!m_wofStream)
194194
{
195195
return E_FAIL;

src/OrcLib/UncompressWofStream.h

+3-6
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
#include <boost/logic/tribool.hpp>
1616

17-
#include "NTFSStream.h"
1817
#include "Stream/BufferStreamConcept.h"
1918
#include "Stream/ByteStreamConcept.h"
2019
#include "Filesystem/Ntfs/Compression/WofAlgorithm.h"
@@ -25,12 +24,10 @@
2524

2625
namespace Orc {
2726

28-
class NTFSStream;
29-
3027
class UncompressWofStream : public ChainingStream
3128
{
3229
public:
33-
using ByteStreamT = ByteStreamConcept<std::shared_ptr<NTFSStream>>;
30+
using ByteStreamT = ByteStreamConcept<std::shared_ptr<ByteStream>>;
3431
using WofStreamT = Ntfs::WofStreamConcept<ByteStreamT, std::unique_ptr<NtDecompressorConcept>>;
3532

3633
UncompressWofStream();
@@ -52,7 +49,7 @@ class UncompressWofStream : public ChainingStream
5249
STDMETHOD(Open)(const std::shared_ptr<ByteStream>& pChainedStream);
5350

5451
STDMETHOD(Open)
55-
(const std::shared_ptr<NTFSStream>& ntfsStream, Ntfs::WofAlgorithm algorithm, uint64_t uncompressedSize);
52+
(const std::shared_ptr<ByteStream>& rawStream, Ntfs::WofAlgorithm algorithm, uint64_t uncompressedSize);
5653

5754
STDMETHOD(Read_)
5855
(__out_bcount_part(cbBytes, *pcbBytesRead) PVOID pReadBuffer,
@@ -77,7 +74,7 @@ class UncompressWofStream : public ChainingStream
7774
private:
7875
BufferStreamConcept<std::vector<uint8_t>> m_buffer;
7976
std::unique_ptr<WofStreamT> m_wofStream;
80-
std::shared_ptr<NTFSStream> m_ntfsStream;
77+
std::shared_ptr<ByteStream> m_rawStream;
8178
Ntfs::WofAlgorithm m_algorithm;
8279
uint64_t m_uncompressedSize;
8380
};

0 commit comments

Comments
 (0)