summaryrefslogtreecommitdiff
path: root/lzf_d.c
diff options
context:
space:
mode:
authorpcg <pcg>2003-12-23 04:52:00 +0000
committerpcg <pcg>2003-12-23 04:52:00 +0000
commitd5607e01318876986723cab8e02cb479c7636e5d (patch)
tree3ad20b59dc62ff1ef5511538c5f899b14c5e6231 /lzf_d.c
parent3d0092ba13033a7f502240c12b748cebe6ed84cf (diff)
*** empty log message ***
Diffstat (limited to 'lzf_d.c')
-rw-r--r--lzf_d.c21
1 files changed, 13 insertions, 8 deletions
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 <pcg@goof.com>
+ * Copyright (c) 2000-2003 Marc Alexander Lehmann <pcg@goof.com>
*
* 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 <errno.h>
-
#include "lzfP.h"
+#if AVOID_ERRNO
+# define SET_ERRNO(n)
+#else
+# include <errno.h>
+# 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;
}