From 9bd8101460fbc92595e43bb90a72f5a25594556a Mon Sep 17 00:00:00 2001 From: Leandro Lucarella Date: Sun, 27 Jun 2004 01:35:08 +0000 Subject: [PATCH] Hack feo para que no se cuelgue en el fopen de fsize() con archivos multivolumen (opcion -t). --- src/jacu.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/jacu.c b/src/jacu.c index 556f621..b435e7b 100644 --- a/src/jacu.c +++ b/src/jacu.c @@ -22,7 +22,7 @@ typedef struct _flags_ { int mflag; } t_Flags; -int comprimir(char *src, char *dst, Uint32 pagesize, Uint32 volumensize, t_Flags *flags, char *staticmodel); +int comprimir(char *src, char *dst, Uint32 pagesize, Uint32 volumesize, t_Flags *flags, char *staticmodel); int descomprimir(char *src, char *dst); int main(int argc, char* argv[]) @@ -119,7 +119,9 @@ long fsize(const char* filename) FILE* file; long file_size; - if (!(file = fopen(filename, "r"))) return -1; + //printf("%s!!!\n", filename); + if (!(file = fopen(filename, "ab"))) return -1; + //printf("Abrio!\n"); file_size = ftell(file); fclose(file); return file_size; @@ -199,7 +201,7 @@ int comprimir(char *src, char *dst, Uint32 pagesize, Uint32 volumesize, t_Flags } /* Limpiando */ - fclose(fp); + if (fclose(fp)) fprintf(stderr, "Error al cerrar archivo de entrada!\n"); bs_destroy(bs); /* Comprimo con Huffman */ @@ -210,7 +212,9 @@ int comprimir(char *src, char *dst, Uint32 pagesize, Uint32 volumesize, t_Flags free(shuff); /* Muestro bpb */ - printf("%s: %.04f bits/byte.\n", dst, vfsize(dst)*8.0f/fsize(src)); + //printf("%s: %ld bytes.\n", src, fsize(src)); + //printf("%s: %ld bytes.\n", dst, vfsize(dst)); + printf("%s: %.04f bits/byte.\n", dst, 1.0/fsize(src)*vfsize(dst)*8.0f); return 0; } -- 2.43.0