X-Git-Url: https://git.llucax.com/z.facultad/75.06/emufs.git/blobdiff_plain/fd6fd64c670641da85e91b3e4c9416bc18ad49e6..486448a2814cb0c4c8b9f455e51191b0c3592ccf:/emufs_gui/registros.c diff --git a/emufs_gui/registros.c b/emufs_gui/registros.c index 2dde456..aa9c867 100644 --- a/emufs_gui/registros.c +++ b/emufs_gui/registros.c @@ -85,11 +85,8 @@ void ver_registros(WINDOW *padre, int w, int h) indices_actual = 0; if (indices) { - fprintf(stderr, "LEO REGISTRO %lu\n", indices[indices_actual]); data = (char *)fp->leer_registro_raw(fp, indices[indices_actual], &size, &pos_actual); - fprintf(stderr, "Data leida %p (%s)\n",data, data); data = procesar(fp, data, &size, &pos_actual, &ancho_registro); - fprintf(stderr, "Tamanio = %lu\n", size); } @@ -306,7 +303,7 @@ char *procesar_registro_articulo_tipo3(EMUFS *emu, char *ptr, EMUFS_REG_SIZE *si (*ancho) = (*size); } memset(tmp1, '.', (*size)-(tmp1-salida)); - salida[*size] = '\0'; + salida[*size-1] = '\0'; return salida; } @@ -337,10 +334,12 @@ char *procesar_registro_articulo_tipo1(EMUFS *emu, char *ptr, EMUFS_REG_SIZE *si } else { cant_header++; offset += curr_size; + fprintf(stderr, "Sume %lu\n", curr_size); } - } while (offset < (*size)); + } while (offset+sizeof(EMUFS_REG_SIZE)+sizeof(EMUFS_REG_ID) < (*size)); /* Proceso */ + fprintf(stderr, "Cantidad de headers = %d\n", cant_header); salida = (char *)malloc((*size)-sizeof(unsigned int)*cant_header*3 + 3*cant_header*10+1); tmp = ptr; tmp1 = salida; @@ -370,7 +369,9 @@ char *procesar_registro_articulo_tipo1(EMUFS *emu, char *ptr, EMUFS_REG_SIZE *si sprintf(tmp1, "[%08d]", *((unsigned int *)tmp)); tmp1 += 10; tmp += sizeof(unsigned int); - j = sizeof(unsigned int);; + j = sizeof(unsigned int); + PERR("Voy aca"); + fprintf(stderr, "son %lu\n", curr_size); while (j < curr_size) { if (*tmp == '\0') { if (ant == (*tmp)) @@ -385,13 +386,14 @@ char *procesar_registro_articulo_tipo1(EMUFS *emu, char *ptr, EMUFS_REG_SIZE *si tmp1++; j++; } + PERR("Y hasta todo bien"); i++; } /* Tengo que trabajar sobre lo que me falte (seguro es espacio libre) */ (*size) = (*size)-sizeof(unsigned int)*cant_header*3+3*cant_header*10+1; memset(tmp1, '.', (*size)-(tmp1-salida)); free(ptr); - salida[*size] = '\0'; + salida[*size-1] = '\0'; return salida; }