summaryrefslogtreecommitdiffstats
path: root/c++/src/H5Object.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'c++/src/H5Object.cpp')
-rw-r--r--c++/src/H5Object.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp
index 494ee2c..b3b2982 100644
--- a/c++/src/H5Object.cpp
+++ b/c++/src/H5Object.cpp
@@ -235,14 +235,12 @@ int H5Object::iterateAttrs( attr_operator_t user_op, unsigned *_idx, void *op_da
//--------------------------------------------------------------------------
int H5Object::getNumAttrs() const
{
- int num_attrs = H5Aget_num_attrs( id );
- if( num_attrs < 0 )
- {
- throw AttributeIException(inMemFunc("getNumAttrs"),
- "H5Aget_num_attrs failed - returned negative number of attributes");
- }
+ H5O_info_t oinfo; /* Object info */
+
+ if(H5Oget_info(id, ".", &oinfo, H5P_DEFAULT) < 0)
+ throw AttributeIException(inMemFunc("getNumAttrs"), "H5Oget_info failed");
else
- return( num_attrs );
+ return( (int)oinfo.num_attrs );
}
//--------------------------------------------------------------------------