diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2009-07-27 22:36:04 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2009-07-27 22:36:04 (GMT) |
commit | 996c2f8d3bac0122fc3c7e5f592d296efc36f58a (patch) | |
tree | 40fe1d235f6442b3eb91c262ae0feb4f8c7a473e /c++/src/H5Attribute.cpp | |
parent | 2d7fcc8553c84291222bcc7c4f56c924246695c2 (diff) | |
download | hdf5-996c2f8d3bac0122fc3c7e5f592d296efc36f58a.zip hdf5-996c2f8d3bac0122fc3c7e5f592d296efc36f58a.tar.gz hdf5-996c2f8d3bac0122fc3c7e5f592d296efc36f58a.tar.bz2 |
[svn-r17245] Description:
Bring r17230:17244 from trunk to revise_chunks branch.
Tested on:
FreeBSD/32 6.3 (duty)
Mac OS X/32 10.5.7 (amazon)
Diffstat (limited to 'c++/src/H5Attribute.cpp')
-rw-r--r-- | c++/src/H5Attribute.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/c++/src/H5Attribute.cpp b/c++/src/H5Attribute.cpp index b1ab73e..6de5e63 100644 --- a/c++/src/H5Attribute.cpp +++ b/c++/src/H5Attribute.cpp @@ -198,35 +198,37 @@ void Attribute::read(const DataType& mem_type, H5std_string& strg) const //-------------------------------------------------------------------------- size_t Attribute::getInMemDataSize() const { + char *func = "Attribute::getInMemDataSize"; + // Get the data type of this attribute hid_t mem_type_id = H5Aget_type(id); - if (mem_type_id <= 0) + if( mem_type_id < 0 ) { - throw AttributeIException("Attribute::getInMemDataSize", "H5Aget_type failed"); + throw AttributeIException(func, "H5Aget_type failed"); } // Get the data type's size hid_t native_type = H5Tget_native_type(mem_type_id, H5T_DIR_DEFAULT); if (native_type < 0) { - throw AttributeIException("Attribute::getInMemDataSize", "H5Tget_native_type failed"); + throw AttributeIException(func, "H5Tget_native_type failed"); } size_t type_size = H5Tget_size(native_type); if (type_size == 0) { - throw AttributeIException("Attribute::getInMemDataSize", "H5Tget_size failed"); + throw AttributeIException(func, "H5Tget_size failed"); } // Get number of elements of the attribute hid_t space_id = H5Aget_space(id); if (space_id < 0) { - throw AttributeIException("Attribute::getInMemDataSize", "H5Aget_space failed"); + throw AttributeIException(func, "H5Aget_space failed"); } hssize_t num_elements = H5Sget_simple_extent_npoints(space_id); if (num_elements < 0) { - throw AttributeIException("Attribute::getInMemDataSize", "H5Sget_simple_extent_npoints failed"); + throw AttributeIException(func, "H5Sget_simple_extent_npoints failed"); } // Calculate and return the size of the data |