]> git.llucax.com Git - z.facultad/75.06/jacu.git/commitdiff
BUGFIX : se estaba guardando mal el pagesize
authorRicardo Markiewicz <gazer.arg@gmail.com>
Tue, 22 Jun 2004 19:37:30 +0000 (19:37 +0000)
committerRicardo Markiewicz <gazer.arg@gmail.com>
Tue, 22 Jun 2004 19:37:30 +0000 (19:37 +0000)
src/jacu.c

index ba8daf1cdf4f47c23b2a2f71bcd507234821d2f6..d31c648505d8bbd2a63d52335df36992d5f85e46 100644 (file)
@@ -115,9 +115,20 @@ int main(int argc, char* argv[])
                        /* Hago el BS */
                        bs_solve(data, salida, bs, &k, i);
 
+                       printf("BS k=%ld\n", k);
+                       printf("PageSize = %ld\n", i);
+
                        /* Le aplico el MTF, salteo el tamaƱo del bloque para que no se pierda. */
                        mtf = jacu_mtf(salida+sizeof(Uint32), i+sizeof(Uint32), &z, &z_len);
 
+                       printf("MTF Z (len=%d) = [", z_len);
+                       {
+                               int ii;
+                               for(ii=0; ii<z_len; ii++)
+                                       printf("%c", z[ii]);
+                               printf("]\n");
+
+                       }
                        /* Si me lo piden, aplico ZG. */
                        if (zflag) {
                                size_t len;
@@ -131,7 +142,7 @@ int main(int argc, char* argv[])
                                /* Guardo el PageSize */
                                //for(j=0; j<sizeof(Uint32); j++)
                                //      fputc(mtf[j], fp_out);
-                               fwrite(mtf, sizeof(Uint32), 1, fp_out);
+                               fwrite(&i, sizeof(Uint32), 1, fp_out);
 
                                /* Guardo el Z len y el Z */
                                fwrite(&z_len, sizeof(int), 1, fp_out);
@@ -178,10 +189,19 @@ int main(int argc, char* argv[])
                        block_size = 0;
                        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) {
                                block = malloc(block_size*sizeof(char)+sizeof(Uint32));
                                orig = malloc(block_size*sizeof(char));
@@ -193,6 +213,7 @@ int main(int argc, char* argv[])
                                /* Luego de hacer el MTF inverso ya puedo recuperar el k */
                                memcpy(&k, block, sizeof(Uint32));
 
+                               printf("Restored : k=%ld\n", k);
                                bs_restore(orig, block+sizeof(Uint32), k, block_size);
 
                                fwrite(orig, block_size, sizeof(char), fp_out);