forked from augustbering/ABFS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBlock.h
More file actions
48 lines (43 loc) · 903 Bytes
/
Copy pathBlock.h
File metadata and controls
48 lines (43 loc) · 903 Bytes
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
/*
* Block1.h
*
* Created on: Oct 8, 2011
* Author: august
*/
#ifndef BLOCK1_H_
#define BLOCK1_H_
#include <string>
typedef unsigned char byte;
#define BLOCKSIZE 2*1024*96 //Bigger size means better compression but slower.
#define BLOCKNR(x) (int((x)/(BLOCKSIZE)))
#define BLOCKSTART(block) (block->mBlockNr*BLOCKSIZE)
#include <lzo/lzo1x.h>
#include <iostream>
class ABFile;
struct DiskException
{
std::string filename, error;
DiskException(const char* fn,const char * err):filename(fn),error(err)
{
}
DiskException(){}
void print(){
std::cout<<error<<":"<<filename<<std::endl;
}
};
class Block {
public:
bool mDirty;
byte *data;
int mBlockNr;
lzo_uint dataLen;
int mLastUse;
int read();
ABFile *mFile;
int write();
Block(ABFile *file,int blocknr);
void ove();
virtual ~Block();
void decompress(byte *src, int src_len);
};
#endif /* BLOCK1_H_ */