Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
lzo.h
Go to the documentation of this file.
1/*
2** Command & Conquer Generals Zero Hour(tm)
3** Copyright 2025 Electronic Arts Inc.
4**
5** This program is free software: you can redistribute it and/or modify
6** it under the terms of the GNU General Public License as published by
7** the Free Software Foundation, either version 3 of the License, or
8** (at your option) any later version.
9**
10** This program is distributed in the hope that it will be useful,
11** but WITHOUT ANY WARRANTY; without even the implied warranty of
12** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13** GNU General Public License for more details.
14**
15** You should have received a copy of the GNU General Public License
16** along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19/***********************************************************************************************
20 *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
21 ***********************************************************************************************
22 * *
23 * Project Name : Command & Conquer *
24 * *
25 * $Archive:: /Commando/Code/wwlib/lzo.h $*
26 * *
27 * $Author:: Greg_h $*
28 * *
29 * $Modtime:: 7/19/99 3:35p $*
30 * *
31 * $Revision:: 3 $*
32 * *
33 *---------------------------------------------------------------------------------------------*
34 * Functions: *
35 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
36
37#ifndef _LZO_H
38#define _LZO_H
39
40#include "lzoconf.h"
41#include "lzo1x.h"
42
43// Macros.
44
45// Maximum size of any LZO compressed chunk expessed in terms of maximum size
46// of UNcompressed chunk. NOTE: LZO needs an additional 16 bytes per uncompressed K.
47// Note: SKB took this from lzo.h in lol3 code.
48//
49// (gth) The buffer that you compress to should be the size define by
50// LZO_BUFFER_SIZE(uncompressed_size). Also, the work buffer should be of
51// size: LZO1X_MEM_COMPRESS which is defined in lzo1x.h.
52
53#define LZO_BUFFER_SIZE(s) ((s) + ((((s) / 0x400) + 1) * 16))
54
55
56int lzo1x_1_compress ( const lzo_byte *in,
57 lzo_uint in_len,
58 lzo_byte *out,
59 lzo_uint *out_len,
60 lzo_voidp wrkmem);
61
62
63int lzo1x_decompress ( const lzo_byte *in,
64 lzo_uint in_len,
65 lzo_byte *out,
66 lzo_uint *out_len,
67 lzo_voidp);
68
69
70
71//
72// LZOCompressor
73// Simply wraps the 'C' style lzo compression and decompression functions and
74// hides the work buffer. So you dont have to worry about the work buffer but
75// you do have to manage the compression buffer being large enough to hold the
76// worst case compression: LZO_BUFFER_SIZE(uncompressed_size).
77//
79{
80public:
81
82 static int Compress
83 (
84 const lzo_byte * in,
85 lzo_uint in_len,
86 lzo_byte * out,
87 lzo_uint * out_len
88 );
89
90 static int Decompress
91 (
92 const lzo_byte * in,
93 lzo_uint in_len,
94 lzo_byte * out,
95 lzo_uint * out_len
96 );
97
98private:
99
100 static lzo_byte WorkBuffer[LZO1X_MEM_COMPRESS + 1];
101 static lzo_byte * EOWorkBuffer;
102};
103
104
105
106#endif
static int Decompress(const lzo_byte *in, lzo_uint in_len, lzo_byte *out, lzo_uint *out_len)
Definition lzo.cpp:105
static int Compress(const lzo_byte *in, lzo_uint in_len, lzo_byte *out, lzo_uint *out_len)
Definition lzo.cpp:68
#define LZO1X_MEM_COMPRESS
Definition lzo1x.h:81
int lzo1x_1_compress(const lzo_byte *in, lzo_uint in_len, lzo_byte *out, lzo_uint *out_len, lzo_voidp wrkmem)
Definition lzo1x_c.cpp:335
int lzo1x_decompress(const lzo_byte *in, lzo_uint in_len, lzo_byte *out, lzo_uint *out_len, lzo_voidp)
Definition lzo1x_d.cpp:82
#define lzo_voidp
Definition lzoconf.h:128
#define lzo_byte
Definition lzoconf.h:127
unsigned int lzo_uint
Definition lzoconf.h:99