From 944e932662366e98b4b313ffaba0b1d00984a24b Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Mon, 15 Feb 2016 14:22:03 -0500 Subject: [svn-r29119] Converted HDoff_t to off_t in test/external.c. Fixes Windows errors. Tested on: 64-bit Ubuntu 15.10 w/ gcc 5.2.1 64-bit Windows 10 w/ VS2015 --- test/external.c | 230 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 114 insertions(+), 116 deletions(-) diff --git a/test/external.c b/test/external.c index a37dc94..181f43b 100644 --- a/test/external.c +++ b/test/external.c @@ -17,7 +17,7 @@ * Programmer: Robb Matzke * Tuesday, March 3, 1998 * - * Purpose: Tests datasets stored in external raw files. + * Purpose: Tests datasets stored in external raw files. */ #include "h5test.h" @@ -35,7 +35,7 @@ const char *FILENAME[] = { * Purpose: Determines whether two files contain the same data. * * Return: Success: nonzero if same, zero if different. - * Failure: zero + * Failure: zero * * Programmer: Robb Matzke * Wednesday, March 4, 1998 @@ -45,9 +45,9 @@ const char *FILENAME[] = { static hbool_t files_have_same_contents(const char *name1, const char *name2) { - int fd1 = 0, fd2 = 0; - ssize_t n1, n2; - char buf1[1024], buf2[1024]; + int fd1 = 0, fd2 = 0; + ssize_t n1, n2; + char buf1[1024], buf2[1024]; hbool_t ret = false; /* not equal until proven otherwise */ if((fd1 = HDopen(name1, O_RDONLY, 0666)) < 0) @@ -105,15 +105,15 @@ out: static int test_non_extendible(hid_t file) { - hid_t dcpl = -1; /* dataset creation properties */ - hid_t space = -1; /* data space */ - hid_t dset = -1; /* dataset */ - hsize_t cur_size[1]; /* data space current size */ - hsize_t max_size[1]; /* data space maximum size */ - int n; /* number of external files */ - char name[256]; /* external file name */ - HDoff_t file_offset; /* external file offset */ - hsize_t file_size; /* sizeof external file segment */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* data space */ + hid_t dset = -1; /* dataset */ + hsize_t cur_size[1]; /* data space current size */ + hsize_t max_size[1]; /* data space maximum size */ + int n; /* number of external files */ + char name[256]; /* external file name */ + off_t file_offset; /* external file offset */ + hsize_t file_size; /* sizeof external file segment */ haddr_t dset_addr; /* address of dataset */ TESTING("fixed-size data space, exact storage"); @@ -122,7 +122,7 @@ test_non_extendible(hid_t file) if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR cur_size[0] = max_size[0] = 100; - if(H5Pset_external(dcpl, "ext1.data", (HDoff_t)0, (hsize_t)(max_size[0] * sizeof(int))) < 0) + if(H5Pset_external(dcpl, "ext1.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int))) < 0) FAIL_STACK_ERROR if((space = H5Screate_simple(1, cur_size, max_size)) < 0) FAIL_STACK_ERROR @@ -203,7 +203,7 @@ test_non_extendible(hid_t file) * Return: Success: 0 * Failure: 1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, November 23, 1998 * *------------------------------------------------------------------------- @@ -211,18 +211,18 @@ test_non_extendible(hid_t file) static int test_too_small(hid_t file) { - hid_t dcpl = -1; /* dataset creation properties */ - hid_t space = -1; /* data space */ - hid_t dset = -1; /* dataset */ - hsize_t cur_size[1]; /* current data space size */ - hsize_t max_size[1]; /* maximum data space size */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* data space */ + hid_t dset = -1; /* dataset */ + hsize_t cur_size[1]; /* current data space size */ + hsize_t max_size[1]; /* maximum data space size */ TESTING("external storage is too small"); if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR cur_size[0] = max_size[0] = 100; - if(H5Pset_external(dcpl, "ext1.data", (HDoff_t)0, (hsize_t)(max_size[0] * sizeof(int) - 1)) < 0) + if(H5Pset_external(dcpl, "ext1.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int) - 1)) < 0) FAIL_STACK_ERROR if((space = H5Screate_simple(1, cur_size, max_size)) < 0) FAIL_STACK_ERROR @@ -257,10 +257,10 @@ test_too_small(hid_t file) * represent the current data and large enough to represent the * eventual size of the data. * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, November 23, 1998 * *------------------------------------------------------------------------- @@ -268,11 +268,11 @@ test_too_small(hid_t file) static int test_large_enough_current_eventual(hid_t file) { - hid_t dcpl = -1; /* dataset creation properties */ - hid_t space = -1; /* data space */ - hid_t dset = -1; /* dataset */ - hsize_t cur_size[1]; /* current data space size */ - hsize_t max_size[1]; /* maximum data space size */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* data space */ + hid_t dset = -1; /* dataset */ + hsize_t cur_size[1]; /* current data space size */ + hsize_t max_size[1]; /* maximum data space size */ TESTING("extendible dataspace, exact external size"); @@ -280,7 +280,7 @@ test_large_enough_current_eventual(hid_t file) FAIL_STACK_ERROR cur_size[0] = 100; max_size[0] = 200; - if(H5Pset_external(dcpl, "ext1.data", (HDoff_t)0, (hsize_t)(max_size[0] * sizeof(int))) < 0) + if(H5Pset_external(dcpl, "ext1.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int))) < 0) FAIL_STACK_ERROR if((space = H5Screate_simple(1, cur_size, max_size)) < 0) FAIL_STACK_ERROR @@ -321,11 +321,11 @@ error: static int test_large_enough_current_not_eventual(hid_t file) { - hid_t dcpl = -1; /* dataset creation properties */ - hid_t space = -1; /* data space */ - hid_t dset = -1; /* dataset */ - hsize_t cur_size[1]; /* current data space size */ - hsize_t max_size[1]; /* maximum data space size */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* data space */ + hid_t dset = -1; /* dataset */ + hsize_t cur_size[1]; /* current data space size */ + hsize_t max_size[1]; /* maximum data space size */ TESTING("extendible dataspace, external storage is too small"); @@ -333,7 +333,7 @@ test_large_enough_current_not_eventual(hid_t file) FAIL_STACK_ERROR cur_size[0] = 100; max_size[0] = 200; - if(H5Pset_external(dcpl, "ext1.data", (HDoff_t)0, (hsize_t)(max_size[0] * sizeof(int) - 1)) < 0) + if(H5Pset_external(dcpl, "ext1.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int) - 1)) < 0) FAIL_STACK_ERROR if((space = H5Screate_simple(1, cur_size, max_size)) < 0) FAIL_STACK_ERROR @@ -377,22 +377,22 @@ test_large_enough_current_not_eventual(hid_t file) static int test_unlimited(hid_t file) { - hid_t dcpl = -1; /* dataset creation properties */ - hid_t space = -1; /* data space */ - hid_t dset = -1; /* dataset */ - hsize_t cur_size[1]; /* data space current size */ - hsize_t max_size[1]; /* data space maximum size */ - int n; /* number of external files */ - char name[256]; /* external file name */ - HDoff_t file_offset; /* external file offset */ - hsize_t file_size; /* sizeof external file segment */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* data space */ + hid_t dset = -1; /* dataset */ + hsize_t cur_size[1]; /* data space current size */ + hsize_t max_size[1]; /* data space maximum size */ + int n; /* number of external files */ + char name[256]; /* external file name */ + off_t file_offset; /* external file offset */ + hsize_t file_size; /* sizeof external file segment */ TESTING("unlimited dataspace, unlimited external storage"); /* Create dataset */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR - if(H5Pset_external(dcpl, "ext1.data", (HDoff_t)0, H5F_UNLIMITED) < 0) + if(H5Pset_external(dcpl, "ext1.data", (off_t)0, H5F_UNLIMITED) < 0) FAIL_STACK_ERROR cur_size[0] = 100; max_size[0] = H5S_UNLIMITED; @@ -468,11 +468,11 @@ test_unlimited(hid_t file) static int test_multiple_files(hid_t file) { - hid_t dcpl = -1; /* dataset creation properties */ - hid_t space = -1; /* dataspace */ - hid_t dset = -1; /* dataset */ - hsize_t cur_size[1]; /* data space current size */ - hsize_t max_size[1]; /* data space maximum size */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* dataspace */ + hid_t dset = -1; /* dataset */ + hsize_t cur_size[1]; /* data space current size */ + hsize_t max_size[1]; /* data space maximum size */ TESTING("multiple external files"); @@ -481,13 +481,13 @@ test_multiple_files(hid_t file) cur_size[0] = max_size[0] = 100; - if(H5Pset_external(dcpl, "ext1.data", (HDoff_t)0, (hsize_t)(max_size[0]*sizeof(int)/4)) < 0) + if(H5Pset_external(dcpl, "ext1.data", (off_t)0, (hsize_t)(max_size[0]*sizeof(int)/4)) < 0) FAIL_STACK_ERROR - if(H5Pset_external(dcpl, "ext2.data", (HDoff_t)0, (hsize_t)(max_size[0]*sizeof(int)/4)) < 0) + if(H5Pset_external(dcpl, "ext2.data", (off_t)0, (hsize_t)(max_size[0]*sizeof(int)/4)) < 0) FAIL_STACK_ERROR - if(H5Pset_external(dcpl, "ext3.data", (HDoff_t)0, (hsize_t)(max_size[0]*sizeof(int)/4)) < 0) + if(H5Pset_external(dcpl, "ext3.data", (off_t)0, (hsize_t)(max_size[0]*sizeof(int)/4)) < 0) FAIL_STACK_ERROR - if(H5Pset_external(dcpl, "ext4.data", (HDoff_t)0, (hsize_t)(max_size[0]*sizeof(int)/4)) < 0) + if(H5Pset_external(dcpl, "ext4.data", (off_t)0, (hsize_t)(max_size[0]*sizeof(int)/4)) < 0) FAIL_STACK_ERROR if((space = H5Screate_simple(1, cur_size, max_size)) < 0) FAIL_STACK_ERROR @@ -528,19 +528,19 @@ error: static int test_add_to_unlimited(void) { - hid_t dcpl = -1; /* dataset creation properties */ - herr_t status; /* function return status */ - int n; /* number of external files */ + hid_t dcpl = -1; /* dataset creation properties */ + herr_t status; /* function return status */ + int n; /* number of external files */ TESTING("external file following unlimited file"); if((dcpl = H5Pcreate (H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR - if(H5Pset_external(dcpl, "ext1.data", (HDoff_t)0, H5F_UNLIMITED) < 0) + if(H5Pset_external(dcpl, "ext1.data", (off_t)0, H5F_UNLIMITED) < 0) FAIL_STACK_ERROR H5E_BEGIN_TRY { - status = H5Pset_external(dcpl, "ext2.data", (HDoff_t)0, (hsize_t)100); + status = H5Pset_external(dcpl, "ext2.data", (off_t)0, (hsize_t)100); } H5E_END_TRY; if(status >= 0) FAIL_PUTS_ERROR(" H5Pset_external() succeeded when it should have failed."); @@ -579,18 +579,18 @@ test_add_to_unlimited(void) static int test_overflow(void) { - hid_t dcpl = -1; /* dataset creation properties */ - herr_t status; /* return status */ + hid_t dcpl = -1; /* dataset creation properties */ + herr_t status; /* return status */ TESTING("address overflow in external files"); if((dcpl=H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR - if(H5Pset_external(dcpl, "ext1.data", (HDoff_t)0, H5F_UNLIMITED-1) < 0) + if(H5Pset_external(dcpl, "ext1.data", (off_t)0, H5F_UNLIMITED-1) < 0) FAIL_STACK_ERROR H5E_BEGIN_TRY { - status = H5Pset_external(dcpl, "ext2.data", (HDoff_t)0, (hsize_t)100); + status = H5Pset_external(dcpl, "ext2.data", (off_t)0, (hsize_t)100); } H5E_END_TRY; if(status >= 0) FAIL_PUTS_ERROR(" H5Pset_external() succeeded when it should have failed."); @@ -624,21 +624,21 @@ test_overflow(void) static int test_read_file_set(hid_t fapl) { - hid_t file = -1; /* file to write to */ - hid_t dcpl = -1; /* dataset creation properties */ - hid_t space = -1; /* data space */ - hid_t dset = -1; /* dataset */ - hid_t grp = -1; /* group to emit diagnostics */ - int fd = -1; /* external file descriptors */ - size_t i, j; /* miscellaneous counters */ - hssize_t n; /* bytes of I/O */ - char filename[1024]; /* file names */ - int part[25], whole[100]; /* raw data buffers */ - hsize_t cur_size; /* current data space size */ - hid_t hs_space; /* hyperslab data space */ - hsize_t hs_start = 30; /* hyperslab starting offset */ - hsize_t hs_count = 25; /* hyperslab size */ - int temparray[10] = {0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f}; + hid_t file = -1; /* file to write to */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* data space */ + hid_t dset = -1; /* dataset */ + hid_t grp = -1; /* group to emit diagnostics */ + int fd = -1; /* external file descriptors */ + size_t i, j; /* miscellaneous counters */ + hssize_t n; /* bytes of I/O */ + char filename[1024]; /* file names */ + int part[25], whole[100]; /* raw data buffers */ + hsize_t cur_size; /* current data space size */ + hid_t hs_space; /* hyperslab data space */ + hsize_t hs_start = 30; /* hyperslab starting offset */ + hsize_t hs_count = 25; /* hyperslab size */ + int temparray[10] = {0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f}; TESTING("read external dataset"); @@ -674,10 +674,10 @@ test_read_file_set(hid_t fapl) /* Create the dataset */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR - if(H5Pset_external(dcpl, "extern_1a.raw", (HDoff_t)0, (hsize_t)sizeof part) < 0 || - H5Pset_external(dcpl, "extern_2a.raw", (HDoff_t)10, (hsize_t)sizeof part) < 0 || - H5Pset_external(dcpl, "extern_3a.raw", (HDoff_t)20, (hsize_t)sizeof part) < 0 || - H5Pset_external(dcpl, "extern_4a.raw", (HDoff_t)30, (hsize_t)sizeof part) < 0) + if(H5Pset_external(dcpl, "extern_1a.raw", (off_t)0, (hsize_t)sizeof part) < 0 || + H5Pset_external(dcpl, "extern_2a.raw", (off_t)10, (hsize_t)sizeof part) < 0 || + H5Pset_external(dcpl, "extern_3a.raw", (off_t)20, (hsize_t)sizeof part) < 0 || + H5Pset_external(dcpl, "extern_4a.raw", (off_t)30, (hsize_t)sizeof part) < 0) FAIL_STACK_ERROR cur_size = 100; if((space = H5Screate_simple(1, &cur_size, NULL)) < 0) @@ -709,7 +709,7 @@ test_read_file_set(hid_t fapl) for(i = hs_start; i