diff options
-rw-r--r-- | bench.c | 13 | ||||
-rw-r--r-- | lz4.c | 8 | ||||
-rw-r--r-- | lz4.h | 2 |
3 files changed, 14 insertions, 9 deletions
@@ -29,10 +29,15 @@ #define _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_DEPRECATE // VS2005
-// Under Linux at least, pull in the *64 commands
-#define _LARGEFILE64_SOURCE
+// Unix Large Files support (>4GB)
+#if (defined(__sun__) && (!defined(__LP64__))) // Sun Solaris 32-bits requires specific definitions
+# define _LARGEFILE_SOURCE
+# define FILE_OFFSET_BITS=64
+#else
+# define _LARGEFILE64_SOURCE
+#endif
-// MSVC does not support S_ISREG
+// S_ISREG & gettimeofday() are not supported by MSVC
#if defined(_MSC_VER)
# define S_ISREG(x) (((x) & S_IFMT) == S_IFREG)
# define BMK_LEGACY_TIMER 1
@@ -40,7 +45,7 @@ // GCC does not support _rotl outside of Windows
#if !defined(_WIN32)
-#define _rotl(x,r) ((x << r) | (x >> (32 - r)))
+# define _rotl(x,r) ((x << r) | (x >> (32 - r)))
#endif
@@ -719,10 +719,10 @@ int LZ4_uncompress(const char* source, cpy = op+length;
if unlikely(cpy>oend-COPYLENGTH)
{
- if (cpy > oend) goto _output_error; // Error : request to write beyond destination buffer
+ if (cpy != oend) goto _output_error; // Error : we must necessarily stand at EOF
memcpy(op, ip, length);
ip += length;
- break; // Necessarily EOF
+ break; // EOF
}
LZ4_WILDCOPY(ip, op, cpy); ip -= (op-cpy); op = cpy;
@@ -805,13 +805,13 @@ int LZ4_uncompress_unknownOutputSize( cpy = op+length;
if ((cpy>oend-COPYLENGTH) || (ip+length>iend-COPYLENGTH))
{
- if (cpy > oend) goto _output_error; // Error : request to write beyond destination buffer
+ if (cpy != oend) goto _output_error; // Error : we must necessarily stand at EOF
if (ip+length > iend) goto _output_error; // Error : request to read beyond source buffer
memcpy(op, ip, length);
op += length;
ip += length;
if (ip<iend) goto _output_error; // Error : LZ4 format violation
- break; // Necessarily EOF, due to parsing restrictions
+ break; // Necessarily EOF, due to parsing restrictions
}
LZ4_WILDCOPY(ip, op, cpy); ip -= (op-cpy); op = cpy;
@@ -60,7 +60,7 @@ LZ4_uncompress() : osize : is the output size, therefore the original size
return : the number of bytes read in the source buffer
If the source stream is malformed, the function will stop decoding and return a negative result, indicating the byte position of the faulty instruction
- This function never writes beyond dest + osize, and is therefore protected against malicious data packets
+ This function never writes outside of provided buffers, and never modifies input buffer.
note : destination buffer must be already allocated.
its size must be a minimum of 'osize' bytes.
*/
|