#include "statichuff/statichuff.h"
#include "blocksorting/bs.h"
#include "mtf/mtf.h"
+#include "vfile/vfile.h"
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
int *mtf;
char *salida, *data, c;
data = malloc(sizeof(char)*pagesize);
- salida = malloc(sizeof(char)*(pagesize));
+ /* Reservo lugar tambien para guardar el k */
+ salida = malloc(sizeof(char)*(pagesize)+sizeof(unsigned long int));
bs = bs_create(pagesize);
fp = fopen(argv[optind], "rb");
fp_out = fopen("tmp.comp", "wb");
/* Hago el BS */
bs_solve(data, salida, bs, &k, i);
/* Le aplico el MTF */
- mtf = jacu_mtf(salida, i);
+ mtf = jacu_mtf(salida, i+sizeof(unsigned long int));
for(j=0; j<i; j++)
fputc(mtf[j], fp_out);
}
fclose(fp);
fclose(fp_out);
bs_destroy(bs);
- i = shuff_encode_file("tmp.comp",argv[optind+1],volumesize);
+ i = shuff_encode_file("tmp.comp",argv[optind+1], volumesize);
/* borro el temporal */
unlink("tmp.comp");
return i;