Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 190197
b: refs/heads/master
c: ccdb400
h: refs/heads/master
i:
  190195: ce66d2d
v: v3
  • Loading branch information
Albin Tonnerre authored and Linus Torvalds committed Apr 24, 2010
1 parent d0d620f commit ddf7e58
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 23be7468e8802a2ac1de6ee3eecb3ec7f14dc703
refs/heads/master: ccdb40048b2972f10bdc944913c0e0ee26b5d1f2
22 changes: 15 additions & 7 deletions trunk/lib/decompress_unlzo.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ STATIC inline int INIT unlzo(u8 *input, int in_len,
u32 src_len, dst_len;
size_t tmp;
u8 *in_buf, *in_buf_save, *out_buf;
int obytes_processed = 0;
int ret = -1;

set_error_fn(error_fn);

Expand Down Expand Up @@ -174,15 +174,22 @@ STATIC inline int INIT unlzo(u8 *input, int in_len,

/* decompress */
tmp = dst_len;
r = lzo1x_decompress_safe((u8 *) in_buf, src_len,

/* When the input data is not compressed at all,
* lzo1x_decompress_safe will fail, so call memcpy()
* instead */
if (unlikely(dst_len == src_len))
memcpy(out_buf, in_buf, src_len);
else {
r = lzo1x_decompress_safe((u8 *) in_buf, src_len,
out_buf, &tmp);

if (r != LZO_E_OK || dst_len != tmp) {
error("Compressed data violation");
goto exit_2;
if (r != LZO_E_OK || dst_len != tmp) {
error("Compressed data violation");
goto exit_2;
}
}

obytes_processed += dst_len;
if (flush)
flush(out_buf, dst_len);
if (output)
Expand All @@ -196,14 +203,15 @@ STATIC inline int INIT unlzo(u8 *input, int in_len,
in_buf += src_len;
}

ret = 0;
exit_2:
if (!input)
free(in_buf);
exit_1:
if (!output)
free(out_buf);
exit:
return obytes_processed;
return ret;
}

#define decompress unlzo

0 comments on commit ddf7e58

Please sign in to comment.