X-Git-Url: https://git.llucax.com/z.facultad/75.06/emufs.git/blobdiff_plain/13e8a152bee88ed48a0987ddac713dd7cf525966..b345e9c1eaee7c09afb43b6983f34502cd8584e3:/emufs_gui/facturas.c?ds=sidebyside diff --git a/emufs_gui/facturas.c b/emufs_gui/facturas.c index a7fbb61..9e791cf 100644 --- a/emufs_gui/facturas.c +++ b/emufs_gui/facturas.c @@ -115,10 +115,10 @@ char *leer_nota(xmlNode *node) } if (tmp) { - salida = (char *)malloc(sizeof(char)*400); /*(strlen(XML_GET_CONTENT(tmp->children))+1));*/ + salida = (char *)malloc(sizeof(char)*(strlen(XML_GET_CONTENT(tmp->children))+1)); strcpy(salida, XML_GET_CONTENT(tmp->children)); } else { - salida = (char *)malloc(sizeof(char)*400); + salida = (char *)malloc(sizeof(char)); salida[0] = '\0'; } return salida; @@ -170,7 +170,7 @@ t_LstFacturas *fact_cargar(const char *filename, int tipo, int tam_bloque) cant_items = 0; } tmp->fp = emufs_crear("facturas", tipo-1, tam_bloque, sizeof(t_Factura)-sizeof(char *)-sizeof(t_Item*)+cant_items*sizeof(t_Item)); - tmp->fp_texto = emufs_crear("notas", 1, 420, 400); + tmp->fp_texto = emufs_crear("notas", 1, 100, 0); for (node=inicio ; node ; node = node->next) { if (node->type == XML_ELEMENT_NODE) { if (strcmp(node->name, "FACTURA") == 0) { @@ -195,7 +195,7 @@ t_LstFacturas *fact_cargar(const char *filename, int tipo, int tam_bloque) error = 0; id = tmp->fp->grabar_registro(tmp->fp, save, size, &error); error = 0; - id_texto = tmp->fp_texto->grabar_registro(tmp->fp_texto, fact.nota, 400, &error); + id_texto = tmp->fp_texto->grabar_registro(tmp->fp_texto, fact.nota, strlen(fact.nota)+1, &error); agregar_nodo_factura(tmp, crear_nodo_factura(id, id_texto, fact.numero)); if (fact.items) free(fact.items); if (fact.nota) free(fact.nota); @@ -543,6 +543,7 @@ void *procesar_guardar_factura(t_Factura *f, t_LstFacturas *lst, EMUFS_REG_SIZE (*size) = i[0]+i[1]+i[2]+i[3]+i[4]+i[5]+i[6]+i[7]+i[8]+i[9]+i[10]; tmp = (char *)malloc(*size); if (tmp == NULL) return NULL; + memset(tmp, 0, *size); /* Ahora copio la info */ memcpy(tmp, &f->numero, i[0]); memcpy(tmp, &f->procdoi, i[1]);