diff options
author | Scott Wegner <swegner@hdfgroup.org> | 2008-06-05 21:39:30 (GMT) |
---|---|---|
committer | Scott Wegner <swegner@hdfgroup.org> | 2008-06-05 21:39:30 (GMT) |
commit | 0b5f34bfa659d0cde87a1f120843f8003ee2a81b (patch) | |
tree | f0be04385aa11f4c7fd6c556d8ffaedf3b96bf60 /test | |
parent | 13cc35de119303658b5facaf993632a4a57b15a4 (diff) | |
download | hdf5-0b5f34bfa659d0cde87a1f120843f8003ee2a81b.zip hdf5-0b5f34bfa659d0cde87a1f120843f8003ee2a81b.tar.gz hdf5-0b5f34bfa659d0cde87a1f120843f8003ee2a81b.tar.bz2 |
[svn-r15160] Purpose: Separate Windows function macro definitions to win32defs.h
Description:
In library code, we try not to use system calls directly, but instead use the HD{function} macro instead. This way, we can map special versions of the call on particular systems. Previously, it was all done in H5private.h. However, in an effort to clean up platform-specific definitions, we move all of the Windows macros into a separate file, win32defs.h. This way, we can use the non-Posix versions that Visual Studio sends warnings about.
Some macros are set specifically in the platform-specific header files. Then, any macros left unset will be set by the "default" implementation in H5private.h.
This checkin also cleans up various source files to use the HD* macros when possible.
Tested:
VS2005 on WinXP
VS.NET on WinXP
h5committest (kagiso, linew, smirom)
Diffstat (limited to 'test')
-rw-r--r-- | test/dtypes.c | 4 | ||||
-rw-r--r-- | test/external.c | 30 | ||||
-rw-r--r-- | test/fillval.c | 4 | ||||
-rw-r--r-- | test/hyperslab.c | 18 |
4 files changed, 28 insertions, 28 deletions
diff --git a/test/dtypes.c b/test/dtypes.c index 6707d2e..3dc5338 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -1731,11 +1731,11 @@ test_compound_10(void) for(i=0; i<ARRAY_DIM; i++) { wdata[i].i1 = i*10+i; - wdata[i].str = strdup("C string A"); + wdata[i].str = HDstrdup("C string A"); wdata[i].str[9] += i; wdata[i].i2 = i*1000+i*10; - wdata[i].text.p = (void*)strdup("variable-length text A\0"); + wdata[i].text.p = (void*)HDstrdup("variable-length text A\0"); len = wdata[i].text.len = strlen((char*)wdata[i].text.p)+1; ((char*)(wdata[i].text.p))[len-2] += i; ((char*)(wdata[i].text.p))[len-1] = '\0'; diff --git a/test/external.c b/test/external.c index d05889e..6820543 100644 --- a/test/external.c +++ b/test/external.c @@ -56,26 +56,26 @@ same_contents (const char *name1, const char *name2) ssize_t n1, n2; char buf1[1024], buf2[1024]; - fd1 = open (name1, O_RDONLY); - fd2 = open (name2, O_RDONLY); + fd1 = HDopen(name1, O_RDONLY, 0666); + fd2 = HDopen(name2, O_RDONLY, 0666); assert (fd1>=0 && fd2>=0); while (1) { - n1 = read (fd1, buf1, sizeof(buf1)); - n2 = read (fd2, buf2, sizeof(buf2)); + n1 = HDread(fd1, buf1, sizeof(buf1)); + n2 = HDread(fd2, buf2, sizeof(buf2)); assert (n1>=0 && (size_t)n1<=sizeof(buf1)); assert (n2>=0 && (size_t)n2<=sizeof(buf2)); assert (n1==n2); if (n1<=0 && n2<=0) break; if (memcmp (buf1, buf2, (size_t)n1)) { - close (fd1); - close (fd2); + HDclose(fd1); + HDclose(fd2); return 0; } } - close (fd1); - close (fd2); + HDclose(fd1); + HDclose(fd2); return 1; } @@ -619,15 +619,15 @@ test_2 (hid_t fapl) part[j] = (int)(i*25+j); } sprintf (filename, "extern_%lua.raw", (unsigned long)i+1); - fd = HDopen (filename, O_RDWR|O_CREAT|O_TRUNC, 0666); + fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, 0666); assert (fd>=0); /* n = lseek (fd, (off_t)(i*10), SEEK_SET); */ - n = write(fd,temparray,(size_t)i*10); + n = HDwrite(fd,temparray,(size_t)i*10); assert (n>=0 && (size_t)n==i*10); - n = write (fd, part, sizeof(part)); + n = HDwrite(fd, part, sizeof(part)); assert (n==sizeof(part)); - close (fd); + HDclose(fd); } /* @@ -752,14 +752,14 @@ test_3 (hid_t fapl) /* Make sure the output files are fresh*/ for (i=1; i<=4; i++) { sprintf(filename, "extern_%db.raw", i); - if ((fd= open(filename, O_RDWR|O_CREAT|O_TRUNC, 0666)) < 0) { + if ((fd= HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, 0666)) < 0) { H5_FAILED(); printf(" cannot open %s: %s\n", filename, strerror(errno)); goto error; } - write(fd, temparray, (i-1)*10); - close (fd); + HDwrite(fd, temparray, (i-1)*10); + HDclose(fd); } /* Create the dataset */ diff --git a/test/fillval.c b/test/fillval.c index 2cf1191..29f37b4 100644 --- a/test/fillval.c +++ b/test/fillval.c @@ -1883,8 +1883,8 @@ test_extend(hid_t fapl, const char *base_name, H5D_layout_t layout) hsize_t nelmts; nelmts = max_size[0]*max_size[1]*max_size[2]*max_size[3]*max_size[4]; - if((fd=open(FILE_NAME_RAW, O_RDWR|O_CREAT|O_TRUNC, 0666)) < 0 || - close(fd) < 0) goto error; + if((fd=HDopen(FILE_NAME_RAW, O_RDWR|O_CREAT|O_TRUNC, 0666)) < 0 || + HDclose(fd) < 0) goto error; if(H5Pset_external(dcpl, FILE_NAME_RAW, (off_t)0, (hsize_t)nelmts*sizeof(int)) < 0) goto error; } diff --git a/test/hyperslab.c b/test/hyperslab.c index ab3ffab..89dbc5c 100644 --- a/test/hyperslab.c +++ b/test/hyperslab.c @@ -258,7 +258,7 @@ test_fill(size_t nx, size_t ny, size_t nz, if (acc != ref_value) { puts("*FAILED*"); - if (!isatty(1)) { + if (!HDisatty(1)) { /* * Print debugging info unless output * is going directly to a terminal. @@ -504,7 +504,7 @@ test_copy(int mode, } if (acc != ref_value) { puts("*FAILED*"); - if (!isatty(1)) { + if (!HDisatty(1)) { /* * Print debugging info unless output is * going directly to a terminal. @@ -547,7 +547,7 @@ test_copy(int mode, if (acc+(unsigned)dx*(unsigned)dy*(unsigned)dz != ref_value + nx*ny*nz) { puts("*FAILED*"); - if (!isatty(1)) { + if (!HDisatty(1)) { /* * Print debugging info unless output is * going directly to a terminal. @@ -675,7 +675,7 @@ test_multifill(size_t nx) } if (s[0]) { puts("*FAILED*"); - if (!isatty(1)) { + if (!HDisatty(1)) { AT(); printf(" fill={%d,%g,%d}\n ", fill.left, fill.mid, fill.right); @@ -757,7 +757,7 @@ test_endian(size_t nx) for (j = 0; j < 4; j++) { if (src[i * 4 + j] != dst[i * 4 + 3 - j]) { puts("*FAILED*"); - if (!isatty(1)) { + if (!HDisatty(1)) { /* * Print debugging info unless output is going directly * to a terminal. @@ -851,7 +851,7 @@ test_transpose(size_t nx, size_t ny) for (j = 0; j < ny; j++) { if (src[i * ny + j] != dst[j * nx + i]) { puts("*FAILED*"); - if (!isatty(1)) { + if (!HDisatty(1)) { AT(); printf(" diff at i=%lu, j=%lu\n", (unsigned long)i, (unsigned long)j); @@ -948,7 +948,7 @@ test_sub_super(size_t nx, size_t ny) for (j = 0; j < ny; j++) { if (full[4 * i * ny + 2 * j] != half[i * ny + j]) { puts("*FAILED*"); - if (!isatty(1)) { + if (!HDisatty(1)) { AT(); printf(" full[%lu][%lu] != half[%lu][%lu]\n", (unsigned long)i*2, @@ -1025,7 +1025,7 @@ test_sub_super(size_t nx, size_t ny) } if (s[0]) { puts("*FAILED*"); - if (!isatty(1)) { + if (!HDisatty(1)) { AT(); printf(" %s\n Half is:\n", s); print_array(half, nx, ny, (size_t)1); @@ -1409,7 +1409,7 @@ main(int argc, char *argv[]) if (nerrors) { printf("***** %d HYPERSLAB TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S"); - if (isatty(1)) { + if (HDisatty(1)) { printf("(Redirect output to a pager or a file to see " "debug output)\n"); } |