]> mj.ucw.cz Git - libucw.git/blobdiff - lib/lizard.c
Try to merge recent changes in v3.9 to image branch...
[libucw.git] / lib / lizard.c
index 6167fee043ba90c07befef746cd6bd917c5c21d7..10fd5f0c9fb2154d920cea743c4b77b23cb36db7 100644 (file)
@@ -35,7 +35,7 @@ hashf(byte *string)
 }
 
 static inline byte *
-locate_string(byte *string, uns record_id, uns head)
+locate_string(byte *string, int record_id, int head)
   /* The strings are recorded into the hash-table regularly, hence there is no
    * need to store the pointer there.  */
 {
@@ -177,7 +177,7 @@ lizard_compress(byte *in, uns in_len, byte *out)
   while (in < in_end)
   {
     uns hash = hashf(in);
-    byte *best;
+    byte *best = NULL;
     uns len = find_match(hash_tab[hash], hash_rec, in, in_end, &best, head);
     if (len < 3)
 #if 0                  // TODO: now, our routine does not detect matches of length 2
@@ -380,7 +380,8 @@ lizard_decompress(byte *in, byte *out)
     else
     {                                          /* overlapping */
       for (; len-- > 0; out++)
-       *out = out[-pos];
+       *out = *(out-pos);
+      /* It's tempting to use out[-pos] above, but unfortunately it's not the same */
     }
     /* extract the copy-bits */
     len = in[-2] & 0x3;