Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nemequ/liblzf.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Lehmann <schmorpforge@schmorp.de>2009-05-01 04:30:53 +0400
committerMarc Lehmann <schmorpforge@schmorp.de>2009-05-01 04:30:53 +0400
commitc256a57705f7063aafde8ba70bc731b134804cdd (patch)
tree7f9d8726a2bea476f2b731dec0eae23db48136b4 /lzf_c.c
parentf9b5f6cab04478a6293f300ecc64f290e0c4b9cb (diff)
3.5
Diffstat (limited to 'lzf_c.c')
-rw-r--r--lzf_c.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lzf_c.c b/lzf_c.c
index 99dab09..0b5d816 100644
--- a/lzf_c.c
+++ b/lzf_c.c
@@ -170,12 +170,13 @@ lzf_compress (const void *const in_data, unsigned int in_len,
unsigned int maxlen = in_end - ip - len;
maxlen = maxlen > MAX_REF ? MAX_REF : maxlen;
+ if (expect_false (op + 3 + 1 >= out_end)) /* first a faster conservative test */
+ if (op - !lit + 3 + 1 >= out_end) /* second the exact but rare test */
+ return 0;
+
op [- lit - 1] = lit - 1; /* stop run */
op -= !lit; /* undo run if length is zero */
- if (expect_false (op + 3 + 1 >= out_end))
- return 0;
-
for (;;)
{
if (expect_true (maxlen > 16))