Welcome to mirror list, hosted at ThFree Co, Russian Federation.

LZXi86Converter.h « Cab « Archive « 7zip - github.com/kornelski/7z.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 625fa506290d35a1c182112aa9cefeebee671cb7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Archive/Cab/LZXi86Converter.h

#ifndef __ARCHIVE_CAB_LZXI86CONVERTER_H
#define __ARCHIVE_CAB_LZXI86CONVERTER_H

#include "Common/MyCom.h"
#include "../../IStream.h"

namespace NArchive {
namespace NCab {
namespace NLZX {

const int kUncompressedBlockSize = 1 << 15;

class Ci86TranslationOutStream: 
  public ISequentialOutStream,
  public CMyUnknownImp
{
  bool m_TranslationMode;
  CMyComPtr<ISequentialOutStream> m_Stream;
  UInt32 m_ProcessedSize;
  Byte m_Buffer[kUncompressedBlockSize];
  UInt32 m_Pos;
  UInt32 m_TranslationSize;

  void MakeTranslation();
public:
  Ci86TranslationOutStream(): m_Pos(0) {}
  ~Ci86TranslationOutStream() { Flush(); }

  MY_UNKNOWN_IMP

  STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
  STDMETHOD(WritePart)(const void *data, UInt32 size, UInt32 *processedSize);
public:
  void Init(ISequentialOutStream *outStream, bool translationMode, UInt32 translationSize)
  {
    m_Stream = outStream;
    m_TranslationMode = translationMode;
    m_TranslationSize = translationSize;
    m_ProcessedSize = 0;
    m_Pos = 0;
  }
  void ReleaseStream() { m_Stream.Release(); }
  HRESULT Flush();
};

}}}

#endif