Browse code

update lzma licence

aCaB authored on 2009/08/06 06:35:58
Showing 2 changed files
... ...
@@ -1,72 +1,7 @@
1
-Original unmodified files from the LZMA SDK are included under libclamav/lzma.
2 1
 The original lzma.txt license file, a small portion of which is reproduced below,
3
-is available under libclamav/lzma/lzma.txt. 
2
+is available under libclamav/7z/lzma.txt.
4 3
 
5 4
 LICENSE
6 5
 -------
7 6
 
8
-LZMA SDK is available under any of the following licenses:
9
-
10
-1) GNU Lesser General Public License (GNU LGPL)
11
-2) Common Public License (CPL)
12
-3) Simplified license for unmodified code (read SPECIAL EXCEPTION) 
13
-4) Proprietary license 
14
-
15
-It means that you can select one of these four options and follow rules of that license.
16
-
17
-
18
-1,2) GNU LGPL and CPL licenses are pretty similar and both these
19
-licenses are classified as 
20
- - "Free software licenses" at http://www.gnu.org/ 
21
- - "OSI-approved" at http://www.opensource.org/
22
-
23
-
24
-3) SPECIAL EXCEPTION
25
-
26
-Igor Pavlov, as the author of this code, expressly permits you 
27
-to statically or dynamically link your code (or bind by name) 
28
-to the files from LZMA SDK without subjecting your linked 
29
-code to the terms of the CPL or GNU LGPL. 
30
-Any modifications or additions to files from LZMA SDK, however, 
31
-are subject to the GNU LGPL or CPL terms.
32
-
33
-SPECIAL EXCEPTION allows you to use LZMA SDK in applications with closed code, 
34
-while you keep LZMA SDK code unmodified.
35
-
36
-
37
-SPECIAL EXCEPTION #2: Igor Pavlov, as the author of this code, expressly permits 
38
-you to use this code under the same terms and conditions contained in the License 
39
-Agreement you have for any previous version of LZMA SDK developed by Igor Pavlov.
40
-
41
-SPECIAL EXCEPTION #2 allows owners of proprietary licenses to use latest version 
42
-of LZMA SDK as update for previous versions.
43
-
44
-
45
-SPECIAL EXCEPTION #3: Igor Pavlov, as the author of this code, expressly permits 
46
-you to use code of the following files: 
47
-BranchTypes.h, LzmaTypes.h, LzmaTest.c, LzmaStateTest.c, LzmaAlone.cpp, 
48
-LzmaAlone.cs, LzmaAlone.java
49
-as public domain code. 
50
-
51
-
52
-4) Proprietary license
53
-
54
-LZMA SDK also can be available under a proprietary license which 
55
-can include:
56
-
57
-1) Right to modify code without subjecting modified code to the 
58
-terms of the CPL or GNU LGPL
59
-2) Technical support for code
60
-
61
-To request such proprietary license or any additional consultations,
62
-send email message from that page:
63
-http://www.7-zip.org/support.html
64
-
65
-
66
-You should have received a copy of the GNU Lesser General Public
67
-License along with this library; if not, write to the Free Software
68
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
69
-
70
-You should have received a copy of the Common Public License
71
-along with this library.
72
-
7
+LZMA SDK is written and placed in the public domain by Igor Pavlov.
73 8
new file mode 100644
... ...
@@ -0,0 +1,594 @@
0
+LZMA SDK 4.65
1
+-------------
2
+
3
+LZMA SDK provides the documentation, samples, header files, libraries, 
4
+and tools you need to develop applications that use LZMA compression.
5
+
6
+LZMA is default and general compression method of 7z format
7
+in 7-Zip compression program (www.7-zip.org). LZMA provides high 
8
+compression ratio and very fast decompression.
9
+
10
+LZMA is an improved version of famous LZ77 compression algorithm. 
11
+It was improved in way of maximum increasing of compression ratio,
12
+keeping high decompression speed and low memory requirements for 
13
+decompressing.
14
+
15
+
16
+
17
+LICENSE
18
+-------
19
+
20
+LZMA SDK is written and placed in the public domain by Igor Pavlov.
21
+
22
+
23
+LZMA SDK Contents
24
+-----------------
25
+
26
+LZMA SDK includes:
27
+
28
+  - ANSI-C/C++/C#/Java source code for LZMA compressing and decompressing
29
+  - Compiled file->file LZMA compressing/decompressing program for Windows system
30
+
31
+
32
+UNIX/Linux version 
33
+------------------
34
+To compile C++ version of file->file LZMA encoding, go to directory
35
+C++/7zip/Compress/LZMA_Alone 
36
+and call make to recompile it:
37
+  make -f makefile.gcc clean all
38
+
39
+In some UNIX/Linux versions you must compile LZMA with static libraries.
40
+To compile with static libraries, you can use 
41
+LIB = -lm -static
42
+
43
+
44
+Files
45
+---------------------
46
+lzma.txt     - LZMA SDK description (this file)
47
+7zFormat.txt - 7z Format description
48
+7zC.txt      - 7z ANSI-C Decoder description
49
+methods.txt  - Compression method IDs for .7z
50
+lzma.exe     - Compiled file->file LZMA encoder/decoder for Windows
51
+history.txt  - history of the LZMA SDK
52
+
53
+
54
+Source code structure
55
+---------------------
56
+
57
+C/  - C files
58
+        7zCrc*.*   - CRC code
59
+        Alloc.*    - Memory allocation functions
60
+        Bra*.*     - Filters for x86, IA-64, ARM, ARM-Thumb, PowerPC and SPARC code
61
+        LzFind.*   - Match finder for LZ (LZMA) encoders 
62
+        LzFindMt.* - Match finder for LZ (LZMA) encoders for multithreading encoding
63
+        LzHash.h   - Additional file for LZ match finder
64
+        LzmaDec.*  - LZMA decoding
65
+        LzmaEnc.*  - LZMA encoding
66
+        LzmaLib.*  - LZMA Library for DLL calling
67
+        Types.h    - Basic types for another .c files
68
+	Threads.*  - The code for multithreading.
69
+
70
+    LzmaLib  - LZMA Library (.DLL for Windows)
71
+    
72
+    LzmaUtil - LZMA Utility (file->file LZMA encoder/decoder).
73
+
74
+    Archive - files related to archiving
75
+      7z     - 7z ANSI-C Decoder
76
+
77
+CPP/ -- CPP files
78
+
79
+  Common  - common files for C++ projects
80
+  Windows - common files for Windows related code
81
+
82
+  7zip    - files related to 7-Zip Project
83
+
84
+    Common   - common files for 7-Zip
85
+
86
+    Compress - files related to compression/decompression
87
+
88
+      Copy         - Copy coder
89
+      RangeCoder   - Range Coder (special code of compression/decompression)
90
+      LZMA         - LZMA compression/decompression on C++
91
+      LZMA_Alone   - file->file LZMA compression/decompression
92
+      Branch       - Filters for x86, IA-64, ARM, ARM-Thumb, PowerPC and SPARC code
93
+
94
+    Archive - files related to archiving
95
+
96
+      Common   - common files for archive handling
97
+      7z       - 7z C++ Encoder/Decoder
98
+
99
+    Bundles    - Modules that are bundles of other modules
100
+  
101
+      Alone7z           - 7zr.exe: Standalone version of 7z.exe that supports only 7z/LZMA/BCJ/BCJ2
102
+      Format7zR         - 7zr.dll: Reduced version of 7za.dll: extracting/compressing to 7z/LZMA/BCJ/BCJ2
103
+      Format7zExtractR  - 7zxr.dll: Reduced version of 7zxa.dll: extracting from 7z/LZMA/BCJ/BCJ2.
104
+
105
+    UI        - User Interface files
106
+         
107
+      Client7z - Test application for 7za.dll,  7zr.dll, 7zxr.dll
108
+      Common   - Common UI files
109
+      Console  - Code for console archiver
110
+
111
+
112
+
113
+CS/ - C# files
114
+  7zip
115
+    Common   - some common files for 7-Zip
116
+    Compress - files related to compression/decompression
117
+      LZ     - files related to LZ (Lempel-Ziv) compression algorithm
118
+      LZMA         - LZMA compression/decompression
119
+      LzmaAlone    - file->file LZMA compression/decompression
120
+      RangeCoder   - Range Coder (special code of compression/decompression)
121
+
122
+Java/  - Java files
123
+  SevenZip
124
+    Compression    - files related to compression/decompression
125
+      LZ           - files related to LZ (Lempel-Ziv) compression algorithm
126
+      LZMA         - LZMA compression/decompression
127
+      RangeCoder   - Range Coder (special code of compression/decompression)
128
+
129
+
130
+C/C++ source code of LZMA SDK is part of 7-Zip project.
131
+7-Zip source code can be downloaded from 7-Zip's SourceForge page:
132
+
133
+  http://sourceforge.net/projects/sevenzip/
134
+
135
+
136
+
137
+LZMA features
138
+-------------
139
+  - Variable dictionary size (up to 1 GB)
140
+  - Estimated compressing speed: about 2 MB/s on 2 GHz CPU
141
+  - Estimated decompressing speed: 
142
+      - 20-30 MB/s on 2 GHz Core 2 or AMD Athlon 64
143
+      - 1-2 MB/s on 200 MHz ARM, MIPS, PowerPC or other simple RISC
144
+  - Small memory requirements for decompressing (16 KB + DictionarySize)
145
+  - Small code size for decompressing: 5-8 KB
146
+
147
+LZMA decoder uses only integer operations and can be 
148
+implemented in any modern 32-bit CPU (or on 16-bit CPU with some conditions).
149
+
150
+Some critical operations that affect the speed of LZMA decompression:
151
+  1) 32*16 bit integer multiply
152
+  2) Misspredicted branches (penalty mostly depends from pipeline length)
153
+  3) 32-bit shift and arithmetic operations
154
+
155
+The speed of LZMA decompressing mostly depends from CPU speed.
156
+Memory speed has no big meaning. But if your CPU has small data cache, 
157
+overall weight of memory speed will slightly increase.
158
+
159
+
160
+How To Use
161
+----------
162
+
163
+Using LZMA encoder/decoder executable
164
+--------------------------------------
165
+
166
+Usage:  LZMA <e|d> inputFile outputFile [<switches>...]
167
+
168
+  e: encode file
169
+
170
+  d: decode file
171
+
172
+  b: Benchmark. There are two tests: compressing and decompressing 
173
+     with LZMA method. Benchmark shows rating in MIPS (million 
174
+     instructions per second). Rating value is calculated from 
175
+     measured speed and it is normalized with Intel's Core 2 results.
176
+     Also Benchmark checks possible hardware errors (RAM 
177
+     errors in most cases). Benchmark uses these settings:
178
+     (-a1, -d21, -fb32, -mfbt4). You can change only -d parameter. 
179
+     Also you can change the number of iterations. Example for 30 iterations:
180
+       LZMA b 30
181
+     Default number of iterations is 10.
182
+
183
+<Switches>
184
+  
185
+
186
+  -a{N}:  set compression mode 0 = fast, 1 = normal
187
+          default: 1 (normal)
188
+
189
+  d{N}:   Sets Dictionary size - [0, 30], default: 23 (8MB)
190
+          The maximum value for dictionary size is 1 GB = 2^30 bytes.
191
+          Dictionary size is calculated as DictionarySize = 2^N bytes. 
192
+          For decompressing file compressed by LZMA method with dictionary 
193
+          size D = 2^N you need about D bytes of memory (RAM).
194
+
195
+  -fb{N}: set number of fast bytes - [5, 273], default: 128
196
+          Usually big number gives a little bit better compression ratio 
197
+          and slower compression process.
198
+
199
+  -lc{N}: set number of literal context bits - [0, 8], default: 3
200
+          Sometimes lc=4 gives gain for big files.
201
+
202
+  -lp{N}: set number of literal pos bits - [0, 4], default: 0
203
+          lp switch is intended for periodical data when period is 
204
+          equal 2^N. For example, for 32-bit (4 bytes) 
205
+          periodical data you can use lp=2. Often it's better to set lc0, 
206
+          if you change lp switch.
207
+
208
+  -pb{N}: set number of pos bits - [0, 4], default: 2
209
+          pb switch is intended for periodical data 
210
+          when period is equal 2^N.
211
+
212
+  -mf{MF_ID}: set Match Finder. Default: bt4. 
213
+              Algorithms from hc* group doesn't provide good compression 
214
+              ratio, but they often works pretty fast in combination with 
215
+              fast mode (-a0).
216
+
217
+              Memory requirements depend from dictionary size 
218
+              (parameter "d" in table below). 
219
+
220
+               MF_ID     Memory                   Description
221
+
222
+                bt2    d *  9.5 + 4MB  Binary Tree with 2 bytes hashing.
223
+                bt3    d * 11.5 + 4MB  Binary Tree with 3 bytes hashing.
224
+                bt4    d * 11.5 + 4MB  Binary Tree with 4 bytes hashing.
225
+                hc4    d *  7.5 + 4MB  Hash Chain with 4 bytes hashing.
226
+
227
+  -eos:   write End Of Stream marker. By default LZMA doesn't write 
228
+          eos marker, since LZMA decoder knows uncompressed size 
229
+          stored in .lzma file header.
230
+
231
+  -si:    Read data from stdin (it will write End Of Stream marker).
232
+  -so:    Write data to stdout
233
+
234
+
235
+Examples:
236
+
237
+1) LZMA e file.bin file.lzma -d16 -lc0 
238
+
239
+compresses file.bin to file.lzma with 64 KB dictionary (2^16=64K)  
240
+and 0 literal context bits. -lc0 allows to reduce memory requirements 
241
+for decompression.
242
+
243
+
244
+2) LZMA e file.bin file.lzma -lc0 -lp2
245
+
246
+compresses file.bin to file.lzma with settings suitable 
247
+for 32-bit periodical data (for example, ARM or MIPS code).
248
+
249
+3) LZMA d file.lzma file.bin
250
+
251
+decompresses file.lzma to file.bin.
252
+
253
+
254
+Compression ratio hints
255
+-----------------------
256
+
257
+Recommendations
258
+---------------
259
+
260
+To increase the compression ratio for LZMA compressing it's desirable 
261
+to have aligned data (if it's possible) and also it's desirable to locate
262
+data in such order, where code is grouped in one place and data is 
263
+grouped in other place (it's better than such mixing: code, data, code,
264
+data, ...).
265
+
266
+
267
+Filters
268
+-------
269
+You can increase the compression ratio for some data types, using
270
+special filters before compressing. For example, it's possible to 
271
+increase the compression ratio on 5-10% for code for those CPU ISAs: 
272
+x86, IA-64, ARM, ARM-Thumb, PowerPC, SPARC.
273
+
274
+You can find C source code of such filters in C/Bra*.* files
275
+
276
+You can check the compression ratio gain of these filters with such 
277
+7-Zip commands (example for ARM code):
278
+No filter:
279
+  7z a a1.7z a.bin -m0=lzma
280
+
281
+With filter for little-endian ARM code:
282
+  7z a a2.7z a.bin -m0=arm -m1=lzma        
283
+
284
+It works in such manner:
285
+Compressing    = Filter_encoding + LZMA_encoding
286
+Decompressing  = LZMA_decoding + Filter_decoding
287
+
288
+Compressing and decompressing speed of such filters is very high,
289
+so it will not increase decompressing time too much.
290
+Moreover, it reduces decompression time for LZMA_decoding, 
291
+since compression ratio with filtering is higher.
292
+
293
+These filters convert CALL (calling procedure) instructions 
294
+from relative offsets to absolute addresses, so such data becomes more 
295
+compressible.
296
+
297
+For some ISAs (for example, for MIPS) it's impossible to get gain from such filter.
298
+
299
+
300
+LZMA compressed file format
301
+---------------------------
302
+Offset Size Description
303
+  0     1   Special LZMA properties (lc,lp, pb in encoded form)
304
+  1     4   Dictionary size (little endian)
305
+  5     8   Uncompressed size (little endian). -1 means unknown size
306
+ 13         Compressed data
307
+
308
+
309
+ANSI-C LZMA Decoder
310
+~~~~~~~~~~~~~~~~~~~
311
+
312
+Please note that interfaces for ANSI-C code were changed in LZMA SDK 4.58.
313
+If you want to use old interfaces you can download previous version of LZMA SDK
314
+from sourceforge.net site.
315
+
316
+To use ANSI-C LZMA Decoder you need the following files:
317
+1) LzmaDec.h + LzmaDec.c + Types.h
318
+LzmaUtil/LzmaUtil.c is example application that uses these files.
319
+
320
+
321
+Memory requirements for LZMA decoding
322
+-------------------------------------
323
+
324
+Stack usage of LZMA decoding function for local variables is not 
325
+larger than 200-400 bytes.
326
+
327
+LZMA Decoder uses dictionary buffer and internal state structure.
328
+Internal state structure consumes
329
+  state_size = (4 + (1.5 << (lc + lp))) KB
330
+by default (lc=3, lp=0), state_size = 16 KB.
331
+
332
+
333
+How To decompress data
334
+----------------------
335
+
336
+LZMA Decoder (ANSI-C version) now supports 2 interfaces:
337
+1) Single-call Decompressing
338
+2) Multi-call State Decompressing (zlib-like interface)
339
+
340
+You must use external allocator:
341
+Example:
342
+void *SzAlloc(void *p, size_t size) { p = p; return malloc(size); }
343
+void SzFree(void *p, void *address) { p = p; free(address); }
344
+ISzAlloc alloc = { SzAlloc, SzFree };
345
+
346
+You can use p = p; operator to disable compiler warnings.
347
+
348
+
349
+Single-call Decompressing
350
+-------------------------
351
+When to use: RAM->RAM decompressing
352
+Compile files: LzmaDec.h + LzmaDec.c + Types.h
353
+Compile defines: no defines
354
+Memory Requirements:
355
+  - Input buffer: compressed size
356
+  - Output buffer: uncompressed size
357
+  - LZMA Internal Structures: state_size (16 KB for default settings) 
358
+
359
+Interface:
360
+  int LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen,
361
+      const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode, 
362
+      ELzmaStatus *status, ISzAlloc *alloc);
363
+  In: 
364
+    dest     - output data
365
+    destLen  - output data size
366
+    src      - input data
367
+    srcLen   - input data size
368
+    propData - LZMA properties  (5 bytes)
369
+    propSize - size of propData buffer (5 bytes)
370
+    finishMode - It has meaning only if the decoding reaches output limit (*destLen).
371
+	 LZMA_FINISH_ANY - Decode just destLen bytes.
372
+	 LZMA_FINISH_END - Stream must be finished after (*destLen).
373
+                           You can use LZMA_FINISH_END, when you know that 
374
+                           current output buffer covers last bytes of stream. 
375
+    alloc    - Memory allocator.
376
+
377
+  Out: 
378
+    destLen  - processed output size 
379
+    srcLen   - processed input size 
380
+
381
+  Output:
382
+    SZ_OK
383
+      status:
384
+        LZMA_STATUS_FINISHED_WITH_MARK
385
+        LZMA_STATUS_NOT_FINISHED 
386
+        LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK
387
+    SZ_ERROR_DATA - Data error
388
+    SZ_ERROR_MEM  - Memory allocation error
389
+    SZ_ERROR_UNSUPPORTED - Unsupported properties
390
+    SZ_ERROR_INPUT_EOF - It needs more bytes in input buffer (src).
391
+
392
+  If LZMA decoder sees end_marker before reaching output limit, it returns OK result,
393
+  and output value of destLen will be less than output buffer size limit.
394
+
395
+  You can use multiple checks to test data integrity after full decompression:
396
+    1) Check Result and "status" variable.
397
+    2) Check that output(destLen) = uncompressedSize, if you know real uncompressedSize.
398
+    3) Check that output(srcLen) = compressedSize, if you know real compressedSize. 
399
+       You must use correct finish mode in that case. */ 
400
+
401
+
402
+Multi-call State Decompressing (zlib-like interface)
403
+----------------------------------------------------
404
+
405
+When to use: file->file decompressing 
406
+Compile files: LzmaDec.h + LzmaDec.c + Types.h
407
+
408
+Memory Requirements:
409
+ - Buffer for input stream: any size (for example, 16 KB)
410
+ - Buffer for output stream: any size (for example, 16 KB)
411
+ - LZMA Internal Structures: state_size (16 KB for default settings) 
412
+ - LZMA dictionary (dictionary size is encoded in LZMA properties header)
413
+
414
+1) read LZMA properties (5 bytes) and uncompressed size (8 bytes, little-endian) to header:
415
+   unsigned char header[LZMA_PROPS_SIZE + 8];
416
+   ReadFile(inFile, header, sizeof(header)
417
+
418
+2) Allocate CLzmaDec structures (state + dictionary) using LZMA properties
419
+
420
+  CLzmaDec state;
421
+  LzmaDec_Constr(&state);
422
+  res = LzmaDec_Allocate(&state, header, LZMA_PROPS_SIZE, &g_Alloc);
423
+  if (res != SZ_OK)
424
+    return res;
425
+
426
+3) Init LzmaDec structure before any new LZMA stream. And call LzmaDec_DecodeToBuf in loop
427
+
428
+  LzmaDec_Init(&state);
429
+  for (;;)
430
+  {
431
+    ... 
432
+    int res = LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen, 
433
+    	const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode);
434
+    ...
435
+  }
436
+
437
+
438
+4) Free all allocated structures
439
+  LzmaDec_Free(&state, &g_Alloc);
440
+
441
+For full code example, look at C/LzmaUtil/LzmaUtil.c code.
442
+
443
+
444
+How To compress data
445
+--------------------
446
+
447
+Compile files: LzmaEnc.h + LzmaEnc.c + Types.h +
448
+LzFind.c + LzFind.h + LzFindMt.c + LzFindMt.h + LzHash.h
449
+
450
+Memory Requirements:
451
+  - (dictSize * 11.5 + 6 MB) + state_size
452
+
453
+Lzma Encoder can use two memory allocators:
454
+1) alloc - for small arrays.
455
+2) allocBig - for big arrays.
456
+
457
+For example, you can use Large RAM Pages (2 MB) in allocBig allocator for 
458
+better compression speed. Note that Windows has bad implementation for 
459
+Large RAM Pages. 
460
+It's OK to use same allocator for alloc and allocBig.
461
+
462
+
463
+Single-call Compression with callbacks
464
+--------------------------------------
465
+
466
+Check C/LzmaUtil/LzmaUtil.c as example, 
467
+
468
+When to use: file->file decompressing 
469
+
470
+1) you must implement callback structures for interfaces:
471
+ISeqInStream
472
+ISeqOutStream
473
+ICompressProgress
474
+ISzAlloc
475
+
476
+static void *SzAlloc(void *p, size_t size) { p = p; return MyAlloc(size); }
477
+static void SzFree(void *p, void *address) {  p = p; MyFree(address); }
478
+static ISzAlloc g_Alloc = { SzAlloc, SzFree };
479
+
480
+  CFileSeqInStream inStream;
481
+  CFileSeqOutStream outStream;
482
+
483
+  inStream.funcTable.Read = MyRead;
484
+  inStream.file = inFile;
485
+  outStream.funcTable.Write = MyWrite;
486
+  outStream.file = outFile;
487
+
488
+
489
+2) Create CLzmaEncHandle object;
490
+
491
+  CLzmaEncHandle enc;
492
+
493
+  enc = LzmaEnc_Create(&g_Alloc);
494
+  if (enc == 0)
495
+    return SZ_ERROR_MEM;
496
+
497
+
498
+3) initialize CLzmaEncProps properties;
499
+
500
+  LzmaEncProps_Init(&props);
501
+
502
+  Then you can change some properties in that structure.
503
+
504
+4) Send LZMA properties to LZMA Encoder
505
+
506
+  res = LzmaEnc_SetProps(enc, &props);
507
+
508
+5) Write encoded properties to header
509
+
510
+    Byte header[LZMA_PROPS_SIZE + 8];
511
+    size_t headerSize = LZMA_PROPS_SIZE;
512
+    UInt64 fileSize;
513
+    int i;
514
+
515
+    res = LzmaEnc_WriteProperties(enc, header, &headerSize);
516
+    fileSize = MyGetFileLength(inFile);
517
+    for (i = 0; i < 8; i++)
518
+      header[headerSize++] = (Byte)(fileSize >> (8 * i));
519
+    MyWriteFileAndCheck(outFile, header, headerSize)
520
+
521
+6) Call encoding function:
522
+      res = LzmaEnc_Encode(enc, &outStream.funcTable, &inStream.funcTable, 
523
+        NULL, &g_Alloc, &g_Alloc);
524
+
525
+7) Destroy LZMA Encoder Object
526
+  LzmaEnc_Destroy(enc, &g_Alloc, &g_Alloc);
527
+
528
+
529
+If callback function return some error code, LzmaEnc_Encode also returns that code.
530
+
531
+
532
+Single-call RAM->RAM Compression
533
+--------------------------------
534
+
535
+Single-call RAM->RAM Compression is similar to Compression with callbacks,
536
+but you provide pointers to buffers instead of pointers to stream callbacks:
537
+
538
+HRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
539
+    CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark, 
540
+    ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);
541
+
542
+Return code:
543
+  SZ_OK               - OK
544
+  SZ_ERROR_MEM        - Memory allocation error 
545
+  SZ_ERROR_PARAM      - Incorrect paramater
546
+  SZ_ERROR_OUTPUT_EOF - output buffer overflow
547
+  SZ_ERROR_THREAD     - errors in multithreading functions (only for Mt version)
548
+
549
+
550
+
551
+LZMA Defines
552
+------------
553
+
554
+_LZMA_SIZE_OPT - Enable some optimizations in LZMA Decoder to get smaller executable code.
555
+
556
+_LZMA_PROB32   - It can increase the speed on some 32-bit CPUs, but memory usage for 
557
+                 some structures will be doubled in that case.
558
+
559
+_LZMA_UINT32_IS_ULONG  - Define it if int is 16-bit on your compiler and long is 32-bit.
560
+
561
+_LZMA_NO_SYSTEM_SIZE_T  - Define it if you don't want to use size_t type.
562
+
563
+
564
+C++ LZMA Encoder/Decoder 
565
+~~~~~~~~~~~~~~~~~~~~~~~~
566
+C++ LZMA code use COM-like interfaces. So if you want to use it, 
567
+you can study basics of COM/OLE.
568
+C++ LZMA code is just wrapper over ANSI-C code.
569
+
570
+
571
+C++ Notes
572
+~~~~~~~~~~~~~~~~~~~~~~~~
573
+If you use some C++ code folders in 7-Zip (for example, C++ code for .7z handling),
574
+you must check that you correctly work with "new" operator.
575
+7-Zip can be compiled with MSVC 6.0 that doesn't throw "exception" from "new" operator.
576
+So 7-Zip uses "CPP\Common\NewHandler.cpp" that redefines "new" operator:
577
+operator new(size_t size)
578
+{
579
+  void *p = ::malloc(size);
580
+  if (p == 0)
581
+    throw CNewException();
582
+  return p;
583
+}
584
+If you use MSCV that throws exception for "new" operator, you can compile without 
585
+"NewHandler.cpp". So standard exception will be used. Actually some code of 
586
+7-Zip catches any exception in internal code and converts it to HRESULT code.
587
+So you don't need to catch CNewException, if you call COM interfaces of 7-Zip.
588
+
589
+---
590
+
591
+http://www.7-zip.org
592
+http://www.7-zip.org/sdk.html
593
+http://www.7-zip.org/support.html