/* Comprimo */
FILE *fp;
Uint32 i, j, total, k;
- char *mtf;
- char *salida, *data;
- char *z;
+ unsigned char *mtf;
+ unsigned char *salida, *data;
+ unsigned char *z;
int z_len;
/* Preparo el compresor huffman */
if (mflag == 1) shuff_loadmodel(shuff,staticmodel);
/* Preparo el BS alocando mem para el K, el Block y su Size */
- data = malloc(sizeof(char)*pagesize);
- salida = malloc(sizeof(char)*pagesize+sizeof(Uint32)*2);
+ data = malloc(sizeof(unsigned char)*pagesize);
+ salida = malloc(sizeof(unsigned char)*pagesize+sizeof(Uint32)*2);
bs = bs_create(pagesize);
/* Abrimos el archivo a comprimir y encodeamos bloques */
if (dflag == 1) {
/* Descomprimo */
FILE *fp_out;
- FILE *fp_in;
+ /*FILE *fp_in;*/
Uint32 block_size, k;
- char *block, *mtf, *orig;
- char *z;
+ unsigned char *block, *mtf, *orig;
+ unsigned char *z;
int z_len,moredata = 0,decoded = 0;
/* Inicializo el descompresor */
moredata = shuff_decode_chunk(shuff,(char*)&block_size,sizeof(Uint32),&decoded);
if (block_size > 0) {
moredata = shuff_decode_chunk(shuff,(char*)&z_len,sizeof(int),&decoded);
- z = malloc(sizeof(char)*z_len);
+ z = malloc(sizeof(unsigned char)*z_len);
moredata = shuff_decode_chunk(shuff,z,z_len,&decoded);
/*printf("MTF Z (len=%d) = [", z_len);
}*/
- block = malloc(block_size*sizeof(char)+sizeof(Uint32));
- orig = malloc(block_size*sizeof(char));
+ block = malloc(block_size*sizeof(unsigned char)+sizeof(Uint32));
+ orig = malloc(block_size*sizeof(unsigned char));
moredata = shuff_decode_chunk(shuff,block,block_size+sizeof(Uint32),&decoded);
/*printf("Antes MTF_inv = [");
printf("]\n");
}*/
/* Hago el MTF inverso */
- mtf = jacu_mtf_inv(z, block, block_size*sizeof(char)+sizeof(Uint32));
+ mtf = jacu_mtf_inv(z, block, block_size*sizeof(unsigned char)+sizeof(Uint32));
/*printf("Luego de MTF Inv= [");
{
/*printf("Restored : k=%ld\n", k);*/
bs_restore(orig, mtf+sizeof(Uint32), k, block_size);
- fwrite(orig, block_size, sizeof(char), fp_out);
+ fwrite(orig, block_size, sizeof(unsigned char), fp_out);
free(block);
free(orig);
free(mtf);