X-Git-Url: https://git.llucax.com/z.facultad/75.06/jacu.git/blobdiff_plain/2e29fc7e9a20173cb2e58bb93a72bca5e57a912d..4c56e227e8a6bf6acb612b95a66f39b2abb7faca:/src/statichuff/statichuff.c diff --git a/src/statichuff/statichuff.c b/src/statichuff/statichuff.c index 000f0ba..797ca17 100644 --- a/src/statichuff/statichuff.c +++ b/src/statichuff/statichuff.c @@ -70,7 +70,7 @@ int shuff_scanfreq_chunk(HUFF_STATE *chunkshuff, char* chunk, int chunksize) int i = 0; unsigned char symbol = 0; - /* Contamos las frecuencias del chunk a menos que se use un canonico */ + /* Contamos las frecuencias del chunk a menos que se use un canonico */ if (!chunkshuff->canonic) { for (i = 0; i < chunksize; ++i) { symbol = chunk[i]; @@ -189,7 +189,7 @@ void shuff_printcodes(SHUFFCODE *codetable,t_freq *freqtable) for (i = 0; i < 256; ++i) { if (codetable[i].codelength > 0) { auxcode = codetable[i].code; - printf("Symbol:%i Freq: %li Code:",i,freqtable[i]); + printf("Symbol:%i Freq: %lu Code:",i,freqtable[i]); for (j = codetable[i].codelength-1; j >= 0; --j) { auxcode = codetable[i].code; auxcode = auxcode >> j; @@ -237,7 +237,10 @@ int shuff_encode_symbols(HUFF_STATE *shuff, SHUFFCODE *ctable) SHUFFCODE symbolcode; /* Abrimos el source y el destino */ - if (shuff->coderfp != NULL) fclose(shuff->coderfp); /* close bychunk temp file */ + if (shuff->coderfp != NULL) { + fclose(shuff->coderfp); /* close bychunk temp file */ + shuff->coderfp = NULL; + } if ((fpsource = fopen(shuff->sourcefile,"r")) == NULL) return 0; if ((fpdest = vfopen(shuff->targetfile,"w",shuff->volsize)) == NULL) return 0;