2N/A/*
2N/A * GRUB -- GRand Unified Bootloader
2N/A * Copyright (c) 1999-2008 Igor Pavlov
2N/A * Copyright (C) 2008 Free Software Foundation, Inc.
2N/A *
2N/A * GRUB is free software: you can redistribute it and/or modify
2N/A * it under the terms of the GNU General Public License as published by
2N/A * the Free Software Foundation, either version 3 of the License, or
2N/A * (at your option) any later version.
2N/A *
2N/A * GRUB is distributed in the hope that it will be useful,
2N/A * but WITHOUT ANY WARRANTY; without even the implied warranty of
2N/A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2N/A * GNU General Public License for more details.
2N/A *
2N/A * You should have received a copy of the GNU General Public License
2N/A * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
2N/A */
2N/A
2N/A/*
2N/A * This code was taken from LZMA SDK 4.58 beta, and was slightly modified
2N/A * to adapt it to GRUB's requirement.
2N/A *
2N/A * See <http://www.7-zip.org>, for more information about LZMA.
2N/A */
2N/A
2N/A#ifndef __LZMAENC_H
2N/A#define __LZMAENC_H
2N/A
2N/A#include "LzmaTypes.h"
2N/A
2N/A#define LZMA_PROPS_SIZE 5
2N/A
2N/Atypedef struct _CLzmaEncProps
2N/A{
2N/A int level; /* 0 <= level <= 9 */
2N/A UInt32 dictSize; /* (1 << 12) <= dictSize <= (1 << 27) for 32-bit version
2N/A (1 << 12) <= dictSize <= (1 << 30) for 64-bit version
2N/A default = (1 << 24) */
2N/A int lc; /* 0 <= lc <= 8, default = 3 */
2N/A int lp; /* 0 <= lp <= 4, default = 0 */
2N/A int pb; /* 0 <= pb <= 4, default = 2 */
2N/A int algo; /* 0 - fast, 1 - normal, default = 1 */
2N/A int fb; /* 5 <= fb <= 273, default = 32 */
2N/A int btMode; /* 0 - hashChain Mode, 1 - binTree mode - normal, default = 1 */
2N/A int numHashBytes; /* 2, 3 or 4, default = 4 */
2N/A UInt32 mc; /* 1 <= mc <= (1 << 30), default = 32 */
2N/A unsigned writeEndMark; /* 0 - do not write EOPM, 1 - write EOPM, default = 0 */
2N/A int numThreads; /* 1 or 2, default = 2 */
2N/A} CLzmaEncProps;
2N/A
2N/Avoid LzmaEncProps_Init(CLzmaEncProps *p);
2N/Avoid LzmaEncProps_Normalize(CLzmaEncProps *p);
2N/AUInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2);
2N/A
2N/A
2N/A/* ---------- CLzmaEncHandle Interface ---------- */
2N/A
2N/A/* LzmaEnc_* functions can return the following exit codes:
2N/AReturns:
2N/A SZ_OK - OK
2N/A SZ_ERROR_MEM - Memory allocation error
2N/A SZ_ERROR_PARAM - Incorrect parameter in props
2N/A SZ_ERROR_WRITE - Write callback error.
2N/A SZ_ERROR_PROGRESS - some break from progress callback
2N/A SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version)
2N/A*/
2N/A
2N/Atypedef void * CLzmaEncHandle;
2N/A
2N/ACLzmaEncHandle LzmaEnc_Create(ISzAlloc *alloc);
2N/Avoid LzmaEnc_Destroy(CLzmaEncHandle p, ISzAlloc *alloc, ISzAlloc *allocBig);
2N/ASRes LzmaEnc_SetProps(CLzmaEncHandle p, const CLzmaEncProps *props);
2N/ASRes LzmaEnc_WriteProperties(CLzmaEncHandle p, Byte *properties, SizeT *size);
2N/ASRes LzmaEnc_Encode(CLzmaEncHandle p, ISeqOutStream *outStream, ISeqInStream *inStream,
2N/A ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);
2N/ASRes LzmaEnc_MemEncode(CLzmaEncHandle p, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
2N/A int writeEndMark, ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);
2N/A
2N/A/* ---------- One Call Interface ---------- */
2N/A
2N/A/* LzmaEncode
2N/AReturn code:
2N/A SZ_OK - OK
2N/A SZ_ERROR_MEM - Memory allocation error
2N/A SZ_ERROR_PARAM - Incorrect parameter
2N/A SZ_ERROR_OUTPUT_EOF - output buffer overflow
2N/A SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version)
2N/A*/
2N/A
2N/ASRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
2N/A const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark,
2N/A ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);
2N/A
2N/A#endif