[svn-r25632] Purpose: Fixed HDFFV-8852

Description:
    H5F_ACC_CREAT was included in the C++ API while the C library doesn't
    allow it yet.  Possibly, in the future, but not now.  In addition, the
    two flags H5F_ACC_RDONLY and H5F_ACC_RDWR were missing from the
    documentation, causing confusion that appending is not supported.
Solution:
    - Removed H5F_ACC_CREAT from the function until the C library support it
    - Added H5F_ACC_RDONLY and H5F_ACC_RDWR to the comments to update the
      documentation
Platforms tested:
    Linux/ppc64 (ostrich)
    Linux/32 2.6 (jam)
    SunOS 5.11 (emu)
This commit is contained in:
Binh-Minh Ribler 2014-09-29 15:52:08 -05:00
parent 9140500b86
commit 0befe65753
5 changed files with 14 additions and 5 deletions

View File

@ -69,6 +69,10 @@ H5File::H5File() : H5Location(), id(0) {}
/// the file.
/// \li \c H5F_ACC_EXCL - Fail if file already exists.
/// \c H5F_ACC_TRUNC and \c H5F_ACC_EXCL are mutually exclusive
/// \li \c H5F_ACC_RDONLY - Open file as read-only, if it already
/// exists, and fail, otherwise
/// \li \c H5F_ACC_RDWR - Open file for read/write, if it already
/// exists, and fail, otherwise
/// \li \c H5F_ACC_DEBUG - print debug information. This flag is
/// used only by HDF5 library developers; it is neither
/// tested nor supported for use in applications.
@ -121,12 +125,15 @@ H5File::H5File( const H5std_string& name, unsigned int flags, const FileCreatPro
// This function is private and contains common code between the
// constructors taking a string or a char*
// Programmer Binh-Minh Ribler - 2000
// Modification
// - removed H5F_ACC_CREAT because H5Fcreate will fail with
// H5F_ACC_CREAT. - BMR, Sep 17, 2014
//--------------------------------------------------------------------------
void H5File::p_get_file(const char* name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist)
{
// These bits only set for creation, so if any of them are set,
// create the file.
if( flags & (H5F_ACC_CREAT|H5F_ACC_EXCL|H5F_ACC_TRUNC|H5F_ACC_DEBUG))
if( flags & (H5F_ACC_EXCL|H5F_ACC_TRUNC|H5F_ACC_DEBUG))
{
hid_t create_plist_id = create_plist.getId();
hid_t access_plist_id = access_plist.getId();
@ -147,6 +154,7 @@ void H5File::p_get_file(const char* name, unsigned int flags, const FileCreatPro
}
}
}
#endif // DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------

View File

@ -1083,6 +1083,7 @@ void test_dset()
// Close the file before testing data size.
file.close();
nerrors += test_datasize(fapl) <0 ? 1:0;
}
catch (Exception E)

View File

@ -622,7 +622,7 @@ extern "C"
void test_file()
{
// Output message about test being performed
MESSAGE(5, ("Testing File I/O operations\n"));
MESSAGE(5, ("Testing File I/O Operations\n"));
test_file_create(); // Test file creation (also creation templates)
test_file_open(); // Test file opening

View File

@ -317,7 +317,7 @@ static void test_h5s_scalar_read()
SUBTEST("Scalar Dataspace Reading");
try {
// Create file
// Open file
H5File fid1(DATAFILE, H5F_ACC_RDWR);
// Create a dataset
@ -506,7 +506,7 @@ static void test_h5s_compound_scalar_read()
// Output message about test being performed
SUBTEST("Compound Dataspace Reading");
try {
// Create file
// Open file
H5File fid1(DATAFILE, H5F_ACC_RDWR);
// Create a dataset

View File

@ -15,7 +15,7 @@
/*****************************************************************************
FILE
tlinks.cpp - HDF5 C++ testing functionalities associated with the
C attribute interface (H5L)
C link interface (H5L)
***************************************************************************/