From 997392079b023bf366b62c17936d4ec305739be3 Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Fri, 22 Apr 2016 15:32:18 -0500 Subject: [svn-r29766] Description: - Changed object in catch statements to reference (left over from previous) Platforms tested: Linux/32 2.6 (jam) (very minor) --- c++/src/H5File.cpp | 2 +- c++/test/tfile.cpp | 14 ++++++++------ c++/test/th5s.cpp | 4 ++-- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp index e63694a..4602c6f 100644 --- a/c++/src/H5File.cpp +++ b/c++/src/H5File.cpp @@ -586,7 +586,7 @@ void H5File::p_setId(const hid_t new_id) try { close(); } - catch (Exception E) { + catch (Exception& E) { throw FileIException("H5File::p_setId", E.getDetailMsg()); } // reset object's id to the given id diff --git a/c++/test/tfile.cpp b/c++/test/tfile.cpp index 4ff15ce..763f9f0 100644 --- a/c++/test/tfile.cpp +++ b/c++/test/tfile.cpp @@ -131,7 +131,7 @@ static void test_file_create() // Should FAIL but didn't, so throw an invalid action exception throw InvalidActionException("H5File constructor", "File already exists."); } - catch( FileIException E ) // catching creating existing file + catch (FileIException& E) // catching creating existing file {} // do nothing, FAIL expected // Test create with H5F_ACC_TRUNC. This will truncate the existing file. @@ -145,7 +145,7 @@ static void test_file_create() // Should FAIL but didn't, so throw an invalid action exception throw InvalidActionException("H5File constructor", "H5F_ACC_TRUNC attempt on an opened file."); } - catch( FileIException E ) // catching truncating opened file + catch (FileIException& E) // catching truncating opened file {} // do nothing, FAIL expected // Try with H5F_ACC_EXCL. This should fail too because the file already @@ -156,7 +156,7 @@ static void test_file_create() // Should FAIL but didn't, so throw an invalid action exception throw InvalidActionException("H5File constructor", "H5F_ACC_EXCL attempt on an existing file."); } - catch( FileIException E ) // catching H5F_ACC_EXCL on existing file + catch (FileIException& E) // catching H5F_ACC_EXCL on existing file {} // do nothing, FAIL expected // Get the file-creation template @@ -336,7 +336,7 @@ static void test_file_open() // Should FAIL but didn't, so throw an invalid action exception throw InvalidActionException("H5File constructor", "Attempt truncating an opened file."); } - catch( FileIException E ) // catching H5F_ACC_TRUNC on opened file + catch (FileIException& E) // catching H5F_ACC_TRUNC on opened file {} // do nothing, FAIL expected // Now, really close the file. @@ -353,7 +353,8 @@ static void test_file_open() PASSED(); } // end of try block - catch( Exception E ) { + catch (Exception& E) + { issue_fail_msg("test_file_open()", __LINE__, __FILE__, E.getCDetailMsg()); } } // test_file_open() @@ -411,7 +412,8 @@ static void test_file_size() PASSED(); } // end of try block - catch( Exception E ) { + catch (Exception& E) + { issue_fail_msg("test_file_size()", __LINE__, __FILE__, E.getCDetailMsg()); } diff --git a/c++/test/th5s.cpp b/c++/test/th5s.cpp index 181c09f..7ef048b 100644 --- a/c++/test/th5s.cpp +++ b/c++/test/th5s.cpp @@ -178,7 +178,7 @@ static void test_h5s_basic() // Should FAIL but didn't, so throw an invalid action exception throw InvalidActionException("DataSpace constructor", "Library allowed overwrite of existing dataset"); } - catch( DataSpaceIException E ) // Simple data space with too many dims + catch (DataSpaceIException& E) // Simple data space with too many dims {} // do nothing, exception expected /* @@ -204,7 +204,7 @@ static void test_h5s_basic() // Should FAIL but didn't, so throw an invalid action exception throw InvalidActionException("H5File::openDataSet", "Opening a dataset with higher dimensionality than what the library can handle"); } - catch( FileIException E ) // catching higher dimensionality dataset + catch (FileIException& E) // catching higher dimensionality dataset {} // do nothing, exception expected // CHECK_I(ret, "H5Fclose"); // leave this here, later, fake a failure -- cgit v0.12