@@ -8,10 +8,10 @@ namespace Io {
88
99LzxStream::~LzxStream () { free (CompressedBuffer); }
1010
11- IoError LzxStream::Create (Stream * baseStream, int64_t offset, int64_t size,
12- Stream ** out) {
11+ IoError LzxStream::Create (Stream* baseStream, int64_t offset, int64_t size,
12+ Stream** out) {
1313 if (offset + size > baseStream->Meta .Size ) return IoError_Fail;
14- Stream * dup;
14+ Stream* dup;
1515 int64_t err = baseStream->Duplicate (&dup);
1616 if (err != IoError_OK) return (IoError)err;
1717 err = dup->Seek (offset, RW_SEEK_SET );
@@ -50,7 +50,7 @@ IoError LzxStream::Create(Stream *baseStream, int64_t offset, int64_t size,
5050 return IoError_Fail;
5151 }
5252
53- LzxStream * result = new LzxStream (uncompressedBlockSize);
53+ LzxStream* result = new LzxStream (uncompressedBlockSize);
5454 result->BaseStream = dup;
5555 result->CompressedOffset = compressedOffset;
5656 result->CompressedPosition = 0 ;
@@ -61,13 +61,13 @@ IoError LzxStream::Create(Stream *baseStream, int64_t offset, int64_t size,
6161
6262 result->WindowSize = windowSize;
6363 result->CompressionPartitionSize = compressionPartitionSize;
64- result->CompressedBuffer = (uint8_t *)malloc (compressedBlockSize);
64+ result->CompressedBuffer = (uint8_t *)malloc (compressedBlockSize);
6565 result->CompressedBufferSize = compressedBlockSize;
66- *out = (Stream *)result;
66+ *out = (Stream*)result;
6767 return IoError_OK;
6868}
6969
70- int64_t LzxStream::Read (void * buffer, int64_t sz) {
70+ int64_t LzxStream::Read (void * buffer, int64_t sz) {
7171 return ReadBuffered (buffer, sz);
7272}
7373
@@ -105,14 +105,14 @@ int64_t LzxStream::Seek(int64_t offset, int origin) {
105105 return Position;
106106}
107107
108- IoError LzxStream::Duplicate (Stream ** outStream) {
109- Stream * dup;
108+ IoError LzxStream::Duplicate (Stream** outStream) {
109+ Stream* dup;
110110 int64_t err = BaseStream->Duplicate (&dup);
111111 if (err != IoError_OK) return (IoError)err;
112- LzxStream * result = new LzxStream (*this );
113- result->CompressedBuffer = (uint8_t *)malloc (CompressedBufferSize);
112+ LzxStream* result = new LzxStream (*this );
113+ result->CompressedBuffer = (uint8_t *)malloc (CompressedBufferSize);
114114 result->BaseStream = dup;
115- *outStream = (Stream *)result;
115+ *outStream = (Stream*)result;
116116 return IoError_OK;
117117}
118118
@@ -149,7 +149,7 @@ IoError LzxStream::FillBuffer() {
149149}
150150
151151struct LZXFile {
152- uint8_t * buf;
152+ uint8_t * buf;
153153 int bufSize;
154154 int pos;
155155 int rest;
@@ -158,7 +158,7 @@ struct LZXFile {
158158// Based on
159159// https://github.com/gildor2/UEViewer/blob/master/Unreal/UnCoreCompression.cpp
160160
161- static int LZXread (struct LZXFile * file, void * buffer, int bytes) {
161+ static int LZXread (struct LZXFile * file, void * buffer, int bytes) {
162162 if (!file->rest ) {
163163 // read block header
164164 if (file->buf [file->pos ] == 0xFF ) {
@@ -186,27 +186,27 @@ static int LZXread(struct LZXFile *file, void *buffer, int bytes) {
186186 return bytes;
187187}
188188
189- static int LZXwrite (struct LZXFile * file, void * buffer, int bytes) {
189+ static int LZXwrite (struct LZXFile * file, void * buffer, int bytes) {
190190 memcpy (file->buf + file->pos , buffer, bytes);
191191 file->pos += bytes;
192192 return bytes;
193193}
194194
195- static void * LZXalloc (struct mspack_system * self, size_t bytes) {
195+ static void * LZXalloc (struct mspack_system * self, size_t bytes) {
196196 return malloc (bytes);
197197}
198198
199- static void LZXfree (void * ptr) { free (ptr); }
199+ static void LZXfree (void * ptr) { free (ptr); }
200200
201- static void LZXCopy (void * src, void * dst, size_t bytes) {
201+ static void LZXCopy (void * src, void * dst, size_t bytes) {
202202 memcpy (dst, src, bytes);
203203}
204204
205205static struct mspack_system LZXSys = {
206206 NULL , // open
207207 NULL , // close
208- (auto (*)(mspack_file *, void *, int )->int )&LZXread,
209- (auto (*)(mspack_file *, void *, int )->int )&LZXwrite,
208+ (auto (*)(mspack_file*, void *, int )->int )&LZXread,
209+ (auto (*)(mspack_file*, void *, int )->int )&LZXwrite,
210210 NULL , // seek
211211 NULL , // tell
212212 NULL , // message
@@ -215,8 +215,8 @@ static struct mspack_system LZXSys = {
215215 &LZXCopy,
216216 NULL };
217217
218- int32_t LZXDecompress (uint8_t * CompressedBuffer, int CompressedSize,
219- uint8_t * UncompressedBuffer, int UncompressedSize,
218+ int32_t LZXDecompress (uint8_t * CompressedBuffer, int CompressedSize,
219+ uint8_t * UncompressedBuffer, int UncompressedSize,
220220 int WindowSize, int CompressionPartitionSize) {
221221 // setup streams
222222 struct LZXFile src, dst;
@@ -234,9 +234,9 @@ int32_t LZXDecompress(uint8_t *CompressedBuffer, int CompressedSize,
234234 }
235235 if (WindowSize <= 0 ) WindowSize = 17 ;
236236 if (CompressionPartitionSize <= 0 ) CompressionPartitionSize = 256 * 1024 ;
237- struct lzxd_stream * lzxd =
238- lzxd_init (&LZXSys, (mspack_file *)&src, (mspack_file *)&dst, WindowSize,
239- 0 , CompressionPartitionSize, UncompressedSize, 0 );
237+ struct lzxd_stream * lzxd =
238+ lzxd_init (&LZXSys, (mspack_file*)&src, (mspack_file*)&dst, WindowSize, 0 ,
239+ CompressionPartitionSize, UncompressedSize, 0 );
240240 // decompress
241241 int r = lzxd_decompress (lzxd, UncompressedSize);
242242 if (r != MSPACK_ERR_OK ) return -1 ;
0 commit comments