?? lzmatest.c
字號:
/*
LzmaTest.c
Test application for LZMA Decoder
LZMA SDK 4.02 Copyright (c) 1999-2004 Igor Pavlov (2004-06-10)
*/
#include "LzmaDecode.h"
int decompressImage(unsigned char *ComSrcAddr, unsigned char *UncomSrcAddr, int nbytes);
/*modified by claire*/
#if 1
int decompressImage(unsigned char *ComSrcAddr, unsigned char *UncomSrcAddr, int nbytes)
{
unsigned int processedSize;
unsigned int compressedSize, outSize, outSizeProcessed, lzmaInternalSize;
void *lzmaInternalData;
unsigned char properties[5];
unsigned char prop0;
int ii;
int lc, lp, pb;
int res;
memcpy(properties, ComSrcAddr, 5);
outSize = 0;
for(ii = 0; ii < 4; ii++)
{
unsigned char b;
memcpy(&b, ComSrcAddr+5+ii, 1);
outSize += (unsigned int)(b) << (ii * 8);
}
#if 0
printf("outSize = %d \r\n", outSize);
#endif
if(outSize == 0xFFFFFFFF)
{
#if 0
printf("\n stream version is not supported \r\n");
#endif
return ERROR;
}
for(ii = 0; ii <4; ii++)
{
unsigned char b;
memcpy(&b, ComSrcAddr+4+5+ii, 1);
if(b != 0)
{
#if 0
printf("\n too long file");
#endif
return ERROR;
}
}
ComSrcAddr = ComSrcAddr + 5 + 4 + 4;
prop0 = properties[0];
if(prop0 >= (9*5*5))
{
#if 0
printf("\n Properties error");
#endif
return ERROR;
}
for(pb = 0; prop0 >= (9 * 5);
pb++, prop0 -= (9 * 5));
for(lp = 0; prop0 >= 9;
lp++, prop0 -= 9);
lc = prop0;
lzmaInternalSize =
(LZMA_BASE_SIZE + (LZMA_LIT_SIZE << (lc + lp)))* sizeof(CProb);
#ifdef MEMORY_32
lzmaInternalData = (unsigned char *)(RAM_HIGH_ADRS+(8*1024*1024));
#else
lzmaInternalData = (unsigned char *)(RAM_HIGH_ADRS+(3*1024*1024));
#endif
if(UncomSrcAddr == 0 || lzmaInternalData == 0)
{
#if 0
printf("\n can't allocate");
#endif
return ERROR;
}
#if 0
printf("LzmaTest: LzmaDecode, lzmaInternalSize = %d ...\r\n", lzmaInternalSize);
#endif
res = LzmaDecode((unsigned char *)lzmaInternalData, lzmaInternalSize,
lc, lp, pb,
ComSrcAddr, nbytes,
UncomSrcAddr, outSize, &outSizeProcessed);
outSize = outSizeProcessed;
#if 0
printf("LzmaTest: LzmaDecode done ...\r\n");
#endif
if (res != 0)
{
#if 0
printf("\nerror = %d\n", res);
#endif
return ERROR;
}
#if 0
printf("Loading image \r\n");
#endif
return OK;
}
#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -