Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
alexbevi
GitHub Repository: alexbevi/BizHawk
Path: blob/master/libsnes/bsnes/nall/stream/gzip.hpp
2 views
1
#ifdef NALL_STREAM_INTERNAL_HPP
2
3
namespace nall {
4
5
struct gzipstream : memorystream {
6
inline gzipstream(const stream &stream) {
7
unsigned size = stream.size();
8
uint8_t *data = new uint8_t[size];
9
stream.read(data, size);
10
11
gzip archive;
12
bool result = archive.decompress(data, size);
13
delete[] data;
14
if(result == false) return;
15
16
psize = archive.size;
17
pdata = new uint8_t[psize];
18
memcpy(pdata, archive.data, psize);
19
}
20
21
inline ~gzipstream() {
22
if(pdata) delete[] pdata;
23
}
24
};
25
26
}
27
28
#endif
29
30