]> git.llucax.com Git - z.facultad/75.06/jacu.git/commitdiff
DESCOMPRIME !!!!!!!!!!!!!!!!!!
authorRicardo Markiewicz <gazer.arg@gmail.com>
Wed, 23 Jun 2004 03:45:04 +0000 (03:45 +0000)
committerRicardo Markiewicz <gazer.arg@gmail.com>
Wed, 23 Jun 2004 03:45:04 +0000 (03:45 +0000)
src/blocksorting/bs.c
src/jacu.c

index b95b74b7612300475790dbe2ac61909b3bbf5769..0aff024908b0e4d3eddd8c2f88f55d8603fd9feb 100644 (file)
@@ -124,8 +124,11 @@ void bs_restore(char *dst, char *c, Uint32 k, Uint32 len)
        i=0;
        do {
                dst[i++] = in[current].c;
+               printf("(%c)", dst[i-1]);
                current = in[current].pos;
+               printf("[%d]", current);
        } while (current != k);
+       printf("\n");
        free(in);
 }
 
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);