From 77c2ec41cf1f72adbd11771ef0900e4edbec31f7 Mon Sep 17 00:00:00 2001 From: srn Date: Thu, 8 Sep 2005 09:37:06 +0000 Subject: [PATCH] Modified the way a size of INT32 dataset is calculated --- src/HDFPersist/HDFdatasetWrite.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/HDFPersist/HDFdatasetWrite.c b/src/HDFPersist/HDFdatasetWrite.c index 07dbefdd9..5bcb60585 100644 --- a/src/HDFPersist/HDFdatasetWrite.c +++ b/src/HDFPersist/HDFdatasetWrite.c @@ -44,7 +44,7 @@ hdf_err HDFdatasetWrite(hdf_idt id, void *val) hdf_err ret; #ifdef PCLINUX int isI32BE = 0; - int size; + int size = 0; #endif if ((datatype = H5Dget_type(id)) < 0) @@ -53,10 +53,21 @@ hdf_err HDFdatasetWrite(hdf_idt id, void *val) #ifdef PCLINUX if((H5Tget_class(datatype) == H5T_INTEGER) && (H5Tget_size(datatype) == 4)) { isI32BE = 1; /* See HDFdatasetCreate */ - size = (int)HDFdatasetGetSize(id) / 4; + + /*SRN : replaced the method of getting the size of INT32 dataset */ + int i, ndim = HDFdatasetGetnDim(id); + if(ndim < 0) return -1; + + hdf_size *dim = (hdf_size *) malloc(sizeof(hdf_size)*ndim); + if ((ret == HDFdatasetGetDim(id, dim)) < 0) return -1; + + for(i=0; i