-
Notifications
You must be signed in to change notification settings - Fork 4
/
LzopFile.h
51 lines (36 loc) · 1.15 KB
/
LzopFile.h
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
#ifndef LZOPFILE_H
#define LZOPFILE_H
#include "lzopfs.h"
#include "CompressedFile.h"
#include "FileList.h"
class LzopFile : public IndexedCompFile {
protected:
typedef uint32_t Checksum;
enum Flags {
AdlerDec = 1 << 0,
AdlerComp = 1 << 1,
ExtraField = 1 << 6,
CRCDec = 1 << 8,
CRCComp = 1 << 9,
MultiPart = 1 << 10,
Filter = 1 << 11,
HeaderCRC = 1 << 12,
};
enum ChecksumType { Adler, CRC };
static const unsigned char Magic[];
static const uint16_t LzopDecodeVersion;
uint32_t mFlags;
void readHeaders(FileHandle& fh, uint32_t& flags);
off_t findBlocks(FileHandle& fh, uint32_t flags, off_t uoff);
Checksum checksum(ChecksumType type, const Buffer& buf);
virtual void checkFileType(FileHandle &fh) { readHeaders(fh, mFlags); }
virtual void buildIndex(FileHandle& fh);
public:
static CompressedFile* open(const std::string& path, const OpenParams& params)
{ return new LzopFile(path, params); }
LzopFile(const std::string& path, const OpenParams& params);
virtual std::string destName() const;
virtual void decompressBlock(const FileHandle& fh, const Block& b,
Buffer& ubuf) const;
};
#endif // LZOPFILE_H