From a69203a95d66595b80891aafc1ca8a59303290d0 Mon Sep 17 00:00:00 2001 From: Samo Penic <samo.penic@gmail.com> Date: Fri, 18 Oct 2019 09:16:27 +0000 Subject: [PATCH] Debugged all the leaks. Decompression still not working --- src/io.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/io.c b/src/io.c index abd4fce..7a14447 100644 --- a/src/io.c +++ b/src/io.c @@ -255,16 +255,18 @@ fprintf(fh, " <UnstructuredGrid>\n"); fprintf(fh, "<Piece NumberOfPoints=\"%u\" NumberOfCells=\"%u\">\n",vlist->n+monono*polyno+fonono*filno, blist->n+monono*polyno+filno*(fonono-1)+vesicle->tlist->n); fprintf(fh,"<PointData Scalars=\"vertices_idx\">\n<DataArray type=\"Int64\" Name=\"vertices_idx\" format=\"binary\">"); - int *int_vector=(int *)malloc((vlist->n+monono*polyno+fonono*filno)*sizeof(ts_uint)); + long *int_vector=(long *)malloc((vlist->n+monono*polyno+fonono*filno)*sizeof(long)); +// sizes are as expected 4 bytes for int and 1 byte for char +// printf("size of ts_uint %ld, of int %ld, of char %ld",sizeof(ts_uint), sizeof(int), sizeof(char)); int offset=0; for(i=0;i<vlist->n;i++){ // fprintf(fh,"%u ",vtx[i]->idx); int_vector[i+offset]=vtx[i]->idx; } + offset=offset+i; //polymeres if(poly){ poly_idx=vlist->n; - offset=offset+i; for(i=0;i<vesicle->poly_list->n;i++){ for(j=0;j<vesicle->poly_list->poly[i]->vlist->n;j++,poly_idx++){ //fprintf(fh,"%u ", poly_idx); @@ -285,7 +287,8 @@ offset=offset+j; } } - char *printout=ts_compress_intlist(int_vector,(vlist->n+monono*polyno+fonono*filno)*sizeof(ts_uint)); + printf("Offset in the end is %d, should be %d",offset,(vlist->n+monono*polyno+fonono*filno) ); + char *printout=ts_compress((char *)int_vector,offset*sizeof(long), offset); fprintf(fh,"%s",printout); free(printout); -- Gitblit v1.9.3