X-Git-Url: https://git.llucax.com/z.facultad/75.06/emufs.git/blobdiff_plain/27dcebf2414a7fe37fa130561d14d8bf29e9b12d..80aa04fe7756cf1670b51e01238b166d95eb43e4:/emufs_gui/articulos.c diff --git a/emufs_gui/articulos.c b/emufs_gui/articulos.c index 83b5fb8..150910e 100644 --- a/emufs_gui/articulos.c +++ b/emufs_gui/articulos.c @@ -60,15 +60,15 @@ int agregar_nodo_articulo(t_LstArticulos *lst, t_Reg_Articulo *nodo) return 1; } -t_LstArticulos *art_cargar(const char *filename, int tipo) +t_LstArticulos *art_cargar(const char *filename, int tipo, int tam_bloque) { xmlDocPtr document; xmlNode *node, *inicio; - int cant, error = 0, i; + int error = 0, i; EMUFS_REG_SIZE size; t_LstArticulos *tmp; lst_articulos = NULL; - EMUFS_REG_ID id; + EMUFS_REG_ID id, *indices, indices_cant; tmp = (t_LstArticulos *)malloc(sizeof(t_LstArticulos)); if (tmp == NULL) return NULL; @@ -94,7 +94,8 @@ t_LstArticulos *art_cargar(const char *filename, int tipo) node = node->next; } - tmp->fp = emufs_crear("articulos", tipo-1, sizeof(t_Articulo)*40+128, sizeof(t_Articulo)); + fprintf(stderr, "bloque = %d\n", tam_bloque); + tmp->fp = emufs_crear("articulos", tipo-1, tam_bloque, sizeof(t_Articulo)); for (node=inicio ; node ; node = node->next) { if (node->type == XML_ELEMENT_NODE) { if (strcmp(node->name, "ARTICULO") == 0) { @@ -122,18 +123,18 @@ t_LstArticulos *art_cargar(const char *filename, int tipo) } else { tmp->fp = emufs_abrir("articulos"); /* Ahora trato de recuperar la info */ - cant = emufs_idx_get_count(tmp->fp); - for(i=0; ifp, &indices_cant); + for(i=0; ifp, i); /* Leo el registro */ - save = tmp->fp->leer_registro(tmp->fp, id, &size, &error); + save = tmp->fp->leer_registro(tmp->fp, indices[i], &size, &error); if (procesar_leer_articulo(&art, save, size, tmp) == 1) { - agregar_nodo_articulo(tmp, crear_nodo_articulo(id, art.numero)); + agregar_nodo_articulo(tmp, crear_nodo_articulo(indices[i], art.numero)); free(save); } } + free(indices); } return tmp;