From d5607e01318876986723cab8e02cb479c7636e5d Mon Sep 17 00:00:00 2001 From: pcg Date: Tue, 23 Dec 2003 04:52:00 +0000 Subject: *** empty log message *** --- lzf_d.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'lzf_d.c') diff --git a/lzf_d.c b/lzf_d.c index d1eb2cf..351b967 100644 --- a/lzf_d.c +++ b/lzf_d.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2002 Marc Alexander Lehmann + * Copyright (c) 2000-2003 Marc Alexander Lehmann * * Redistribution and use in source and binary forms, with or without modifica- * tion, are permitted provided that the following conditions are met: @@ -26,16 +26,21 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include - #include "lzfP.h" +#if AVOID_ERRNO +# define SET_ERRNO(n) +#else +# include +# define SET_ERRNO(n) errno = (n) +#endif + unsigned int lzf_decompress (const void *const in_data, unsigned int in_len, void *out_data, unsigned int out_len) { - u8 const *ip = in_data; - u8 *op = out_data; + u8 const *ip = (const u8 *)in_data; + u8 *op = (u8 *)out_data; u8 const *const in_end = ip + in_len; u8 *const out_end = op + out_len; @@ -49,7 +54,7 @@ lzf_decompress (const void *const in_data, unsigned int in_len, if (op + ctrl > out_end) { - errno = E2BIG; + SET_ERRNO (E2BIG); return 0; } @@ -76,13 +81,13 @@ lzf_decompress (const void *const in_data, unsigned int in_len, if (op + len + 2 > out_end) { - errno = E2BIG; + SET_ERRNO (E2BIG); return 0; } if (ref < (u8 *)out_data) { - errno = EINVAL; + SET_ERRNO (EINVAL); return 0; } -- cgit v1.2.3