diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2005-05-23 20:44:22 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2005-05-23 20:44:22 (GMT) |
commit | af15547dfe42bf296d368199dcc4a0f380ca9485 (patch) | |
tree | f3544a0fa786d3918cf6eb725b3897affa6f25a7 /test/file_handle.c | |
parent | 7a9cd4ac49449056451ffeb830784508c78429d7 (diff) | |
download | hdf5-af15547dfe42bf296d368199dcc4a0f380ca9485.zip hdf5-af15547dfe42bf296d368199dcc4a0f380ca9485.tar.gz hdf5-af15547dfe42bf296d368199dcc4a0f380ca9485.tar.bz2 |
[svn-r10789] Purpose:
Bug fix
Description:
Rearrange functions to make C++ compiler happy.
Platforms tested:
FreeBSD 4.11 (sleipnir) w/CC=g++
Outside of h5committest's scope.
Diffstat (limited to 'test/file_handle.c')
-rw-r--r-- | test/file_handle.c | 152 |
1 files changed, 76 insertions, 76 deletions
diff --git a/test/file_handle.c b/test/file_handle.c index 6a57cb4..701d2b0 100644 --- a/test/file_handle.c +++ b/test/file_handle.c @@ -195,6 +195,72 @@ error: /*------------------------------------------------------------------------- + * Function: test_family_opens + * + * Purpose: Private function for test_family() to tests wrong ways of + * reopening family file. + * + * Return: Success: exit(0) + * + * Failure: exit(1) + * + * Programmer: Raymond Lu + * Thursday, May 19, 2005 + * + * Modifications: + *------------------------------------------------------------------------- + */ +static herr_t +test_family_opens(char *fname, hid_t fa_pl) +{ + hid_t file; + char first_name[1024]; + char wrong_name[1024]; + int i; + + /* Case 1: reopen file with 1st member file name and default property list */ + sprintf(first_name, fname, 0); + + H5E_BEGIN_TRY { + file=H5Fopen(first_name, H5F_ACC_RDWR, H5P_DEFAULT); + } H5E_END_TRY; + + /* Case 2: reopen file with correct name template but default property list */ + H5E_BEGIN_TRY { + file=H5Fopen(fname, H5F_ACC_RDWR, H5P_DEFAULT); + } H5E_END_TRY; + + /* Case 3: reopen file with wrong member size */ + if(H5Pset_fapl_family(fa_pl, 128, H5P_DEFAULT)<0) + goto error; + + H5E_BEGIN_TRY { + file=H5Fopen(fname, H5F_ACC_RDWR, fa_pl); + } H5E_END_TRY; + + /* Case 4: reopen file with wrong name template */ + strcpy(wrong_name, fname); + for(i=0; i<1024; i++) { + if(wrong_name[i] == '5') { + wrong_name[i] = '4'; + break; + } + } + + if(H5Pset_fapl_family(fa_pl, FAMILY_SIZE, H5P_DEFAULT)<0) + goto error; + + H5E_BEGIN_TRY { + file=H5Fopen(wrong_name, H5F_ACC_RDWR, fa_pl); + } H5E_END_TRY; + + return 0; +error: + return -1; +} + + +/*------------------------------------------------------------------------- * Function: test_family * * Purpose: Tests the file handle interface for FAMILY driver @@ -355,10 +421,10 @@ error: /*------------------------------------------------------------------------- - * Function: test_family_opens + * Function: test_multi_opens * - * Purpose: Private function for test_family() to tests wrong ways of - * reopening family file. + * Purpose: Private function for test_multi() to tests wrong ways of + * reopening multi file. * * Return: Success: exit(0) * @@ -371,47 +437,18 @@ error: *------------------------------------------------------------------------- */ static herr_t -test_family_opens(char *fname, hid_t fa_pl) +test_multi_opens(char *fname, hid_t fa_pl) { hid_t file; - char first_name[1024]; - char wrong_name[1024]; - int i; - - /* Case 1: reopen file with 1st member file name and default property list */ - sprintf(first_name, fname, 0); - - H5E_BEGIN_TRY { - file=H5Fopen(first_name, H5F_ACC_RDWR, H5P_DEFAULT); - } H5E_END_TRY; - - /* Case 2: reopen file with correct name template but default property list */ - H5E_BEGIN_TRY { - file=H5Fopen(fname, H5F_ACC_RDWR, H5P_DEFAULT); - } H5E_END_TRY; - - /* Case 3: reopen file with wrong member size */ - if(H5Pset_fapl_family(fa_pl, 128, H5P_DEFAULT)<0) - goto error; - - H5E_BEGIN_TRY { - file=H5Fopen(fname, H5F_ACC_RDWR, fa_pl); - } H5E_END_TRY; - - /* Case 4: reopen file with wrong name template */ - strcpy(wrong_name, fname); - for(i=0; i<1024; i++) { - if(wrong_name[i] == '5') { - wrong_name[i] = '4'; - break; - } - } + char super_name[1024]; /*name string "%%s-s.h5"*/ + char sf_name[1024]; /*name string "multi_file-s.h5"*/ - if(H5Pset_fapl_family(fa_pl, FAMILY_SIZE, H5P_DEFAULT)<0) - goto error; + /* Case: reopen with the name of super file and default property list */ + sprintf(super_name, "%%s-%c.h5", 's'); + sprintf(sf_name, super_name, fname); H5E_BEGIN_TRY { - file=H5Fopen(wrong_name, H5F_ACC_RDWR, fa_pl); + file=H5Fopen(sf_name, H5F_ACC_RDWR, H5P_DEFAULT); } H5E_END_TRY; return 0; @@ -586,43 +623,6 @@ error: /*------------------------------------------------------------------------- - * Function: test_multi_opens - * - * Purpose: Private function for test_multi() to tests wrong ways of - * reopening multi file. - * - * Return: Success: exit(0) - * - * Failure: exit(1) - * - * Programmer: Raymond Lu - * Thursday, May 19, 2005 - * - * Modifications: - *------------------------------------------------------------------------- - */ -static herr_t -test_multi_opens(char *fname, hid_t fa_pl) -{ - hid_t file; - char super_name[1024]; /*name string "%%s-s.h5"*/ - char sf_name[1024]; /*name string "multi_file-s.h5"*/ - - /* Case: reopen with the name of super file and default property list */ - sprintf(super_name, "%%s-%c.h5", 's'); - sprintf(sf_name, super_name, fname); - - H5E_BEGIN_TRY { - file=H5Fopen(sf_name, H5F_ACC_RDWR, H5P_DEFAULT); - } H5E_END_TRY; - - return 0; -error: - return -1; -} - - -/*------------------------------------------------------------------------- * Function: main * * Purpose: Tests the file handle interface(H5Fget_vfd_handle and |