}\r
\r
\r
-//****************************\r
-// Deprecated functions\r
-//****************************\r
-int LZ4_decode ( char* source, \r
- char* dest,\r
- int isize)\r
-{ \r
- // Local Variables\r
- BYTE *ip = (BYTE*)source, \r
- *iend = ip + isize;\r
-\r
- BYTE *op = (BYTE*)dest, \r
- *ref, *cpy,\r
- runcode;\r
- \r
- U32 dec[4]={0, 3, 2, 3};\r
- int len, length;\r
-\r
-\r
- // Main Loop\r
- while (ip < iend)\r
- {\r
- // get runlength\r
- runcode = *ip++;\r
- if ((length=(runcode>>ML_BITS)) == RUN_MASK) { for (;(len=*ip++)==255;length+=255){} length += len; } \r
-\r
- // copy literals\r
- ref=op+length;\r
- while (op<ref) { *(U32*)op = *(U32*)ip; op+=4; ip+=4; }\r
- ip-=(op-ref); op=ref; // correction\r
- if (ip>=iend) break; // Check EOF\r
-\r
- // get offset\r
- ref -= *(U16*)ip; ip+=2;\r
-\r
- // get matchlength\r
- if ((length=(runcode&ML_MASK)) == ML_MASK) { for (;(len=*ip++)==255;length+=255){} length += len; } \r
- length += MINMATCH;\r
-\r
- // copy repeated sequence\r
- cpy = op + length;\r
- if (op-ref<4)\r
- {\r
- *op++ = *ref++;\r
- *op++ = *ref++;\r
- *op++ = *ref++;\r
- *op++ = *ref++;\r
- ref -= dec[op-ref];\r
- } else { *(U32*)op=*(U32*)ref; op+=4; ref+=4; }\r
- while(op<cpy) { *(U32*)op=*(U32*)ref; op+=4; ref+=4; }\r
- op=cpy; // correction\r
- }\r
-\r
- // end of decoding\r
- return (int) (((char*)op)-dest);\r
-}\r
// Deprecated decoding function\r
//*********************************\r
\r
-int LZ4_decode (char* source, char* dest, int isize);\r
-\r
/*\r
-LZ4_decode : This version is faster, but deprecated\r
- return : the number of bytes in decoded buffer dest\r
- note 1 : isize is the input size, therefore the compressed size\r
- note 2 : destination buffer must be already allocated. \r
- The program calling the decoder must know in advance the size of decoded stream to properly allocate the destination buffer\r
- The destination buffer size must be at least "decompressedSize + 3 Bytes"\r
- This version is **unprotected** against malicious data packets designed to create buffer overflow errors.\r
- It is therefore not recommended in unsecure situations, such as Internet communications.\r
- This function is deprecated.\r
+LZ4_decode : Starting with r12, LZ4_decode() is no longer provided in LZ4 source code.\r
+ If you need to provide "isize" instead of "osize" to the decoder, please use LZ4_uncompress_unknownOutputSize(), which is safer.\r
*/\r
\r
\r
// Constants\r
//****************************\r
#define COMPRESSOR_NAME "Demo compression program using LZ4"\r
-#define COMPRESSOR_VERSION "v1.0"\r
+#define COMPRESSOR_VERSION ""\r
#define COMPILED __DATE__\r
#define AUTHOR "Yann Collet"\r
#define BINARY_NAME "LZ4.exe"\r
int usage()\r
{\r
printf("Usage :\n");\r
- printf(" %s [arg] input [output]\n",BINARY_NAME);\r
+ printf(" %s [arg] input output\n",BINARY_NAME);\r
printf("Arguments :\n");\r
printf(" -c : force compression (default)\n");\r
printf(" -d : force decompression \n");\r
argument += command;\r
\r
// display help on usage\r
- if( argument[0] =='h' )\r
- { usage(); return 0; }\r
+ if ( argument[0] =='h' ) { usage(); return 0; }\r
\r
// Forced Compression (default)\r
- if( argument[0] =='c' )\r
- { compression=1; continue; }\r
+ if ( argument[0] =='c' ) { compression=1; continue; }\r
\r
// Forced Decoding\r
- if( argument[0] =='d' )\r
- { decode=1; continue; }\r
+ if ( argument[0] =='d' ) { decode=1; continue; }\r
}\r
\r
// first provided filename is input\r