--- liblzf/lzf_c.c 2007/11/13 11:02:28 1.25 +++ liblzf/lzf_c.c 2007/11/13 11:30:37 1.26 @@ -237,32 +237,31 @@ } while (len--); #endif + lit = 0; op++; /* start run */ - continue; } - - /* one more literal byte we must copy */ - - if (expect_false (op >= out_end)) - return 0; - - lit++; - *op++ = *ip++; - - if (expect_false (lit == MAX_LIT)) + else { - op [- lit - 1] = lit - 1; /* stop run */ - lit = 0; op++; /* start run */ + /* one more literal byte we must copy */ + if (expect_false (op >= out_end)) + return 0; + + lit++; *op++ = *ip++; + + if (expect_false (lit == MAX_LIT)) + { + op [- lit - 1] = lit - 1; /* stop run */ + lit = 0; op++; /* start run */ + } } } - if (op + 2 >= out_end) + if (op + 2 > out_end) /* at most 2 bytes can be missing here */ return 0; while (ip < in_end) { - lit++; - *op++ = *ip++; + lit++; *op++ = *ip++; } op [- lit - 1] = lit - 1; /* end run */