Coverage Report

Created: 2024-04-23 06:19

/src/unrar/rdwrfn.hpp
Line
Count
Source (jump to first uncovered line)
1
#ifndef _RAR_DATAIO_
2
#define _RAR_DATAIO_
3
4
class Archive;
5
class CmdAdd;
6
class Unpack;
7
class ArcFileSearch;
8
9
#if 0
10
// We use external i/o calls for Benchmark command.
11
#define COMPRDATAIO_EXTIO
12
#endif
13
14
class ComprDataIO
15
{
16
  private:
17
    void ShowUnpRead(int64 ArcPos,int64 ArcSize);
18
    void ShowUnpWrite();
19
20
21
    bool UnpackFromMemory;
22
    size_t UnpackFromMemorySize;
23
    byte *UnpackFromMemoryAddr;
24
25
    bool UnpackToMemory;
26
    size_t UnpackToMemorySize;
27
    byte *UnpackToMemoryAddr;
28
29
    size_t UnpWrSize;
30
    byte *UnpWrAddr;
31
32
    int64 UnpPackedSize;
33
    int64 UnpPackedLeft;
34
35
    bool ShowProgress;
36
    bool TestMode;
37
    bool SkipUnpCRC;
38
    bool NoFileHeader;
39
40
    File *SrcFile;
41
    File *DestFile;
42
43
    CmdAdd *Command;
44
45
    FileHeader *SubHead;
46
    int64 *SubHeadPos;
47
48
#ifndef RAR_NOCRYPT
49
    CryptData *Crypt;
50
    CryptData *Decrypt;
51
#endif
52
53
54
    int LastPercent;
55
56
    wchar CurrentCommand;
57
58
  public:
59
    ComprDataIO();
60
    ~ComprDataIO();
61
    void Init();
62
    int UnpRead(byte *Addr,size_t Count);
63
    void UnpWrite(byte *Addr,size_t Count);
64
199
    void EnableShowProgress(bool Show) {ShowProgress=Show;}
65
    void GetUnpackedData(byte **Data,size_t *Size);
66
54.7k
    void SetPackedSizeToRead(int64 Size) {UnpPackedSize=UnpPackedLeft=Size;}
67
54.7k
    void SetTestMode(bool Mode) {TestMode=Mode;}
68
54.5k
    void SetSkipUnpCRC(bool Skip) {SkipUnpCRC=Skip;}
69
199
    void SetNoFileHeader(bool Mode) {NoFileHeader=Mode;}
70
    void SetFiles(File *SrcFile,File *DestFile);
71
0
    void SetCommand(CmdAdd *Cmd) {Command=Cmd;}
72
0
    void SetSubHeader(FileHeader *hd,int64 *Pos) {SubHead=hd;SubHeadPos=Pos;}
73
    void SetEncryption(bool Encrypt,CRYPT_METHOD Method,SecPassword *Password,
74
         const byte *Salt,const byte *InitV,uint Lg2Cnt,byte *HashKey,byte *PswCheck);
75
    void SetAV15Encryption();
76
    void SetCmt13Encryption();
77
    void SetUnpackToMemory(byte *Addr,uint Size);
78
4.09k
    void SetCurrentCommand(wchar Cmd) {CurrentCommand=Cmd;}
79
    void AdjustTotalArcSize(Archive *Arc);
80
81
82
    bool PackVolume;
83
    bool UnpVolume;
84
    bool NextVolumeMissing;
85
    int64 CurPackRead,CurPackWrite,CurUnpRead,CurUnpWrite;
86
87
88
    // Size of already processed archives.
89
    // Used to calculate the total operation progress.
90
    int64 ProcessedArcSize;
91
92
    // Last extracted archive size up to QO or RR block.
93
    int64 LastArcSize;
94
95
    int64 TotalArcSize;
96
97
    DataHash PackedDataHash; // Packed write and unpack read hash.
98
    DataHash PackHash; // Pack read hash.
99
    DataHash UnpHash;  // Unpack write hash.
100
101
    bool Encryption;
102
    bool Decryption;
103
};
104
105
#endif