diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2012-09-13 17:08:01 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2012-09-13 17:08:01 (GMT) |
commit | 602c716f76f3d4623ac24419dd8419a2a1817aaa (patch) | |
tree | 145b2ec66dfa8923e06c96a574e5d9fa8c650d32 /c++/src/H5CommonFG.cpp | |
parent | 0ffdaff795a6811146b86e14b40f7aa57b0ce39d (diff) | |
download | hdf5-602c716f76f3d4623ac24419dd8419a2a1817aaa.zip hdf5-602c716f76f3d4623ac24419dd8419a2a1817aaa.tar.gz hdf5-602c716f76f3d4623ac24419dd8419a2a1817aaa.tar.bz2 |
[svn-r22758] Description:
Bring generic improvements from encode/decode property list branch to
the trunk. This includes a better version of the property list comparison
routine, cleaned up compiler warnings, and some cleaned up property list
callbacks. Also, started on changes to clean up parallel test output, so that
it doesn't report successful tests from each process.
Tested on:
Mac OSX/64 10.7.4 (amazon) w/debug, GCC 4.7.x, FORTRAN, C++, threadsafe and parallel
Linux 2.6/32 (jam) w/debug
Solaris 2.7/64 (linew) w/debug
Diffstat (limited to 'c++/src/H5CommonFG.cpp')
-rw-r--r-- | c++/src/H5CommonFG.cpp | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp index 6a8609f..dcc331f 100644 --- a/c++/src/H5CommonFG.cpp +++ b/c++/src/H5CommonFG.cpp @@ -68,25 +68,29 @@ namespace H5 { //-------------------------------------------------------------------------- Group CommonFG::createGroup( const char* name, size_t size_hint ) const { - // Create group creation property list for size_hint - hid_t gcpl_id = H5Pcreate(H5P_GROUP_CREATE); - - // If the creation of the property list failed, throw an exception - if( gcpl_id < 0 ) - throwException("createGroup", "H5Pcreate failed"); + // Group creation property list for size_hint + hid_t gcpl_id = 0; // Set the local heap size hint - if( H5Pset_local_heap_size_hint(gcpl_id, size_hint) < 0) { - H5Pclose(gcpl_id); - throwException("createGroup", "H5Pset_local_heap_size failed"); - } + if(!(size_hint == (size_t)-1 || size_hint == 0)) { + + // If the creation of the property list failed, throw an exception + if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) + throwException("createGroup", "H5Pcreate failed"); + + if( H5Pset_local_heap_size_hint(gcpl_id, size_hint) < 0) { + H5Pclose(gcpl_id); + throwException("createGroup", "H5Pset_local_heap_size failed"); + } + } // Call C routine H5Gcreate2 to create the named group, giving the // location id which can be a file id or a group id hid_t group_id = H5Gcreate2( getLocId(), name, H5P_DEFAULT, gcpl_id, H5P_DEFAULT ); - // Close the group creation property list - H5Pclose(gcpl_id); + // Close the group creation property list, if necessary + if(gcpl_id > 0) + H5Pclose(gcpl_id); // If the creation of the group failed, throw an exception if( group_id < 0 ) |