From ceb75f0efdcca01cb415e9ab8c2d4752709064d1 Mon Sep 17 00:00:00 2001 From: Pedro Vicente Nunes Date: Tue, 15 Feb 2005 16:45:25 -0500 Subject: [svn-r10012] Purpose: new tests Description: added more tests to DS (check if parameters IDs are valid) Solution: Platforms tested: linux solaris Misc. update: --- hl/src/H5DS.c | 16 ++++++++++-- hl/test/test_ds.c | 76 +++++++++++++++++++++++++++++++++++-------------------- 2 files changed, 63 insertions(+), 29 deletions(-) diff --git a/hl/src/H5DS.c b/hl/src/H5DS.c index 8b5c7c3..3d147d2 100644 --- a/hl/src/H5DS.c +++ b/hl/src/H5DS.c @@ -111,6 +111,7 @@ herr_t H5DSattach_scale(hid_t did, hobj_ref_t ref; /* reference to the DS */ hvl_t *buf; /* VL buffer to store in the attribute */ H5G_stat_t sb1, sb2; + H5I_type_t it1, it2; int i, len; /*------------------------------------------------------------------------- @@ -133,6 +134,15 @@ herr_t H5DSattach_scale(hid_t did, if (sb1.fileno==sb2.fileno && sb1.objno==sb2.objno) return FAIL; + /* get ID type */ + if ((it1 = H5Iget_type(did))<0) + return FAIL; + if ((it2 = H5Iget_type(dsid))<0) + return FAIL; + + if (H5I_DATASET!=it1 || H5I_DATASET!=it2) + return FAIL; + /*------------------------------------------------------------------------- * The dataset may or may not have the associated DS attribute * First we try to open to see if it is already there; if not, it is created. @@ -1376,7 +1386,7 @@ herr_t H5DSget_nscales(hid_t did, if (H5Aread(aid,tid,buf)<0) goto out; - for(i=0,n=0; i