From a18a17e772a91fd72384ef1fe02db7995bc2ec32 Mon Sep 17 00:00:00 2001 From: srn Date: Thu, 18 Aug 2005 10:59:59 +0000 Subject: [PATCH] BugID: IPAL9619, modified a way to get the size of a dataset in case if the dataset has a type HDF_INT32 --- 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..e3727a812 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 : bug IPAL9619: 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