- Notifications
You must be signed in to change notification settings - Fork27
PLzmaSDK is (Portable, Patched, Package, cross-P-latform) Lzma SDK.
License
OlehKulykov/PLzmaSDK
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
PLzmaSDK is (Portable,Patched,Package, cross-P-latform) Lzma SDK.Based on originalLZMA SDK version 24.09 and patched for unix platforms.Available for all Apple's platforms(iOS, macOS, tvOS, watchOS), Android, Windows, Linux and any unix'es.
- The SDK is available for the next programming languages:
- Swift viaSwift Package Manager orCocoaPods.
- Objective-C viaCocoaPods.
- JavaScript vianpm.
- Pure C++ viagit +CMake or copy 2 main lib headers(libplzma.h andlibplzma.hpp files) andsrc folder to your project.
- Pure C, also viagit +CMake or copy 2 main lib headers(libplzma.h andlibplzma.hpp files) andsrc folder to your project. But this internal C bindings code might be disabled viaCMake's boolean option
LIBPLZMA_OPT_NO_C_BINDINGS:BOOL=YES
or preprocessor definitionLIBPLZMA_NO_C_BINDINGS=1
, see below.
- Supports next archives:
- Supports list, test, extract and compress operations. All these operations can be executed in a separate thread and aborted during the process.
- Supports7z multivolume archives.
- Thread safe encoder, decoder and progress tracking. Depending of usage, you can disable all thread synchronizations viaCMake's boolean option
LIBPLZMA_OPT_THREAD_UNSAFE:BOOL=YES
or preprocessor definitionLIBPLZMA_THREAD_UNSAFE=1
. - Supports memory and file IO streams. The extracting and compressing might be from ⇔ to memory or file.
- Support extracting and compressing archive files with size more than 4GB(x64 support).
- Track smoothed progress.
- Full UTF8 support.
- Available for any platform with compiller which supports theC++11 standard. Let's say, almost everywhere nowadays.
- No external dependencies. Also noSTL (of couse not in a public interface and internally).
- The SDK is organized as Cand C++ library at the same time. And supports static and dynamic linking.
- Thelibplzma.h - the library header for a pure C environment. Contains generic functions, types and optional bindings to the whole functionality of the library. Currently uses withSwift Package Manager andCocoaPods.
- Thelibplzma.hpp - the library header for a pure C++ environment and must be used together withlibplzma.h header. Currently uses withnpm native module andObjective-C.
- Theswift directory containsSwift part of the SDK and available viaSwift Package Manager andCocoaPods, see
Installation
section. - Theobjc directory containsObjective-C part of the SDK and available viaCocoaPods, see
Installation
section. - Thenode directory contains Node.js native, inline module implementation.
All optional features are enabled by default, but they might be disabled during the build process to reduce the binary size, and of course, if you are not planning to use them.
- tar/tarball archive support. To disable, use theCMake's boolean option
LIBPLZMA_OPT_NO_TAR:BOOL=YES
or preprocessor definitionLIBPLZMA_NO_TAR=1
- Thread safety. To disable, use theCMake's boolean option
LIBPLZMA_OPT_THREAD_UNSAFE:BOOL=YES
or preprocessor definitionLIBPLZMA_THREAD_UNSAFE=1
- Progress tracking. To disable, use theCMake's boolean option
LIBPLZMA_OPT_NO_PROGRESS:BOOL=YES
or preprocessor definitionLIBPLZMA_NO_PROGRESS=1
- C bindings to the whole functionality of the library inlibplzma.h header. To disable, use theCMake's boolean option
LIBPLZMA_OPT_NO_C_BINDINGS:BOOL=YES
or preprocessor definitionLIBPLZMA_NO_C_BINDINGS=1
- Crypto functionality. Not recommended! But possible. Do this only if you know what are you doing! To disable, use theCMake's boolean option
LIBPLZMA_OPT_NO_CRYPTO:BOOL=YES
or preprocessor definitionLIBPLZMA_NO_CRYPTO=1
.package(url:"https://github.com/OlehKulykov/PLzmaSDK.git",.exact("1.5.0"))
use_frameworks!platform:ios,'11.0'target'<REPLACE_WITH_YOUR_TARGET>'dopod'PLzmaSDK','1.5.0'end
use_frameworks!platform:ios,'9.0'target'<REPLACE_WITH_YOUR_TARGET>'dopod'PLzmaSDK-ObjC','1.5.0'end
{"engines": {"node":">=13.0.0","npm":">=6.0.0" },"dependencies": {"plzmasdk":"1.5.0" }}
cd<PATH_TO_ANDROID_NDK>./ndk-build NDK_PROJECT_PATH=<PATH_TO_PLZMASDK>/PLzmaSDK/android
cd PLzmaSDKmkdir buildcd buildcmake -DCMAKE_BUILD_TYPE=Release ..make -j4
cd PLzmaSDKmd buildcd buildcmake -DCMAKE_BUILD_TYPE=Release ..cmake --build. --config Release --parallel 4
...cmake -G"MinGW Makefiles" -DCMAKE_MAKE_PROGRAM=mingw32-make -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILER=gcc -DCMAKE_BUILD_TYPE=Release ..cmake --build. --config Release --parallel 4
The process consists of four steps:
- Create a source input stream for reading archive file content. The input stream might be created with:
- The path to the archive file.
- The archive file content in memory, i.e. using const memory or it's copy for internal usage.
- The custom read/seek callbacks(C/C++ only).
- Create decoder with source input stream, type of the archive and optional progress delegate.
- Optionaly provide the password to open and list encrypted archive and for a future extracting or testing.
- Select archive items for extracting or testing. Migth be skiped if you want to process all items(the whole archive), see below.
- Select all archive items as is.
- Retrieve the number of items, iterate them by index, filter and/or select.
- Extract or test selected archive items. The extract process might be:
- Extract all items to a directory. In this case, you can skip the step #3.
- Extract selected items to a directory.
- Extract each item to a custom out-stream. The out-stream might be a file or memory. I.e. extract 'item #1' to a file stream, extract 'item #2' to a memory stream(then take extacted memory) and so on.
do{ // 1. Create a source input stream for reading archive file content. // 1.1. Create a source input stream with the path to an archive file.letarchivePath=tryPath("path/to/archive.7z")letarchivePathInStream=tryInStream(path: archivePath) // 1.2. Create a source input stream with the file content.letarchiveData=Data(...)letarchiveDataInStream=tryInStream(dataNoCopy: archiveData) // also available Data(dataCopy: Data) // 2. Create decoder with source input stream, type of archive and optional delegate.letdecoder=tryDecoder(stream: archiveDataInStream /* archivePathInStream */, fileType:.sevenZ, delegate:self) // 2.1. Optionaly provide the password to open/list/test/extract encrypted archive items.try decoder.setPassword("1234")letopened=try decoder.open() // 3. Select archive items for extracting or testing. // 3.1. Select all archive items.letallArchiveItems=try decoder.items() // 3.2. Get the number of items, iterate items by index, filter and select items.letnumberOfArchiveItems=try decoder.count()letselectedItemsDuringIteration=tryItemArray(capacity: numberOfArchiveItems)letselectedItemsToStreams=tryItemOutStreamArray()foritemIndexin0..<numberOfArchiveItems{letitem=try decoder.item(at: itemIndex)try selectedItemsDuringIteration.add(item: item)try selectedItemsToStreams.add(item: item, stream:OutStream()) // to memory stream} // 4. Extract or test selected archive items. The extract process might be: // 4.1. Extract all items to a directory. In this case, you can skip the step #3.letextracted=try decoder.extract(to:Path("path/outdir")) // 4.2. Extract selected items to a directory.letextracted=try decoder.extract(items: selectedItemsDuringIteration, to:Path("path/outdir")) // 4.3. Extract each item to a custom out-stream. // The out-stream might be a file or memory. I.e. extract 'item #1' to a file stream, extract 'item #2' to a memory stream(then take extacted memory) and so on.letextracted=try decoder.extract(itemsToStreams: selectedItemsToStreams)}catchlet exception asException{print("Exception:\(exception)")}
constplzma=require('plzmasdk');try{// 1. Create a source input stream for reading archive file content.// 1.1. Create a source input stream with the path to an archive file.constarchivePath=plzma.Path(__dirname).append('path/to/archive.7z');constarchivePathInStream=newplzma.InStream(archivePath/* 'path/to/archive.7z' */);// 1.2. Create a source input stream with the file content.constarchiveData=newArrayBuffer(...);constarchiveDataInStream=newplzma.InStream(archiveData);// 2. Create decoder with source input stream, type of archive and optional delegate.constdecoder=newplzma.Decoder(archivePathInStream,plzma.FileType.sevenZ);decoder.setProgressDelegate((path,progress)=>console.log(`Delegating progress, path:${path}, progress:${progress}`));// 2.1. Optionaly provide the password to open/list/test/extract encrypted archive items.decoder.setPassword('1234');constopened=awaitdecoder.openAsync();// also available sync. version 'decoder.open()'// 3. Select archive items for extracting or testing.// 3.1. Select all archive items.constallArchiveItems=decoder.items;// 3.2. Get the number of items, iterate items by index, filter and select items.constselectedItemsDuringIteration=[];constselectedItemsToStreams=newMap();for(letitemIndex=0,numberOfArchiveItems=decoder.count;itemIndex<numberOfArchiveItems;itemIndex++){constitem=decoder.itemAt(itemIndex);selectedItemsDuringIteration.push(item);selectedItemsToStreams.set(item,plzma.OutStream());// to memory stream}// 4. Extract or test selected archive items. The extract process might be:// 4.1. Extract all items to a directory. In this case, you can skip the step #3.constextracted=awaitdecoder.extractAsync('path/outdir');// also available sync. version 'decoder.extract()'// 4.2. Extract selected items to a directory.constextracted=awaitdecoder.extractAsync(selectedItemsDuringIteration,'path/outdir');// also available sync. version 'decoder.extract()'// 4.3. Extract each item to a custom out-stream.// The out-stream might be a file or memory. I.e. extract 'item #1' to a file stream, extract 'item #2' to a memory stream(then take extacted memory) and so on.constextracted=awaitdecoder.extractAsync(selectedItemsToStreams);// also available sync. version 'decoder.extract()'}catch(error){console.log(`Exception:${error}`);}
try {// 1. Create a source input stream for reading archive file content.// 1.1. Create a source input stream with the path to an archive file. PatharchivePath("path/to/archive.7z");// Path(L"C:\\\\path\\to\\archive.7z");auto archivePathInStream =makeSharedInStream(archivePath/* std::move(archivePath)*/);// 1.2. Create a source input stream with the file content.auto archiveDataInStream =makeSharedInStream(<FILE DATA>, <FILE SIZE>);// 2. Create decoder with source input stream, type of archive and provide optional delegate.auto decoder =makeSharedDecoder(archiveDataInStream, plzma_file_type_7z); decoder->setProgressDelegate(this);// 2.1. Optionaly provide the password to open/list/test/extract encrypted archive items. decoder->setPassword("1234");// decoder->setPassword(L"1234");bool opened = decoder->open();// 3. Select archive items for extracting or testing.// 3.1. Select all archive items.auto allArchiveItems = decoder->items();// 3.2. Get the number of items, iterate items by index, filter and select items.size_t numberOfArchiveItems = decoder->count();auto selectedItemsDuringIteration = makeShared<ItemArray>(numberOfArchiveItems);auto selectedItemsToStreams = makeShared<ItemOutStreamArray>();for (size_t itemIndex =0; itemIndex < numberOfArchiveItems; itemIndex++) {auto item = decoder->itemAt(itemIndex); selectedItemsDuringIteration->push(item/* std::move(item)*/); selectedItemsToStreams->push(Pair<SharedPtr<Item>, SharedPtr<OutStream> >(item,makeSharedOutStream()));// to memory stream }// 4. Extract or test selected archive items. The extract process might be:// 4.1. Extract all items to a directory. In this case, you can skip the step #3.bool extracted = decoder->extract(Path("path/outdir"));// 4.2. Extract selected items to a directory.bool extracted = decoder->extract(selectedItemsDuringIteration,Path("path/outdir"));// 4.3. Extract each item to a custom out-stream.// The out-stream might be a file or memory. I.e. extract 'item #1' to a file stream, extract 'item #2' to a memory stream(then take extacted memory) and so on.bool extracted = decoder->extract(selectedItemsToStreams);}catch (const Exception &exception) { std::cout <<"Exception:" <<exception.what() << std::endl;}
// 1. Create a source input stream for reading archive file content.// 1.1. Create a source input stream with the path to an archive file.plzma_patharchivePath=plzma_path_create_with_utf8_string("path/to/archive.7z");// plzma_path_create_with_wide_string(L"C:\\\\path\\to\\archive.7z");plzma_in_streamarchivePathInStream=plzma_in_stream_create_with_path(&archivePath);// plzma_in_stream_create_with_pathm(...);plzma_path_release(&archivePath);plzma_in_stream_release(&archivePathInStream);// when no longer needed// 1.2. Create a source input stream with the file content in memory.plzma_in_streamarchiveDataInStream=plzma_in_stream_create_with_memory_copy(<FILEDATA>,<FILESIZE>);// plzma_in_stream_create_with_memory(...);// 2. Create decoder with source input stream, type of archive, context for optional delegate and provide optional delegate callback.plzma_decoderdecoder=plzma_decoder_create(&archiveDataInStream,plzma_file_type_7z,plzma_context{nullptr,nullptr });// C2059 = { .context = nullptr, .deinitializer = nullptr }plzma_in_stream_release(&archiveDataInStream);// when no longer neededplzma_decoder_set_progress_delegate_utf8_callback(&decoder,<UTF8CCALLBACK>);// plzma_decoder_set_progress_delegate_wide_callback(...);// 2.1. Optionaly provide the password to open/list/test/extract encrypted archive items.plzma_decoder_set_password_utf8_string(&decoder,"1234");// plzma_decoder_set_password_wide_string(&decoder, L"1234");boolopened=plzma_decoder_open(&decoder);// 3. Select archive items for extracting or testing.// 3.1. Select all archive items.plzma_item_arrayallArchiveItems=plzma_decoder_items(&decoder);// 3.2. Get the number of items, iterate items by index, filter and select items.size_tnumberOfArchiveItems=plzma_decoder_count(&decoder);plzma_item_arrayselectedItemsDuringIteration=plzma_item_array_create(numberOfArchiveItems);plzma_item_out_stream_arrayselectedItemsToStreams=plzma_item_out_stream_array_create(numberOfArchiveItems);for (size_titemIndex=0;itemIndex<numberOfArchiveItems;itemIndex++) {plzma_itemitem=plzma_decoder_item_at(&decoder,itemIndex);plzma_item_array_add(&selectedItemsDuringIteration,&item);plzma_out_streamoutItemStream=plzma_out_stream_create_memory_stream();// to memory streamplzma_item_out_stream_array_add(&selectedItemsToStreams,&item,&outItemStream);plzma_out_stream_release(&outItemStream);plzma_item_release(&item);}// 4. Extract or test selected archive items. The extract process might be:// 4.1. Extract all items to a directory. In this case, you can skip the step #3.plzma_pathextractPath=plzma_path_create_with_utf8_string("path/outdir");boolextracted=plzma_decoder_extract_all_items_to_path(&decoder,&extractPath, true);plzma_path_release(&extractPath);// 4.2. Extract selected items to a directory.plzma_pathextractPath=plzma_path_create_with_utf8_string("path/outdir");boolextracted=plzma_decoder_extract_items_to_path(&decoder,&selectedItemsDuringIteration,&extractPath, true);plzma_path_release(&extractPath);// 4.3. Extract each item to a custom out-stream.// The out-stream might be a file or memory. I.e. extract 'item #1' to a file stream, extract 'item #2' to a memory stream(then take extacted memory) and so on.boolextracted=plzma_decoder_extract_item_out_stream_array(&decoder,&selectedItemsToStreams);plzma_item_array_release(&selectedItemsDuringIteration);// when no longer neededplzma_item_array_release(&allArchiveItems);// when no longer neededplzma_item_out_stream_array_release(&selectedItemsToStreams);// when no longer neededplzma_decoder_release(&decoder);// when no longer needed
The process consists of 4 steps:
- Create output stream for writing archive's file content. The output stream might be created with:
- The path to the archive file.
- Create memory stream without any arguments.
- Create encoder with output stream, type of the archive, compression method and optional progress delegate.
- Optionaly provide the password in case of header and/or content encryption.
- Setup archive properties.
- Add content for archiving. The content might be next:
- Single file path with optional path inside the archive.
- Single directory path with optional directory iteration option and optional path inside the archive.
- Any input stream with required path inside the archive.
- Open & compress.
do{ // 1. Create output stream for writing archive's file content. // 1.1. Using file path.letarchivePath=Path("path/out.7z");letarchivePathOutStream=tryOutStream(path: archivePath) // 2. Create encoder with output stream, type of the archive, compression method and optional progress delegate.letencoder=tryEncoder(stream: archivePathOutStream, fileType:.sevenZ, method:.LZMA2, delegate:self) // 2.1. Optionaly provide the password in case of header and/or content encryption.try encoder.setPassword("1234") // 2.2. Setup archive properties.try encoder.setShouldEncryptHeader(true) // use this option with password.try encoder.setShouldEncryptContent(true) // use this option with password.try encoder.setCompressionLevel(9) // 3. Add content for archiving. // 3.1. Single file path with optional path inside the archive.try encoder.add(path:Path("dir/my_file1.txt")) // store as "dir/my_file1.txt", as is.try encoder.add(path:Path("dir/my_file2.txt"), mode:.default, archivePath:Path("renamed_file2.txt")) // store as "renamed_file2.txt" // 3.2. Single directory path with optional directory iteration option and optional path inside the archive.try encoder.add(path:Path("dir/dir1")) // store as "dir1/..."try encoder.add(path:Path("dir/dir2"), mode:.followSymlinks, archivePath:Path("renamed_dir2")) // store as "renamed_dir2/..." // 3.3. Any input stream with required path inside the archive.letitemStream=tryInStream(dataCopy:<Data>) // InStream(dataNoCopy: <Data>)try encoder.add(stream: itemStream, archivePath:Path("my_file3.txt")) // store as "my_file3.txt" // 4. Open.letopened=try encoder.open() // 4. Compress.letcompressed=try encoder.compress()}catchlet exception asException{print("Exception:\(exception)")}
constplzma=require('plzmasdk');try{// 1. Create output stream for writing archive's file content.// 1.1. Using file path.constarchivePathOutStream=newplzma.OutStream('path/out.7z');// 2. Create encoder with output stream, type of the archive, compression method and optional progress delegate.constencoder=plzma.Encoder(archivePathOutStream,plzma.FileType.sevenZ,plzma.Method.LZMA2);encoder.setProgressDelegate((path,progress)=>console.log(`Delegating progress, path:${path}, progress:${progress}`));// 2.1. Optionaly provide the password in case of header and/or content encryption.encoder.setPassword('1234');// 2.2. Setup archive properties.encoder.shouldEncryptHeader=true;// use this option with password.encoder.shouldEncryptContent=true;// use this option with password.encoder.compressionLevel=9;// 3. Add content for archiving.// 3.1. Single file path with optional path inside the archive.encoder.add('dir/my_file1.txt');// store as "dir/my_file1.txt", as is.encoder.add('dir/my_file2.txt',0,'renamed_file2.txt');// store as "renamed_file2.txt"// 3.2. Single directory path with optional directory iteration option and optional path inside the archive.encoder.add('dir/dir1');// store as "dir1/..."encoder.add('dir/dir2',plzma.OpenDirMode.followSymlinks,'renamed_dir2');// store as "renamed_dir2/..."// 3.3. Any input stream with required path inside the archive.constitemStream=plzma.InStream(newArrayBuffer(...));encoder.add(itemStream,'my_file3.txt');// store as "my_file3.txt"// 4. Open.constopened=awaitencoder.openAsync();// also available sync. version 'encoder.open()'// 4. Compress.constcompressed=awaitencoder.compressAsync();// also available sync. version 'encoder.compress()'}catch(error){console.log(`Exception:${error}`);}
try {// 1. Create output stream for writing archive's file content.// 1.1. Using file path.constauto archivePathOutStream =makeSharedOutStream(Path("path/out.7z"));// 2. Create encoder with output stream, type of the archive, compression method and optional progress delegate.auto encoder =makeSharedEncoder(archivePathOutStream, plzma_file_type_7z, plzma_method_LZMA2); encoder->setProgressDelegate(_progressDelegate);// 2.1. Optionaly provide the password in case of header and/or content encryption. encoder->setPassword("1234");// 2.2. Setup archive properties. encoder->setShouldEncryptHeader(true);// use this option with password. encoder->setShouldEncryptContent(true);// use this option with password. encoder->setCompressionLevel(9);// 3. Add content for archiving.// 3.1. Single file path with optional path inside the archive. encoder->add(Path("dir/my_file1.txt"));// store as "dir/my_file1.txt", as is. encoder->add(Path("dir/my_file2.txt"),0,Path("renamed_file2.txt"));// store as "renamed_file2.txt"// 3.2. Single directory path with optional directory iteration option and optional path inside the archive. encoder->add(Path("dir/dir1"));// store as "dir1/..." encoder->add(Path("dir/dir2"), plzma_open_dir_mode_follow_symlinks,Path("renamed_dir2"));// store as "renamed_dir2/..."// 3.3. Any input stream with required path inside the archive.auto itemStream =makeSharedInStream(<DATA>, <DATA_SIZE>); encoder->add(itemStream,Path("my_file3.txt"));// store as "my_file3.txt"// 4. Open.bool opened = encoder->open();// 4. Compress.bool compressed = encoder->compress();}catch (const Exception &exception) { std::cout <<"Exception:" <<exception.what() << std::endl;}
// 1. Create output stream for writing archive's file content.// 1.1. Using file path.plzma_patharchivePath=plzma_path_create_with_utf8_string("path/out.7z");plzma_out_streamarchivePathOutStream=plzma_out_stream_create_with_path(&archivePath);// 2. Create encoder with output stream, type of the archive, compression method and optional progress delegate.plzma_contextcontext;plzma_encoderencoder=plzma_encoder_create(&archivePathOutStream,plzma_file_type_7z,plzma_method_LZMA2,context);plzma_encoder_set_progress_delegate_utf8_callback(&encoder,<C_CALLBACK_FUNCTION>);// 2.1. Optionaly provide the password in case of header and/or content encryption.plzma_encoder_set_password_utf8_string(&encoder,"1234");// 2.2. Setup archive properties.plzma_encoder_set_should_encrypt_header(&encoder, true);// use this option with password.plzma_encoder_set_should_encrypt_content(&encoder, true);// use this option with password.plzma_encoder_set_compression_level(&encoder,9);// 3. Add content for archiving.// 3.1. Single file path with optional path inside the archive.plzma_pathitemPath=plzma_path_create_with_utf8_string("dir/my_file1.txt");plzma_encoder_add_path(&encoder,&itemPath,0,NULL);// store as "dir/my_file1.txt", as is.plzma_path_release(&itemPath);itemPath=plzma_path_create_with_utf8_string("dir/my_file2.txt");plzma_pathitemArchivePath=plzma_path_create_with_utf8_string("renamed_file2.txt");plzma_encoder_add_path(&encoder,&itemPath,0,&itemArchivePath);// store as "renamed_file2.txt"plzma_path_release(&itemPath);plzma_path_release(&itemArchivePath);// 3.2. Single directory path with optional directory iteration option and optional path inside the archive.itemPath=plzma_path_create_with_utf8_string("dir/dir1");plzma_encoder_add_path(&encoder,&itemPath,0,NULL);// store as "dir1/..."plzma_path_release(&itemPath);itemPath=plzma_path_create_with_utf8_string("dir/dir2");itemArchivePath=plzma_path_create_with_utf8_string("renamed_dir2");plzma_encoder_add_path(&encoder,&itemPath,plzma_open_dir_mode_follow_symlinks,&itemArchivePath);// store as "renamed_dir2/..."plzma_path_release(&itemPath);plzma_path_release(&itemArchivePath);// 3.3. Any input stream with required path inside the archive.itemArchivePath=plzma_path_create_with_utf8_string("my_file3.txt");plzma_in_streamitemStream=plzma_in_stream_create_with_memory(<DATA>,<DATA_SIZE>);plzma_encoder_add_stream(&encoder,&itemStream,&itemArchivePath);// store as "my_file3.txt"plzma_in_stream_release(&itemStream);plzma_path_release(&itemArchivePath);// 4. Open.boolopened=plzma_encoder_open(&encoder);// 4. Compress.boolcompressed=plzma_encoder_compress(&encoder);plzma_out_stream_release(&archivePathOutStream);// when no longer neededplzma_path_release(&archivePath);// when no longer neededplzma_encoder_release(&encoder);// when no longer needed
By using this all you are accepting originalLZMA SDK and MIT license (see below):
The MIT License (MIT)
Copyright (c) 2015 - 2025 Oleh Kulykovolehkulykov@gmail.com
Permission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included inall copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS INTHE SOFTWARE.
About
PLzmaSDK is (Portable, Patched, Package, cross-P-latform) Lzma SDK.