File: recvol.hpp

package info (click to toggle)
unrar-nonfree 1%3A5.2.7-0.1%2Bdeb8u1
  • links: PTS
  • area: non-free
  • in suites: jessie
  • size: 1,344 kB
  • ctags: 3,512
  • sloc: cpp: 24,411; makefile: 124; sh: 10
file content (84 lines) | stat: -rw-r--r-- 2,113 bytes parent folder | download | duplicates (3)
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#ifndef _RAR_RECVOL_
#define _RAR_RECVOL_

#define REV5_SIGN      "Rar!\x1aRev"
#define REV5_SIGN_SIZE             8

class RecVolumes3
{
  private:
    File *SrcFile[256];
    Array<byte> Buf;

#ifdef RAR_SMP
    ThreadPool *RSThreadPool;
#endif
  public:
    RecVolumes3();
    ~RecVolumes3();
    void Make(RAROptions *Cmd,wchar *ArcName);
    bool Restore(RAROptions *Cmd,const wchar *Name,bool Silent);
};


struct RecVolItem
{
  File *f;
  wchar Name[NM];
  uint CRC;
  uint64 FileSize;
  bool New;   // Newly created RAR volume.
  bool Valid; // If existing RAR volume is valid.
};


class RecVolumes5;
struct RecRSThreadData
{
  RecVolumes5 *RecRSPtr;
  RSCoder16 *RS;
  bool Encode;
  uint DataNum;
  const byte *Data;
  size_t StartPos;
  size_t Size;
};

class RecVolumes5
{
  private:
    void ProcessRS(RAROptions *Cmd,uint DataNum,const byte *Data,uint MaxRead,bool Encode);
    void ProcessRS(RAROptions *Cmd,uint MaxRead,bool Encode);
    uint ReadHeader(File *RecFile,bool FirstRev);

    Array<RecVolItem> RecItems;

    byte *RealReadBuffer; // Real pointer returned by 'new'.
    byte *ReadBuffer;     // Pointer aligned for SSE instructions.

    byte *RealBuf;        // Real pointer returned by 'new'.
    byte *Buf;            // Store ECC or recovered data here, aligned for SSE.
    size_t RecBufferSize; // Buffer area allocated for single volume.

    uint DataCount;   // Number of archives.
    uint RecCount;    // Number of recovery volumes.
    uint TotalCount;  // Total number of archives and recovery volumes.

    bool *ValidFlags; // Volume validity flags for recovering.
    uint MissingVolumes; // Number of missing or bad RAR volumes.

#ifdef RAR_SMP
    ThreadPool *RecThreadPool;
#endif
    RecRSThreadData ThreadData[MaxPoolThreads]; // Store thread parameters.
  public: // 'public' only because called from thread functions.
    void ProcessAreaRS(RecRSThreadData *td);
  public:
    RecVolumes5();
    ~RecVolumes5();
    bool Restore(RAROptions *Cmd,const wchar *Name,bool Silent);
};

bool RecVolumesRestore(RAROptions *Cmd,const wchar *Name,bool Silent);

#endif