diff options
author | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2009-10-04 05:27:26 (GMT) |
---|---|---|
committer | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2009-10-04 05:27:26 (GMT) |
commit | a7cf6ea11ad76b6ed14944653259067b94afbfcf (patch) | |
tree | b1f3e9aec47a9476afa53c19d4e156e17ac98b60 /c++ | |
parent | c26ed138a65b2840c057e437fa061a4749ba7ea1 (diff) | |
download | hdf5-a7cf6ea11ad76b6ed14944653259067b94afbfcf.zip hdf5-a7cf6ea11ad76b6ed14944653259067b94afbfcf.tar.gz hdf5-a7cf6ea11ad76b6ed14944653259067b94afbfcf.tar.bz2 |
[svn-r17588] Purpose:
Fixed bugzilla #1061
Description:
Added a check for NULL before accessing a pointer
Also, removed a few warnings about returning values
Platforms tested:
Linux/32 2.6 (jam)
FreeBSD/64 6.3 (liberty)
SunOS 5.10 (linew)
Diffstat (limited to 'c++')
-rw-r--r-- | c++/src/H5Object.cpp | 5 | ||||
-rw-r--r-- | c++/src/H5PredType.cpp | 1 |
2 files changed, 3 insertions, 3 deletions
diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp index 329b128..9245635 100644 --- a/c++/src/H5Object.cpp +++ b/c++/src/H5Object.cpp @@ -214,7 +214,7 @@ int H5Object::iterateAttrs( attr_operator_t user_op, unsigned *_idx, void *op_da userData->object = this; // call the C library routine H5Aiterate2 to iterate the attributes - hsize_t idx = (hsize_t)*_idx; + hsize_t idx = _idx ? (hsize_t)*_idx : 0; int ret_value = H5Aiterate2(getId(), H5_INDEX_NAME, H5_ITER_INC, &idx, userAttrOpWrpr, (void *) userData); @@ -223,7 +223,8 @@ int H5Object::iterateAttrs( attr_operator_t user_op, unsigned *_idx, void *op_da if( ret_value >= 0 ) { /* Pass back update index value to calling code */ - *_idx = (unsigned)idx; + if (_idx) + *_idx = (unsigned)idx; return( ret_value ); } diff --git a/c++/src/H5PredType.cpp b/c++/src/H5PredType.cpp index 2ec3ba5..347f02f 100644 --- a/c++/src/H5PredType.cpp +++ b/c++/src/H5PredType.cpp @@ -289,7 +289,6 @@ void PredType::commit( H5Object& loc, const H5std_string& name ) bool PredType::committed() { throw DataTypeIException("PredType::committed", "Error: Attempting to check for commit status on a predefined datatype." ); - return (0); } #endif // DOXYGEN_SHOULD_SKIP_THIS |