diff options
author | root <root> | 2008-08-25 01:40:31 +0000 |
---|---|---|
committer | root <root> | 2008-08-25 01:40:31 +0000 |
commit | d52302e9cb04a26c03219da3be74ed68d37cf5d3 (patch) | |
tree | 325f8af8e2b7294d557e44fb456f5e263b5ee71b /lzf_c.c | |
parent | 95b63bcf4dfbc28630ee68784f7619b34c1db30b (diff) |
*** empty log message ***rel-3_3
Diffstat (limited to 'lzf_c.c')
-rw-r--r-- | lzf_c.c | 43 |
1 files changed, 23 insertions, 20 deletions
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2007 Marc Alexander Lehmann <schmorp@schmorp.de> + * Copyright (c) 2000-2008 Marc Alexander Lehmann <schmorp@schmorp.de> * * Redistribution and use in source and binary forms, with or without modifica- * tion, are permitted provided that the following conditions are met: @@ -208,7 +208,7 @@ lzf_compress (const void *const in_data, unsigned int in_len, break; } - len -= 2; + len -= 2; /* len is now #octets - 1 */ ip++; if (len < 7) @@ -223,31 +223,34 @@ lzf_compress (const void *const in_data, unsigned int in_len, *op++ = off; + if (expect_true (ip + len < in_end - 2)) + { #if ULTRA_FAST || VERY_FAST - ip += len; -#if VERY_FAST && !ULTRA_FAST - --ip; -#endif - hval = FRST (ip); + ip += len; +# if VERY_FAST && !ULTRA_FAST + --ip; +# endif + hval = FRST (ip); - hval = NEXT (hval, ip); - htab[IDX (hval)] = ip; - ip++; + hval = NEXT (hval, ip); + htab[IDX (hval)] = ip; + ip++; -#if VERY_FAST && !ULTRA_FAST - hval = NEXT (hval, ip); - htab[IDX (hval)] = ip; - ip++; -#endif -#else - do - { +# if VERY_FAST && !ULTRA_FAST hval = NEXT (hval, ip); htab[IDX (hval)] = ip; ip++; - } - while (len--); +# endif +#else + do + { + hval = NEXT (hval, ip); + htab[IDX (hval)] = ip; + ip++; + } + while (len--); #endif + } lit = 0; op++; /* start run */ } |