From 5e319027652b1187c509953f0f9bb80269244c51 Mon Sep 17 00:00:00 2001 From: Robb Matzke Date: Fri, 2 Apr 1999 08:59:10 -0500 Subject: [svn-r1171] Changes since 19990330 ---------------------- ./src/H5A.c ./src/H5D.c The `bkg' buffers are zeroed before calling the type conversion function. This fixes a problem where reading a file compound data structure into memory results in garbage between the members. ./src/H5I.c Fixed H5I_clear_group() so it removes entries even when a free callback is not registered. This fixes fixes an `infinite loop closing library' warning message. ./src/H5.c Added ellipses to the end of the infinite loop message. --- src/H5.c | 2 +- src/H5A.c | 2 ++ src/H5D.c | 10 +++++++--- src/H5I.c | 30 ++++++++++++++---------------- 4 files changed, 24 insertions(+), 20 deletions(-) diff --git a/src/H5.c b/src/H5.c index ea6b476..093d0cc 100644 --- a/src/H5.c +++ b/src/H5.c @@ -167,7 +167,7 @@ H5_term_library(void) } while (pending && ntries++<100); if (pending) { fprintf(stderr, "HDF5: infinite loop closing library\n"); - fprintf(stderr, " %s\n", loop); + fprintf(stderr, " %s...\n", loop); } /* Mark library as closed */ diff --git a/src/H5A.c b/src/H5A.c index 68b9173..624a9fd 100644 --- a/src/H5A.c +++ b/src/H5A.c @@ -640,6 +640,7 @@ H5A_write(H5A_t *attr, const H5T_t *mem_type, void *buf) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); } + HDmemset(bkg_buf, 0, buf_size); /* Copy the user's data into the buffer for conversion */ HDmemcpy(tconv_buf,buf,src_type_size*nelmts); @@ -807,6 +808,7 @@ H5A_read(H5A_t *attr, const H5T_t *mem_type, void *buf) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); } + HDmemset(bkg_buf, 0, buf_size); /* Copy the attribute data into the buffer for conversion */ HDmemcpy(tconv_buf,attr->data,src_type_size*nelmts); diff --git a/src/H5D.c b/src/H5D.c index 623d57a..656b7a5 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -1720,7 +1720,9 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, if (n!=smine_nelmts) { HGOTO_ERROR (H5E_IO, H5E_READERROR, FAIL, "mem gather failed"); } - } + } else if (need_bkg) { + HDmemset(bkg_buf, 0, request_nelmts*dst_type_size); + } #ifdef QAK printf("%s: check 7.0\n",FUNC); @@ -2084,8 +2086,10 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "file gather failed"); } - } - + } else if (need_bkg) { + HDmemset(bkg_buf, 0, request_nelmts*dst_type_size); + } + /* * Perform data type conversion. */ diff --git a/src/H5I.c b/src/H5I.c index 75bb5c9..b7e73b5 100644 --- a/src/H5I.c +++ b/src/H5I.c @@ -403,26 +403,24 @@ H5I_clear_group(H5I_type_t grp) * counts. Ignore the return value from from the free method and remove * object from group regardless. */ - if (grp_ptr->free_func) { - for (i=0; ihash_size; i++) { - for (cur=grp_ptr->id_list[i]; cur; cur=next) { - /* Free the object regardless of reference count */ - if ((grp_ptr->free_func)(cur->obj_ptr)<0) { + for (i=0; ihash_size; i++) { + for (cur=grp_ptr->id_list[i]; cur; cur=next) { + /* Free the object regardless of reference count */ + if (grp_ptr->free_func && (grp_ptr->free_func)(cur->obj_ptr)<0) { #if H5I_DEBUG - if (H5DEBUG(I)) { - fprintf(H5DEBUG(I), "H5I: free grp=%d obj=0x%08lx " - "failure ignored\n", (int)grp, - (unsigned long)(cur->obj_ptr)); - } -#endif /*H5I_DEBUG*/ + if (H5DEBUG(I)) { + fprintf(H5DEBUG(I), "H5I: free grp=%d obj=0x%08lx " + "failure ignored\n", (int)grp, + (unsigned long)(cur->obj_ptr)); } - - /* Add ID struct to free list */ - next = cur->next; - H5I_release_id_node(cur); +#endif /*H5I_DEBUG*/ } - grp_ptr->id_list[i]=NULL; + + /* Add ID struct to free list */ + next = cur->next; + H5I_release_id_node(cur); } + grp_ptr->id_list[i]=NULL; } done: -- cgit v0.12