[svn-r15855] Purpose: Bring recent Windows-specific fixes from 1.8 branch to trunk

Description:
This checkin includes revisions 15845, 15846, and 15853 from the 1.8 branch.  From the svn log:

r15845:
Purpose: Add Windows-specific version of HDftruncate

Description:
Windows doesn't include a version of the system call ftruncate.  There is a similar call, _chsize_s, which performs very similarly.  Thus, we map HDftruncate to _chsize_s in our Windows header file, H5win32defs.h.

r15846:
Purpose: Declare loop variable at beginning of function

Description:
On Windows, we were getting compile errors because h5test.c includes a function with variable declarations in the middle of the call.  The Microsoft C compiler demands that all variables be declared at the top of the function.  This checkin simply moves the declaration to the top to satisfy Visual Studio.

r15853:
Purpose: Decrease size of points array in links test

Description:
In the external_set_elink_fapl2 links test, there is a large array of points which declared on the stack for testing.  Previously, the array was 1000 x 1000, which was too large for Visual Studio to handle.  As a result, we were getting stack overflows during the test.  We've reduced the number to 400, as this seems to be below the limit.  The exact number of points in the array isn't important to the test.

Tested:
VS2005 on WinXP
This commit is contained in:
Scott Wegner 2008-10-13 14:16:54 -05:00
parent 63d0b37133
commit c9d37a8e3f
3 changed files with 9 additions and 7 deletions

View File

@ -33,6 +33,7 @@ typedef __int64 h5_stat_size_t;
#define HDdup(F) _dup(F)
#define HDfdopen(N,S) _fdopen(N,S)
#define HDfileno(F) _fileno(F)
#define HDftruncate(F,L) _chsize_s(F,L)
#define HDfstat(F,B) _fstati64(F,B)
#define HDisatty(F) _isatty(F)
#define HDstat(S,B) _stati64(S,B)

View File

@ -854,6 +854,7 @@ h5_get_file_size(const char *filename, hid_t fapl)
{
char temp[2048]; /* Temporary buffer for file names */
h5_stat_t sb; /* Structure for querying file info */
int j = 0;
if(fapl == H5P_DEFAULT) {
/* Get the file's statistics */
@ -910,7 +911,7 @@ h5_get_file_size(const char *filename, hid_t fapl)
h5_stat_size_t tot_size = 0;
/* Try all filenames possible, until we find one that's missing */
for(int j = 0; /*void*/; j++) {
for(j = 0; /*void*/; j++) {
/* Create the filename to query */
HDsnprintf(temp, sizeof temp, filename, j);

View File

@ -82,7 +82,7 @@ const char *FILENAME[] = {
#define TMPDIR "tmp"
#define FAMILY_SIZE 1024
#define CORE_INCREMENT 1024
#define NUM1000 1000
#define NUM400 400
/* do not do check_all_closed() for "ext*" files and "tmp/ext*" */
#define EXTSTOP 12
@ -3698,7 +3698,7 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format)
cwdpath[NAME_BUF_SIZE];
hid_t core_fapl, space, dset, did, dapl_id, dcpl;
hsize_t dims[2];
int points[NUM1000][NUM1000];
int points[NUM400][NUM400];
h5_stat_size_t filesize, new_filesize;
int i, j, n;
@ -3734,8 +3734,8 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format)
if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, core_fapl)) < 0) TEST_ERROR
if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
dims[0] = NUM1000;
dims[1] = NUM1000;
dims[0] = NUM400;
dims[1] = NUM400;
if((space = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR
/* Create dataset creation property list */
@ -3781,8 +3781,8 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format)
}
/* Initialize the dataset */
for(i = n = 0; i < NUM1000; i++)
for(j = 0; j < NUM1000; j++)
for(i = n = 0; i < NUM400; i++)
for(j = 0; j < NUM400; j++)
points[i][j] = n++;
/* Write the data to the dataset */