mirror of https://github.com/hak5/openwrt-owl.git
tools/mtd-utils: Mark some lzma functions as static
These functions are not declared in any header file and only used in
same compile unit, mark them as static to remove one gcc warning and
make it easier for the compiler to optimize them out.
This also fixes some style problems to make this patch match the version
in the packages folder.
This is copied from this commit to the mtd-utils we pack into the image:
56d0dd56e9
("mtd-utils: Mark some lzma functions as static")
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Tested-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
openwrt-18.06
parent
8dcd941d8b
commit
bf167f8a9a
|
@ -245,7 +245,7 @@
|
||||||
+ #define LZMA_FREE free
|
+ #define LZMA_FREE free
|
||||||
+ #define PRINT_ERROR(msg) fprintf(stderr, msg)
|
+ #define PRINT_ERROR(msg) fprintf(stderr, msg)
|
||||||
+ #define INIT
|
+ #define INIT
|
||||||
+ #define STATIC
|
+ #define STATIC static
|
||||||
+#endif
|
+#endif
|
||||||
+
|
+
|
||||||
+#include "lzma/LzmaDec.h"
|
+#include "lzma/LzmaDec.h"
|
||||||
|
@ -949,9 +949,9 @@
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p) { return p->buffer; }
|
+Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p) { return p->buffer; }
|
||||||
+Byte MatchFinder_GetIndexByte(CMatchFinder *p, Int32 index) { return p->buffer[index]; }
|
+static Byte MatchFinder_GetIndexByte(CMatchFinder *p, Int32 index) { return p->buffer[index]; }
|
||||||
+
|
+
|
||||||
+UInt32 MatchFinder_GetNumAvailableBytes(CMatchFinder *p) { return p->streamPos - p->pos; }
|
+static UInt32 MatchFinder_GetNumAvailableBytes(CMatchFinder *p) { return p->streamPos - p->pos; }
|
||||||
+
|
+
|
||||||
+void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue)
|
+void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue)
|
||||||
+{
|
+{
|
||||||
|
@ -2357,7 +2357,7 @@
|
||||||
+ p->needFlush = 0;
|
+ p->needFlush = 0;
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+void LzmaDec_InitDicAndState(CLzmaDec *p, Bool initDic, Bool initState)
|
+static void LzmaDec_InitDicAndState(CLzmaDec *p, Bool initDic, Bool initState)
|
||||||
+{
|
+{
|
||||||
+ p->needFlush = 1;
|
+ p->needFlush = 1;
|
||||||
+ p->remainLen = 0;
|
+ p->remainLen = 0;
|
||||||
|
@ -2777,7 +2777,7 @@
|
||||||
+#define kNumLogBits (9 + (int)sizeof(size_t) / 2)
|
+#define kNumLogBits (9 + (int)sizeof(size_t) / 2)
|
||||||
+#define kDicLogSizeMaxCompress ((kNumLogBits - 1) * 2 + 7)
|
+#define kDicLogSizeMaxCompress ((kNumLogBits - 1) * 2 + 7)
|
||||||
+
|
+
|
||||||
+void LzmaEnc_FastPosInit(Byte *g_FastPos)
|
+static void LzmaEnc_FastPosInit(Byte *g_FastPos)
|
||||||
+{
|
+{
|
||||||
+ int c = 2, slotFast;
|
+ int c = 2, slotFast;
|
||||||
+ g_FastPos[0] = 0;
|
+ g_FastPos[0] = 0;
|
||||||
|
@ -3031,7 +3031,7 @@
|
||||||
+ CSaveState saveState;
|
+ CSaveState saveState;
|
||||||
+} CLzmaEnc;
|
+} CLzmaEnc;
|
||||||
+
|
+
|
||||||
+void LzmaEnc_SaveState(CLzmaEncHandle pp)
|
+static void LzmaEnc_SaveState(CLzmaEncHandle pp)
|
||||||
+{
|
+{
|
||||||
+ CLzmaEnc *p = (CLzmaEnc *)pp;
|
+ CLzmaEnc *p = (CLzmaEnc *)pp;
|
||||||
+ CSaveState *dest = &p->saveState;
|
+ CSaveState *dest = &p->saveState;
|
||||||
|
@ -3057,7 +3057,7 @@
|
||||||
+ memcpy(dest->litProbs, p->litProbs, (0x300 << p->lclp) * sizeof(CLzmaProb));
|
+ memcpy(dest->litProbs, p->litProbs, (0x300 << p->lclp) * sizeof(CLzmaProb));
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+void LzmaEnc_RestoreState(CLzmaEncHandle pp)
|
+static void LzmaEnc_RestoreState(CLzmaEncHandle pp)
|
||||||
+{
|
+{
|
||||||
+ CLzmaEnc *dest = (CLzmaEnc *)pp;
|
+ CLzmaEnc *dest = (CLzmaEnc *)pp;
|
||||||
+ const CSaveState *p = &dest->saveState;
|
+ const CSaveState *p = &dest->saveState;
|
||||||
|
@ -3300,7 +3300,7 @@
|
||||||
+ while (symbol < 0x10000);
|
+ while (symbol < 0x10000);
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+void LzmaEnc_InitPriceTables(UInt32 *ProbPrices)
|
+static void LzmaEnc_InitPriceTables(UInt32 *ProbPrices)
|
||||||
+{
|
+{
|
||||||
+ UInt32 i;
|
+ UInt32 i;
|
||||||
+ for (i = (1 << kNumMoveReducingBits) / 2; i < kBitModelTotal; i += (1 << kNumMoveReducingBits))
|
+ for (i = (1 << kNumMoveReducingBits) / 2; i < kBitModelTotal; i += (1 << kNumMoveReducingBits))
|
||||||
|
@ -4426,7 +4426,7 @@
|
||||||
+ p->matchPriceCount = 0;
|
+ p->matchPriceCount = 0;
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+void LzmaEnc_Construct(CLzmaEnc *p)
|
+static void LzmaEnc_Construct(CLzmaEnc *p)
|
||||||
+{
|
+{
|
||||||
+ RangeEnc_Construct(&p->rc);
|
+ RangeEnc_Construct(&p->rc);
|
||||||
+ MatchFinder_Construct(&p->matchFinderBase);
|
+ MatchFinder_Construct(&p->matchFinderBase);
|
||||||
|
@ -4459,7 +4459,7 @@
|
||||||
+ return p;
|
+ return p;
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+void LzmaEnc_FreeLits(CLzmaEnc *p, ISzAlloc *alloc)
|
+static void LzmaEnc_FreeLits(CLzmaEnc *p, ISzAlloc *alloc)
|
||||||
+{
|
+{
|
||||||
+ alloc->Free(alloc, p->litProbs);
|
+ alloc->Free(alloc, p->litProbs);
|
||||||
+ alloc->Free(alloc, p->saveState.litProbs);
|
+ alloc->Free(alloc, p->saveState.litProbs);
|
||||||
|
@ -4467,7 +4467,7 @@
|
||||||
+ p->saveState.litProbs = 0;
|
+ p->saveState.litProbs = 0;
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+void LzmaEnc_Destruct(CLzmaEnc *p, ISzAlloc *alloc, ISzAlloc *allocBig)
|
+static void LzmaEnc_Destruct(CLzmaEnc *p, ISzAlloc *alloc, ISzAlloc *allocBig)
|
||||||
+{
|
+{
|
||||||
+ #ifdef COMPRESS_MF_MT
|
+ #ifdef COMPRESS_MF_MT
|
||||||
+ MatchFinderMt_Destruct(&p->matchFinderMt, allocBig);
|
+ MatchFinderMt_Destruct(&p->matchFinderMt, allocBig);
|
||||||
|
@ -4698,7 +4698,7 @@
|
||||||
+ return SZ_OK;
|
+ return SZ_OK;
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+void LzmaEnc_Init(CLzmaEnc *p)
|
+static void LzmaEnc_Init(CLzmaEnc *p)
|
||||||
+{
|
+{
|
||||||
+ UInt32 i;
|
+ UInt32 i;
|
||||||
+ p->state = 0;
|
+ p->state = 0;
|
||||||
|
@ -4757,7 +4757,7 @@
|
||||||
+ p->lpMask = (1 << p->lp) - 1;
|
+ p->lpMask = (1 << p->lp) - 1;
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+void LzmaEnc_InitPrices(CLzmaEnc *p)
|
+static void LzmaEnc_InitPrices(CLzmaEnc *p)
|
||||||
+{
|
+{
|
||||||
+ if (!p->fastMode)
|
+ if (!p->fastMode)
|
||||||
+ {
|
+ {
|
||||||
|
@ -4798,7 +4798,7 @@
|
||||||
+ return LzmaEnc_AllocAndInit(p, 0, alloc, allocBig);
|
+ return LzmaEnc_AllocAndInit(p, 0, alloc, allocBig);
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+SRes LzmaEnc_PrepareForLzma2(CLzmaEncHandle pp,
|
+static SRes LzmaEnc_PrepareForLzma2(CLzmaEncHandle pp,
|
||||||
+ ISeqInStream *inStream, UInt32 keepWindowSize,
|
+ ISeqInStream *inStream, UInt32 keepWindowSize,
|
||||||
+ ISzAlloc *alloc, ISzAlloc *allocBig)
|
+ ISzAlloc *alloc, ISzAlloc *allocBig)
|
||||||
+{
|
+{
|
||||||
|
@ -4814,7 +4814,7 @@
|
||||||
+ p->seqBufInStream.rem = srcLen;
|
+ p->seqBufInStream.rem = srcLen;
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+SRes LzmaEnc_MemPrepare(CLzmaEncHandle pp, const Byte *src, SizeT srcLen,
|
+static SRes LzmaEnc_MemPrepare(CLzmaEncHandle pp, const Byte *src, SizeT srcLen,
|
||||||
+ UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig)
|
+ UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig)
|
||||||
+{
|
+{
|
||||||
+ CLzmaEnc *p = (CLzmaEnc *)pp;
|
+ CLzmaEnc *p = (CLzmaEnc *)pp;
|
||||||
|
@ -4823,7 +4823,7 @@
|
||||||
+ return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig);
|
+ return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig);
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+void LzmaEnc_Finish(CLzmaEncHandle pp)
|
+static void LzmaEnc_Finish(CLzmaEncHandle pp)
|
||||||
+{
|
+{
|
||||||
+ #ifdef COMPRESS_MF_MT
|
+ #ifdef COMPRESS_MF_MT
|
||||||
+ CLzmaEnc *p = (CLzmaEnc *)pp;
|
+ CLzmaEnc *p = (CLzmaEnc *)pp;
|
||||||
|
@ -4855,19 +4855,19 @@
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+
|
+
|
||||||
+UInt32 LzmaEnc_GetNumAvailableBytes(CLzmaEncHandle pp)
|
+static UInt32 LzmaEnc_GetNumAvailableBytes(CLzmaEncHandle pp)
|
||||||
+{
|
+{
|
||||||
+ const CLzmaEnc *p = (CLzmaEnc *)pp;
|
+ const CLzmaEnc *p = (CLzmaEnc *)pp;
|
||||||
+ return p->matchFinder.GetNumAvailableBytes(p->matchFinderObj);
|
+ return p->matchFinder.GetNumAvailableBytes(p->matchFinderObj);
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+const Byte *LzmaEnc_GetCurBuf(CLzmaEncHandle pp)
|
+static const Byte *LzmaEnc_GetCurBuf(CLzmaEncHandle pp)
|
||||||
+{
|
+{
|
||||||
+ const CLzmaEnc *p = (CLzmaEnc *)pp;
|
+ const CLzmaEnc *p = (CLzmaEnc *)pp;
|
||||||
+ return p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset;
|
+ return p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset;
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, Bool reInit,
|
+static SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, Bool reInit,
|
||||||
+ Byte *dest, size_t *destLen, UInt32 desiredPackSize, UInt32 *unpackSize)
|
+ Byte *dest, size_t *destLen, UInt32 desiredPackSize, UInt32 *unpackSize)
|
||||||
+{
|
+{
|
||||||
+ CLzmaEnc *p = (CLzmaEnc *)pp;
|
+ CLzmaEnc *p = (CLzmaEnc *)pp;
|
||||||
|
|
Loading…
Reference in New Issue