ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/liblzf/lzf_c.c
(Generate patch)

Comparing liblzf/lzf_c.c (file contents):
Revision 1.25 by root, Tue Nov 13 11:02:28 2007 UTC vs.
Revision 1.26 by root, Tue Nov 13 11:30:37 2007 UTC

235 htab[IDX (hval)] = ip; 235 htab[IDX (hval)] = ip;
236 ip++; 236 ip++;
237 } 237 }
238 while (len--); 238 while (len--);
239#endif 239#endif
240 lit = 0; op++; /* start run */
241 continue;
242 }
243 240
244 /* one more literal byte we must copy */
245
246 if (expect_false (op >= out_end))
247 return 0;
248
249 lit++;
250 *op++ = *ip++;
251
252 if (expect_false (lit == MAX_LIT))
253 {
254 op [- lit - 1] = lit - 1; /* stop run */
255 lit = 0; op++; /* start run */ 241 lit = 0; op++; /* start run */
256 } 242 }
243 else
244 {
245 /* one more literal byte we must copy */
246 if (expect_false (op >= out_end))
247 return 0;
248
249 lit++; *op++ = *ip++;
250
251 if (expect_false (lit == MAX_LIT))
252 {
253 op [- lit - 1] = lit - 1; /* stop run */
254 lit = 0; op++; /* start run */
255 }
256 }
257 } 257 }
258 258
259 if (op + 2 >= out_end) 259 if (op + 2 > out_end) /* at most 2 bytes can be missing here */
260 return 0; 260 return 0;
261 261
262 while (ip < in_end) 262 while (ip < in_end)
263 { 263 {
264 lit++;
265 *op++ = *ip++; 264 lit++; *op++ = *ip++;
266 } 265 }
267 266
268 op [- lit - 1] = lit - 1; /* end run */ 267 op [- lit - 1] = lit - 1; /* end run */
269 op -= !lit; /* undo run if length is zero */ 268 op -= !lit; /* undo run if length is zero */
270 269

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines