diff options
author | Mike Buland <eichlan@xagasoft.com> | 2009-02-11 05:29:41 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2009-02-11 05:29:41 +0000 |
commit | f4b191f0ea396b58465bfba40749977780a3af58 (patch) | |
tree | 891490e91ab3b67524be67b2b71c85d84fd2f92a /src/old/serializerbzip2.cpp | |
parent | 292ae9453e7fdb2f1023ed9dfc99cbcd751f8b90 (diff) | |
download | libbu++-f4b191f0ea396b58465bfba40749977780a3af58.tar.gz libbu++-f4b191f0ea396b58465bfba40749977780a3af58.tar.bz2 libbu++-f4b191f0ea396b58465bfba40749977780a3af58.tar.xz libbu++-f4b191f0ea396b58465bfba40749977780a3af58.zip |
Just removing some things that are cluttering up the source tree.
Diffstat (limited to '')
-rw-r--r-- | src/old/serializerbzip2.cpp | 88 |
1 files changed, 0 insertions, 88 deletions
diff --git a/src/old/serializerbzip2.cpp b/src/old/serializerbzip2.cpp deleted file mode 100644 index bafabc8..0000000 --- a/src/old/serializerbzip2.cpp +++ /dev/null | |||
@@ -1,88 +0,0 @@ | |||
1 | #include "serializerbzip2.h" | ||
2 | #include "serializable.h" | ||
3 | |||
4 | #include <bzlib.h> | ||
5 | |||
6 | SerializerBZip2::SerializerBZip2(FILE *fhFile, bool bLoading): | ||
7 | Serializer(bLoading), | ||
8 | fhFile(fhFile), | ||
9 | bCloseFile(false) | ||
10 | { | ||
11 | if( bLoading ) | ||
12 | { | ||
13 | bzFile = BZ2_bzReadOpen( &bzerror, fhFile, 0, 0, NULL, 0 ); | ||
14 | checkBZError(); | ||
15 | } | ||
16 | else | ||
17 | { | ||
18 | bzFile = BZ2_bzWriteOpen( &bzerror, fhFile, 9, 0, 0 ); | ||
19 | checkBZError(); | ||
20 | } | ||
21 | } | ||
22 | |||
23 | SerializerBZip2::SerializerBZip2(char *sFileName, bool bLoading): | ||
24 | Serializer(bLoading), | ||
25 | bCloseFile(true) | ||
26 | { | ||
27 | if (bLoading) | ||
28 | { | ||
29 | fhFile = fopen(sFileName, "rb"); | ||
30 | bzFile = BZ2_bzReadOpen( &bzerror, fhFile, 0, 0, NULL, 0 ); | ||
31 | checkBZError(); | ||
32 | } | ||
33 | else | ||
34 | { | ||
35 | fhFile = fopen(sFileName, "wb"); | ||
36 | bzFile = BZ2_bzWriteOpen( &bzerror, fhFile, 9, 0, 0 ); | ||
37 | checkBZError(); | ||
38 | } | ||
39 | } | ||
40 | |||
41 | SerializerBZip2::~SerializerBZip2() | ||
42 | { | ||
43 | close(); | ||
44 | } | ||
45 | |||
46 | void SerializerBZip2::checkBZError() | ||
47 | { | ||
48 | } | ||
49 | |||
50 | void SerializerBZip2::close() | ||
51 | { | ||
52 | if( bzFile != NULL ) | ||
53 | { | ||
54 | if( isLoading() ) | ||
55 | { | ||
56 | void *unused; | ||
57 | int nUnused; | ||
58 | BZ2_bzReadGetUnused( &bzerror, bzFile, &unused, &nUnused ); | ||
59 | BZ2_bzReadClose( &bzerror, bzFile ); | ||
60 | if( nUnused ) | ||
61 | fseek( fhFile, -nUnused, SEEK_CUR ); | ||
62 | } | ||
63 | else | ||
64 | { | ||
65 | BZ2_bzWriteClose( &bzerror, bzFile, 0, 0, 0 ); | ||
66 | } | ||
67 | checkBZError(); | ||
68 | bzFile = NULL; | ||
69 | } | ||
70 | if( fhFile != NULL && bCloseFile ) | ||
71 | { | ||
72 | fclose(fhFile); | ||
73 | fhFile = NULL; | ||
74 | } | ||
75 | } | ||
76 | |||
77 | void SerializerBZip2::write(const void * pData, int32_t nSize) | ||
78 | { | ||
79 | BZ2_bzWrite( &bzerror, bzFile, (void *)pData, nSize ); | ||
80 | checkBZError(); | ||
81 | } | ||
82 | |||
83 | void SerializerBZip2::read(void * pData, int32_t nSize) | ||
84 | { | ||
85 | BZ2_bzRead( &bzerror, bzFile, pData, nSize ); | ||
86 | checkBZError(); | ||
87 | } | ||
88 | |||