summaryrefslogtreecommitdiffstats
path: root/hl/src/H5DS.c
diff options
context:
space:
mode:
Diffstat (limited to 'hl/src/H5DS.c')
-rw-r--r--hl/src/H5DS.c16
1 files changed, 14 insertions, 2 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<buf[dim].len; i++)
+ for(i=0,n=0; i<(int)buf[dim].len; i++)
{
ref = ((hobj_ref_t *)buf[dim].p)[i];
if (ref) n++;
@@ -1837,4 +1847,6 @@ out:
return FAIL;
}
-#endif \ No newline at end of file
+#endif
+
+