X-Git-Url: https://git.camperquake.de/gitweb.cgi?a=blobdiff_plain;f=module%2Fzfs%2Flzjb.c;h=ad9e423f836d25ef88e24287cb0daf040f0939cf;hb=eaa8687be33318ae07d61a91e0069244b326f450;hp=10952f472b333c8e2d208410bb4d6230c3a82e0a;hpb=428870ff734fdaccc342b33fc53cf94724409a46;p=zfs.git diff --git a/module/zfs/lzjb.c b/module/zfs/lzjb.c index 10952f4..ad9e423 100644 --- a/module/zfs/lzjb.c +++ b/module/zfs/lzjb.c @@ -20,12 +20,11 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. */ /* - * We keep our own copy of this algorithm for 2 main reasons: + * We keep our own copy of this algorithm for 3 main reasons: * 1. If we didn't, anyone modifying common/os/compress.c would * directly break our on disk format * 2. Our version of lzjb does not have a number of checks that the @@ -33,8 +32,8 @@ * 3. We initialize the lempel to ensure deterministic results, * so that identical blocks can always be deduplicated. * In particular, we are adding the "feature" that compress() can - * take a destination buffer size and return -1 if the data will not - * compress to d_len or less. + * take a destination buffer size and returns the compressed length, or the + * source length if compression would overflow the destination buffer. */ #include @@ -51,7 +50,7 @@ lzjb_compress(void *s_start, void *d_start, size_t s_len, size_t d_len, int n) { uchar_t *src = s_start; uchar_t *dst = d_start; - uchar_t *cpy, *copymap; + uchar_t *cpy, *copymap = NULL; int copymask = 1 << (NBBY - 1); int mlen, offset, hash; uint16_t *hp; @@ -100,7 +99,7 @@ lzjb_decompress(void *s_start, void *d_start, size_t s_len, size_t d_len, int n) uchar_t *src = s_start; uchar_t *dst = d_start; uchar_t *d_end = (uchar_t *)d_start + d_len; - uchar_t *cpy, copymap; + uchar_t *cpy, copymap = 0; int copymask = 1 << (NBBY - 1); while (dst < d_end) {