]> git.llucax.com Git - z.facultad/75.06/jacu.git/blobdiff - src/jacu.c
DESCOMPRIME !!!!!!!!!!!!!!!!!!
[z.facultad/75.06/jacu.git] / src / jacu.c
index dd1848594c3646e6695129682e62212cad2d4ef4..f08e73136edd0389c01e0ea87f2ed4feaf6c20aa 100644 (file)
@@ -201,19 +201,20 @@ int main(int argc, char* argv[])
                        PERR("Leo bloque");
                        fread(&block_size, sizeof(Uint32), 1, fp_in);
                        printf("PageSize = %ld\n", block_size);
-                       fread(&z_len, sizeof(int), 1, fp_in);
-                       z = malloc(sizeof(char)*z_len);
-                       fread(z, z_len, sizeof(char), fp_in);
-
-                       printf("MTF Z (len=%d) = [", z_len);
-                       {
-                               int ii;
-                               for(ii=0; ii<z_len; ii++)
-                                       printf("(%c)", z[ii]);
-                               printf("]\n");
-
-                       }
                        if (block_size > 0) {
+                               fread(&z_len, sizeof(int), 1, fp_in);
+                               z = malloc(sizeof(char)*z_len);
+                               fread(z, z_len, sizeof(char), fp_in);
+
+                               printf("MTF Z (len=%d) = [", z_len);
+                               {
+                                       int ii;
+                                       for(ii=0; ii<z_len; ii++)
+                                               printf("(%c)", z[ii]);
+                                       printf("]\n");
+       
+                               }
+                               
                                block = malloc(block_size*sizeof(char)+sizeof(Uint32));
                                orig = malloc(block_size*sizeof(char));
                                fread(block, block_size+sizeof(Uint32), sizeof(char), fp_in);
@@ -243,7 +244,7 @@ int main(int argc, char* argv[])
 
                                printf("Restored : k=%ld\n", k);
                                PERR("BS_Restore");
-                               bs_restore(orig, block+sizeof(Uint32), k, block_size);
+                               bs_restore(orig, mtf+sizeof(Uint32), k, block_size);
 
                                PERR("Saving Data");
                                fwrite(orig, block_size, sizeof(char), fp_out);