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);
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);