Removed LZ4_decode() function code.
authoryann.collet.73@gmail.com <yann.collet.73@gmail.com@650e7d94-2a16-8b24-b05c-7c0b3f6821cd>
Sun, 21 Aug 2011 11:42:08 +0000 (11:42 +0000)
committeryann.collet.73@gmail.com <yann.collet.73@gmail.com@650e7d94-2a16-8b24-b05c-7c0b3f6821cd>
Sun, 21 Aug 2011 11:42:08 +0000 (11:42 +0000)
If you need to provide "isize" instead of "osize" to the decoder, please use LZ4_uncompress_unknownOutputSize(), which is safer.

git-svn-id: https://lz4.googlecode.com/svn/trunk@12 650e7d94-2a16-8b24-b05c-7c0b3f6821cd

lz4.c
lz4.h
main.c

diff --git a/lz4.c b/lz4.c
index ff4f515..14caea5 100644 (file)
--- a/lz4.c
+++ b/lz4.c
@@ -371,59 +371,3 @@ _output_error:
 }\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
diff --git a/lz4.h b/lz4.h
index f831048..6fcc039 100644 (file)
--- a/lz4.h
+++ b/lz4.h
@@ -92,18 +92,9 @@ LZ4_compressCtx :
 // 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
diff --git a/main.c b/main.c
index b466a27..1d8e6ec 100644 (file)
--- a/main.c
+++ b/main.c
@@ -54,7 +54,7 @@
 // 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
@@ -75,7 +75,7 @@
 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
@@ -227,16 +227,13 @@ int main(int argc, char** argv)
                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