]> git.llucax.com Git - z.facultad/75.06/jacu.git/blobdiff - src/statichuff/statichuff.c
Fclose fix
[z.facultad/75.06/jacu.git] / src / statichuff / statichuff.c
index 000f0bab7f1c0820f1555f75e420c2d172e19d32..797ca1723446bf4eee23d9cf60d35649eb760caa 100644 (file)
@@ -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;