diff options
author | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2016-03-08 12:23:54 (GMT) |
---|---|---|
committer | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2016-03-08 12:23:54 (GMT) |
commit | 116eed3ebd48bd96292af786a09bb67c124bb3e9 (patch) | |
tree | d1482a87cc7277c9705e5f53db16607fbe743e2a /c++/src/H5Location.cpp | |
parent | 1b7b09b08104f05a65a0269c5c88a342dba8e972 (diff) | |
download | hdf5-116eed3ebd48bd96292af786a09bb67c124bb3e9.zip hdf5-116eed3ebd48bd96292af786a09bb67c124bb3e9.tar.gz hdf5-116eed3ebd48bd96292af786a09bb67c124bb3e9.tar.bz2 |
[svn-r29340] Purpose: Code cleanup
Description:
- Removed many warnings:
warning: use of old-style cast
warning: enumeration value ‘H5D_VIRTUAL’ not handled in switch
warning: comparison between signed and unsigned
There are others of the same warnings and they will be taken care of
in the next release.
- Made some code reuse between overloads
Platforms tested:
Linux/32 2.6 (jam)
Linux/64 (platypus)
Darwin (osx1010test)
Diffstat (limited to 'c++/src/H5Location.cpp')
-rw-r--r-- | c++/src/H5Location.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp index b4c88ed..337aa6f 100644 --- a/c++/src/H5Location.cpp +++ b/c++/src/H5Location.cpp @@ -190,7 +190,7 @@ Attribute H5Location::openAttribute( const H5std_string& name ) const Attribute H5Location::openAttribute( const unsigned int idx ) const { hid_t attr_id = H5Aopen_by_idx(getId(), ".", H5_INDEX_CRT_ORDER, - H5_ITER_INC, (hsize_t)idx, H5P_DEFAULT, H5P_DEFAULT); + H5_ITER_INC, static_cast<hsize_t>(idx), H5P_DEFAULT, H5P_DEFAULT); if( attr_id > 0 ) { Attribute attr; @@ -232,7 +232,7 @@ int H5Location::iterateAttrs( attr_operator_t user_op, unsigned *_idx, void *op_ // call the C library routine H5Aiterate2 to iterate the attributes hsize_t idx = _idx ? (hsize_t)*_idx : 0; int ret_value = H5Aiterate2(getId(), H5_INDEX_NAME, H5_ITER_INC, &idx, - userAttrOpWrpr, (void *) userData); + userAttrOpWrpr, static_cast<void *>(userData)); // release memory delete userData; @@ -240,7 +240,7 @@ int H5Location::iterateAttrs( attr_operator_t user_op, unsigned *_idx, void *op_ if( ret_value >= 0 ) { /* Pass back update index value to calling code */ if (_idx) - *_idx = (unsigned)idx; + *_idx = static_cast<unsigned>(idx); return( ret_value ); } @@ -262,7 +262,7 @@ int H5Location::getNumAttrs() const if(H5Oget_info(getId(), &oinfo) < 0) throw AttributeIException(inMemFunc("getNumAttrs"), "H5Oget_info failed"); else - return( (int)oinfo.num_attrs ); + return(static_cast<int>(oinfo.num_attrs)); } //-------------------------------------------------------------------------- @@ -517,7 +517,7 @@ ssize_t H5Location::getComment(const char* name, size_t buf_size, char* comment) } // If the comment is longer than the provided buffer size, the C library // will not null terminate it - if ((size_t)comment_len >= buf_size) + if (static_cast<size_t>(comment_len) >= buf_size) comment[buf_size-1] = '\0'; // Return the actual comment length, which might be different from buf_size |