该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
我知道是压缩文件,但是不知道它具体实现了什么功能(完整的),有没有人能看明白?
大概说个流程就好,具体功能怎么实现,我可以自己再琢磨,谢谢大佬!
以下为源程序:
// tests1932k.cpp : 定义控制台应用程序的入口点。
//#include "stdafx.h"#include "minilzo.h"unsigned char inputdata[32 * 1024];
unsigned long inputdata_len = 32 * 1024;unsigned char outputdata[32 * 1024];
unsigned long outputdata_len = 0;#define HEAP_ALLOC(var,size) \
lzo_align_t __LZO_MMODEL var [ ((size) + (sizeof(lzo_align_t) - 1)) / sizeof(lzo_align_t) ]static HEAP_ALLOC(wrkmem, LZO1X_1_MEM_COMPRESS);void outputs19file(const unsigned long address,const unsigned char *data)
{
for (int tempaddr = address; tempaddr < 32; tempaddr++)
{ }
}int main(int argc, char *argv[])
{
FILE *inputfile = NULL,*outputfile = NULL;
if (lzo_init() != LZO_E_OK)
{
printf("internal error - lzo_init() failed !!!\n");
printf("(this usually indicates a compiler bug - try recompiling\nwithout optimizations, and enable '-DLZO_DEBUG' for diagnostics)\n");
return 3;
}
if (argc < 3)
{
inputfile = fopen("standalone_tcflash.txt","r");
outputfile = fopen("output.bin","wb");
}
else
{
inputfile = fopen(argv[1],"r");
outputfile = fopen(argv[2],"wb");
}
if (!((NULL != inputfile) && (NULL != outputfile)))
{
return -1;
}
else
{
for (unsigned long address = 0;address < 0x10000000;address+= 32768)
{
int ret = 0,i = 0;
for (; i < 32768; i++)
{
if(1 == fscanf(inputfile,"%X",inputdata + i))
{
}
else
{
break;
}
}
for (int temp = i; temp < 32768; temp++)
{
inputdata[temp] = 0xFF;
}
ret = lzo1x_1_compress(inputdata,32768,outputdata,&outputdata_len,wrkmem);
for (int temp = outputdata_len; temp < 32768; temp++)
{
outputdata[temp] = 0xFF;
}
if(0 == ret)
{
fwrite(outputdata,1,outputdata_len,outputfile);
}
if (i != 32768)
{
break;
}
}
fclose(inputfile);
fclose(outputfile);
}}