/* LzFind.h -- Match finder for LZ algorithms\r
-2008-10-04 : Igor Pavlov : Public domain */\r
+2017-06-10 : Igor Pavlov : Public domain */\r
\r
-#ifndef __LZFIND_H\r
-#define __LZFIND_H\r
+#ifndef __LZ_FIND_H\r
+#define __LZ_FIND_H\r
\r
-#include "Types.h"\r
+#include "7zTypes.h"\r
+\r
+EXTERN_C_BEGIN\r
\r
typedef UInt32 CLzRef;\r
\r
UInt32 cyclicBufferPos;\r
UInt32 cyclicBufferSize; /* it must be = (historySize + 1) */\r
\r
+ Byte streamEndWasReached;\r
+ Byte btMode;\r
+ Byte bigHash;\r
+ Byte directInput;\r
+\r
UInt32 matchMaxLen;\r
CLzRef *hash;\r
CLzRef *son;\r
\r
Byte *bufferBase;\r
ISeqInStream *stream;\r
- int streamEndWasReached;\r
-\r
+ \r
UInt32 blockSize;\r
UInt32 keepSizeBefore;\r
UInt32 keepSizeAfter;\r
\r
UInt32 numHashBytes;\r
- int directInput;\r
- int btMode;\r
- /* int skipModeBits; */\r
- int bigHash;\r
+ size_t directInputRem;\r
UInt32 historySize;\r
UInt32 fixedHashSize;\r
UInt32 hashSizeSum;\r
- UInt32 numSons;\r
SRes result;\r
UInt32 crc[256];\r
+ size_t numRefs;\r
+\r
+ UInt64 expectedDataSize;\r
} CMatchFinder;\r
\r
#define Inline_MatchFinder_GetPointerToCurrentPos(p) ((p)->buffer)\r
-#define Inline_MatchFinder_GetIndexByte(p, index) ((p)->buffer[(Int32)(index)])\r
\r
#define Inline_MatchFinder_GetNumAvailableBytes(p) ((p)->streamPos - (p)->pos)\r
\r
+#define Inline_MatchFinder_IsFinishedOK(p) \\r
+ ((p)->streamEndWasReached \\r
+ && (p)->streamPos == (p)->pos \\r
+ && (!(p)->directInput || (p)->directInputRem == 0))\r
+ \r
int MatchFinder_NeedMove(CMatchFinder *p);\r
Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p);\r
void MatchFinder_MoveBlock(CMatchFinder *p);\r
*/\r
int MatchFinder_Create(CMatchFinder *p, UInt32 historySize,\r
UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter,\r
- ISzAlloc *alloc);\r
-void MatchFinder_Free(CMatchFinder *p, ISzAlloc *alloc);\r
-void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems);\r
+ ISzAllocPtr alloc);\r
+void MatchFinder_Free(CMatchFinder *p, ISzAllocPtr alloc);\r
+void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, size_t numItems);\r
void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue);\r
\r
UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *buffer, CLzRef *son,\r
*/\r
\r
typedef void (*Mf_Init_Func)(void *object);\r
-typedef Byte (*Mf_GetIndexByte_Func)(void *object, Int32 index);\r
typedef UInt32 (*Mf_GetNumAvailableBytes_Func)(void *object);\r
typedef const Byte * (*Mf_GetPointerToCurrentPos_Func)(void *object);\r
typedef UInt32 (*Mf_GetMatches_Func)(void *object, UInt32 *distances);\r
typedef struct _IMatchFinder\r
{\r
Mf_Init_Func Init;\r
- Mf_GetIndexByte_Func GetIndexByte;\r
Mf_GetNumAvailableBytes_Func GetNumAvailableBytes;\r
Mf_GetPointerToCurrentPos_Func GetPointerToCurrentPos;\r
Mf_GetMatches_Func GetMatches;\r
\r
void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable);\r
\r
+void MatchFinder_Init_LowHash(CMatchFinder *p);\r
+void MatchFinder_Init_HighHash(CMatchFinder *p);\r
+void MatchFinder_Init_3(CMatchFinder *p, int readData);\r
void MatchFinder_Init(CMatchFinder *p);\r
+\r
UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances);\r
UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances);\r
+\r
void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num);\r
void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num);\r
\r
+EXTERN_C_END\r
+\r
#endif\r