Skip to content

Commit

Permalink
Remove code paths where long long < 8 bytes (#3098)
Browse files Browse the repository at this point in the history
The C99 standard says that a long long is 8+ bytes. This change
removes a few parts of the code where we assume that a long long
could be less than that.
  • Loading branch information
derobins authored Jun 12, 2023
1 parent cedbc2e commit d1d6a21
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 31 deletions.
20 changes: 1 addition & 19 deletions test/big.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@
* [email protected]. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

/*
* Programmer: Robb Matzke
* Wednesday, April 8, 1998
* Modified: Albert Cheng
* September 11, 2010
*/
/*
* The purpose of this test is to verify if a virtual file driver can handle:
* a. Large file (2GB)
Expand Down Expand Up @@ -62,12 +56,6 @@

#define MAX_TRIES 100

#if H5_SIZEOF_LONG_LONG >= 8
#define GB8LL ((unsigned long long)8 * 1024 * 1024 * 1024)
#else
#define GB8LL 0 /*cannot do the test*/
#endif

/* Define Small, Large, Extra Large, Huge File which
* correspond to less than 2GB, 2GB, 4GB, and tens of GB file size.
* NO_FILE stands for "no file" to be tested.
Expand Down Expand Up @@ -330,7 +318,7 @@ static int
writer(char *filename, hid_t fapl, fsizes_t testsize, int wrt_n)
{
hsize_t size1[4] = {8, 1024, 1024, 1024};
hsize_t size2[1] = {GB8LL};
hsize_t size2[1] = {8LL * 1024LL * 1024LL * 1024LL};
hsize_t hs_start[1];
hsize_t hs_size[1];
hid_t file = -1, space1 = -1, space2 = -1, mem_space = -1, d1 = -1, d2 = -1;
Expand Down Expand Up @@ -689,12 +677,6 @@ test_family(hid_t fapl)
* because we would generate multi-gigabyte files.
*/
HDputs("Checking if file system is adequate for this test...");
if (sizeof(long long) < 8 || 0 == GB8LL) {
HDputs("Test skipped because sizeof(long long) is too small. This");
HDputs("hardware apparently doesn't support 64-bit integer types.");
usage();
goto quit;
}
if (!sparse_support) {
HDputs("Test skipped because file system does not support holes.");
usage();
Expand Down
15 changes: 3 additions & 12 deletions test/ntypes.c
Original file line number Diff line number Diff line change
Expand Up @@ -381,10 +381,7 @@ test_compound_dtype2(hid_t file)
#else
#error "Unknown 'long' size"
#endif
#if H5_SIZEOF_LONG_LONG == 4
if (H5Tinsert(tid2, "ll2", HOFFSET(s2, ll2), H5T_STD_I32BE) < 0)
TEST_ERROR;
#elif H5_SIZEOF_LONG_LONG == 8
#if H5_SIZEOF_LONG_LONG == 8
if (H5Tinsert(tid2, "ll2", HOFFSET(s2, ll2), H5T_STD_I64BE) < 0)
TEST_ERROR;
#else
Expand All @@ -397,10 +394,7 @@ test_compound_dtype2(hid_t file)
TEST_ERROR;
if (H5Tinsert(tid, "st", HOFFSET(s1, st), tid2) < 0)
TEST_ERROR;
#if H5_SIZEOF_LONG_LONG == 4
if (H5Tinsert(tid, "l", HOFFSET(s1, l), H5T_STD_U32BE) < 0)
TEST_ERROR;
#elif H5_SIZEOF_LONG_LONG == 8
#if H5_SIZEOF_LONG_LONG == 8
if (H5Tinsert(tid, "l", HOFFSET(s1, l), H5T_STD_U64BE) < 0)
TEST_ERROR;
#else
Expand Down Expand Up @@ -532,10 +526,7 @@ test_compound_dtype2(hid_t file)
TEST_ERROR;
if (H5Tget_order(mem_id) != H5Tget_order(H5T_NATIVE_LLONG))
TEST_ERROR;
#if H5_SIZEOF_LONG_LONG == 4
if (H5Tget_size(mem_id) < H5Tget_size(H5T_STD_I32LE))
TEST_ERROR;
#elif H5_SIZEOF_LONG_LONG == 8
#if H5_SIZEOF_LONG_LONG == 8
if (H5Tget_size(mem_id) < H5Tget_size(H5T_STD_I64LE))
TEST_ERROR;
#else
Expand Down

0 comments on commit d1d6a21

Please sign in to comment.