summaryrefslogtreecommitdiffstats
path: root/test/external.c
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1998-04-07 15:34:16 (GMT)
committerRobb Matzke <matzke@llnl.gov>1998-04-07 15:34:16 (GMT)
commit68fa66bf8130d6a6e607e233da8cc61a154bf172 (patch)
treeb5a0e0120492c7bb9f935ab74f4cef97d6bbcbee /test/external.c
parent92571bbe1d77c74ddefeeba6ac0b2097593c058d (diff)
downloadhdf5-68fa66bf8130d6a6e607e233da8cc61a154bf172.zip
hdf5-68fa66bf8130d6a6e607e233da8cc61a154bf172.tar.gz
hdf5-68fa66bf8130d6a6e607e233da8cc61a154bf172.tar.bz2
[svn-r337] Changes since 19980403
---------------------- ./configure.in Moved setting of compiler warning switches earlier in the file. Turned on more warning switches to gcc. ./config/linux Prints a warning if the gcc version is less than 2.8.1 since that version has problems with register allocation for `long long'. ./html/Datatypes.html Documented sharing of data types between datasets. ./src/H5G.c ./src/H5Gpublic.h Implemented H5Gmove(), H5Glink() and H5Gunlink() for hard links. Still have soft links to do. ./src/H5AC.c ./src/H5ACprivate.h ./src/H5D.c ./src/H5E.c ./src/H5Eprivate.h ./src/H5F.c ./src/H5Farray.c ./src/H5Fcore.c ./src/H5Ffamily.c ./src/H5Fistore.c ./src/H5Flow.c ./src/H5Fprivate.h ./src/H5Fpublic.h ./src/H5Fsec2.c ./src/H5Fstdio.c ./src/H5G.c ./src/H5Gent.c ./src/H5Gnode.c ./src/H5Gpkg.h ./src/H5Gprivate.h ./src/H5HG.c ./src/H5HL.c ./src/H5HLprivate.h ./src/H5I.c ./src/H5Iprivate.h ./src/H5MM.c ./src/H5MMprivate.h ./src/H5O.c ./src/H5Oefl.c ./src/H5Oprivate.h ./src/H5Osdspace.c ./src/H5Oshared.c ./src/H5Ostab.c ./src/H5P.c ./src/H5S.c ./src/H5Ssimp.c ./src/H5T.c ./src/H5Tconv.c ./src/H5Tprivate.h ./src/H5Tpublic.h ./src/H5V.c ./src/H5Vprivate.h ./src/H5detect.c ./src/h5ls.c ./test/cmpd_dset.c ./test/dsets.c ./test/external.c ./test/hyperslab.c ./test/iopipe.c ./test/istore.c ./test/shtype.c ./test/tstab.c Fixed comparisons between signed and unsigned values. Fixed warnings about unused function arguments.
Diffstat (limited to 'test/external.c')
-rw-r--r--test/external.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/test/external.c b/test/external.c
index 1e0df7e..7f0ff23 100644
--- a/test/external.c
+++ b/test/external.c
@@ -15,6 +15,12 @@
#include <string.h>
#include <unistd.h>
+#include <H5config.h>
+#ifndef HAVE_ATTRIBUTE
+# undef __attribute__
+# define __attribute__(X) /*void*/
+#endif
+
static int nerrors_g = 0;
@@ -35,7 +41,7 @@ static int nerrors_g = 0;
*-------------------------------------------------------------------------
*/
static herr_t
-display_error_cb (void *client_data)
+display_error_cb (void *client_data __attribute__((unused)))
{
puts ("*FAILED*");
H5Eprint (stdout);
@@ -74,9 +80,12 @@ same_contents (const char *name1, const char *name2)
while (1) {
n1 = read (fd1, buf1, sizeof(buf1));
n2 = read (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, n1)) {
+ if (memcmp (buf1, buf2, (size_t)n1)) {
close (fd1);
close (fd2);
return 0;
@@ -480,7 +489,8 @@ test_2 (void)
{
hid_t file, plist, space, dset, grp;
herr_t status;
- int fd,i, j;
+ int fd;
+ unsigned i, j;
ssize_t n;
char fname[64];
int part[25], whole[100];
@@ -495,8 +505,8 @@ test_2 (void)
sprintf (fname, "extern_%d.raw", i+1);
fd = open (fname, O_RDWR|O_CREAT|O_TRUNC, 0666);
assert (fd>=0);
- n = lseek (fd, i*10, SEEK_SET);
- assert (n==i*10);
+ n = lseek (fd, (ssize_t)(i*10), SEEK_SET);
+ assert (n>=0 && (size_t)n==i*10);
n = write (fd, part, sizeof(part));
assert (n==sizeof(part));
close (fd);
@@ -550,7 +560,7 @@ test_2 (void)
}
for (i=0; i<100; i++) {
- if (whole[i]!=i) {
+ if (whole[i]!=(signed)i) {
puts ("*FAILED*");
puts (" Incorrect value(s) read.");
nerrors_g++;
@@ -596,7 +606,7 @@ test_2 (void)
#endif
for (i=hs_start; i<hs_start+hs_count; i++) {
- if (whole[i]!=i) {
+ if (whole[i]!=(signed)i) {
puts ("*FAILED*");
puts (" Incorrect value(s) read.");
nerrors_g++;
@@ -632,7 +642,8 @@ test_3 (void)
{
hid_t file, plist, mem_space, file_space, dset;
herr_t status;
- int i, fd;
+ unsigned i;
+ int fd;
int part[25], whole[100], hs_start=100;
size_t size=100, max_size=200, hs_count=100;