summaryrefslogtreecommitdiffstats
path: root/test
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
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')
-rw-r--r--test/cmpd_dset.c125
-rw-r--r--test/dsets.c13
-rw-r--r--test/external.c27
-rw-r--r--test/hyperslab.c52
-rw-r--r--test/iopipe.c4
-rw-r--r--test/istore.c53
-rw-r--r--test/shtype.c8
-rw-r--r--test/tstab.c2
8 files changed, 162 insertions, 122 deletions
diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c
index cd36ca1..eae78d9 100644
--- a/test/cmpd_dset.c
+++ b/test/cmpd_dset.c
@@ -14,11 +14,11 @@
/* The first dataset */
typedef struct s1_t {
- int a;
- int b;
- int c;
- int d;
- int e;
+ unsigned int a;
+ unsigned int b;
+ unsigned int c;
+ unsigned int d;
+ unsigned int e;
} s1_t;
/* The second dataset (same as first) */
@@ -26,39 +26,39 @@ typedef s1_t s2_t;
/* The third dataset (reversed fields of s1) */
typedef struct s3_t {
- int e;
- int d;
- int c;
- int b;
- int a;
+ unsigned int e;
+ unsigned int d;
+ unsigned int c;
+ unsigned int b;
+ unsigned int a;
} s3_t;
/* The fourth dataset (a subset of s1) */
typedef struct s4_t {
- int b;
- int d;
+ unsigned int b;
+ unsigned int d;
} s4_t;
/* The fifth dataset (a superset of s1) */
typedef struct s5_t {
- int pre;
- int a;
- int b;
- int mid1;
- int c;
- int mid2;
- int d;
- int e;
- int post;
+ unsigned int pre;
+ unsigned int a;
+ unsigned int b;
+ unsigned int mid1;
+ unsigned int c;
+ unsigned int mid2;
+ unsigned int d;
+ unsigned int e;
+ unsigned int post;
} s5_t;
#if 1
-# define NX 100
-# define NY 2000
+# define NX 100u
+# define NY 2000u
#else
-# define NX 12
-# define NY 9
+# define NX 12u
+# define NY 9u
#endif
@@ -118,14 +118,16 @@ main (void)
/* Tenth dataset */
/* Eleventh dataset */
- s5_t *s11 = NULL;
+ s4_t *s11 = NULL;
/* Other variables */
- int i, j, ndims;
+ unsigned int i, j;
+ int ndims;
hid_t file, dataset, space, PRESERVE;
herr_t status;
static size_t dim[] = {NX, NY};
- int f_offset[2]; /*offset of hyperslab in file */
+ size_t f_offset[2]; /*offset of hyperslab in file */
+ int f_temp_offset[2];
size_t h_size[2]; /*size of hyperslab */
size_t h_sample[2]; /*hyperslab sampling */
@@ -396,7 +398,9 @@ STEP 8: Read middle third hyperslab into memory array.\n");
h_size[1] = 2*NY/3 - f_offset[1];
h_sample[0] = 1;
h_sample[1] = 1;
- status = H5Sset_hyperslab (s8_f_sid, f_offset, h_size, h_sample);
+ f_temp_offset[0] = (int)(f_offset[0]);
+ f_temp_offset[1] = (int)(f_offset[1]);
+ status = H5Sset_hyperslab (s8_f_sid, f_temp_offset, h_size, h_sample);
assert (status>=0);
/* Create memory data space */
@@ -436,8 +440,10 @@ STEP 8: Read middle third hyperslab into memory array.\n");
STEP 9: Read middle third of hyperslab into middle third of memory array.\n");
fflush (stdout);
- /* Initialize with some bit pattern */
- memset (s2, 0xFF, NX*NY*sizeof(s2_t));
+ /* Initialize */
+ for (i=0; i<NX*NY; i++) {
+ s2[i].a = s2[i].b = s2[i].c = s2[i].d = s2[i].e = (unsigned)(-1);
+ }
/* Read the hyperslab */
status = H5Dread (dataset, s2_tid, s8_f_sid, s8_f_sid, H5P_DEFAULT, s2);
@@ -456,11 +462,11 @@ STEP 9: Read middle third of hyperslab into middle third of memory array.\n");
assert (ps2->d == ps1->d);
assert (ps2->e == ps1->e);
} else {
- assert (ps2->a == -1);
- assert (ps2->b == -1);
- assert (ps2->c == -1);
- assert (ps2->d == -1);
- assert (ps2->e == -1);
+ assert (ps2->a == (unsigned)(-1));
+ assert (ps2->b == (unsigned)(-1));
+ assert (ps2->c == (unsigned)(-1));
+ assert (ps2->d == (unsigned)(-1));
+ assert (ps2->e == (unsigned)(-1));
}
}
}
@@ -475,8 +481,11 @@ STEP 10: Read middle third of hyperslab into middle third of memory array\n\
where some of the struct members are already initialized.\n");
fflush (stdout);
- /* Initialize with some bit pattern */
- memset (s5, 0xFF, NX*NY*sizeof(s5_t));
+ /* Initialize */
+ for (i=0; i<NX*NY; i++) {
+ s5[i].a = s5[i].b = s5[i].c = s5[i].d = s5[i].e = (unsigned)(-1);
+ s5[i].pre = s5[i].mid1 = s5[i].mid2 = s5[i].post = (unsigned)(-1);
+ }
/* Read the hyperslab */
status = H5Dread (dataset, s5_tid, s8_f_sid, s8_f_sid, PRESERVE, s5);
@@ -489,25 +498,25 @@ STEP 10: Read middle third of hyperslab into middle third of memory array\n\
s5_t *ps5 = s5 + i*NY + j;
if (i>=f_offset[0] && i<f_offset[0]+h_size[0] &&
j>=f_offset[1] && j<f_offset[1]+h_size[1]) {
- assert (ps5->pre == -1);
+ assert (ps5->pre == (unsigned)(-1));
assert (ps5->a == ps1->a);
assert (ps5->b == ps1->b);
- assert (ps5->mid1 == -1);
+ assert (ps5->mid1 == (unsigned)(-1));
assert (ps5->c == ps1->c);
- assert (ps5->mid2 == -1);
+ assert (ps5->mid2 == (unsigned)(-1));
assert (ps5->d == ps1->d);
assert (ps5->e == ps1->e);
- assert (ps5->post == -1);
+ assert (ps5->post == (unsigned)(-1));
} else {
- assert (ps5->pre == -1);
- assert (ps5->a == -1);
- assert (ps5->b == -1);
- assert (ps5->mid1 == -1);
- assert (ps5->c == -1);
- assert (ps5->mid2 == -1);
- assert (ps5->d == -1);
- assert (ps5->e == -1);
- assert (ps5->post == -1);
+ assert (ps5->pre == (unsigned)(-1));
+ assert (ps5->a == (unsigned)(-1));
+ assert (ps5->b == (unsigned)(-1));
+ assert (ps5->mid1 == (unsigned)(-1));
+ assert (ps5->c == (unsigned)(-1));
+ assert (ps5->mid2 == (unsigned)(-1));
+ assert (ps5->d == (unsigned)(-1));
+ assert (ps5->e == (unsigned)(-1));
+ assert (ps5->post == (unsigned)(-1));
}
}
}
@@ -523,11 +532,17 @@ STEP 11: Write an array back to the middle third of the dataset to\n\
fflush (stdout);
/* Create the memory array and initialize all fields to zero */
- ndims = H5Sget_hyperslab (s8_f_sid, f_offset, h_size, h_sample);
+ f_temp_offset[0] = (int)(f_offset[0]);
+ f_temp_offset[1] = (int)(f_offset[1]);
+ ndims = H5Sget_hyperslab (s8_f_sid, f_temp_offset, h_size, h_sample);
assert (ndims==2);
s11 = malloc (h_size[0]*h_size[1]*sizeof(s4_t));
assert (s11);
- memset (s11, 0xff, h_size[0]*h_size[1]*sizeof(s4_t));
+
+ /* Initialize */
+ for (i=0; i<h_size[0]*h_size[1]; i++) {
+ s11[i].b = s11[i].d = (unsigned)(-1);
+ }
/* Write to disk */
status = H5Dwrite (dataset, s4_tid, s8_m_sid, s8_f_sid, PRESERVE, s11);
@@ -547,8 +562,8 @@ STEP 11: Write an array back to the middle third of the dataset to\n\
assert (ps1->e == 5*(i*NY+j)+4);
if (i>=f_offset[0] && i<f_offset[0]+h_size[0] &&
j>=f_offset[1] && j<f_offset[1]+h_size[1]) {
- assert (ps1->b == -1);
- assert (ps1->d == -1);
+ assert (ps1->b == (unsigned)(-1));
+ assert (ps1->d == (unsigned)(-1));
} else {
assert (ps1->b == 5*(i*NY+j)+1);
assert (ps1->d == 5*(i*NY+j)+3);
diff --git a/test/dsets.c b/test/dsets.c
index eaca4a8..6f294f2 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -14,10 +14,17 @@
#include <stdlib.h>
#include <unistd.h>
+#include <H5config.h>
+#ifndef HAVE_ATTRIBUTE
+# undef __attribute__
+# define __attribute__(X) /*void*/
+#endif
+
#ifndef HAVE_FUNCTION
-#undef __FUNCTION__
-#define __FUNCTION__ ""
+# undef __FUNCTION__
+# define __FUNCTION__ ""
#endif
+
#define AT() printf (" at %s:%d in %s()...\n", \
__FILE__, __LINE__, __FUNCTION__);
@@ -44,7 +51,7 @@
*-------------------------------------------------------------------------
*/
static herr_t
-display_error_cb (void *client_data)
+display_error_cb (void *client_data __attribute__((unused)))
{
puts ("*FAILED*");
H5Eprint (stdout);
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;
diff --git a/test/hyperslab.c b/test/hyperslab.c
index 746be52..01e4fa6 100644
--- a/test/hyperslab.c
+++ b/test/hyperslab.c
@@ -45,13 +45,13 @@
static uintn
init_full(uint8 *array, size_t nx, size_t ny, size_t nz)
{
- int i, j, k;
+ size_t i, j, k;
uint8 acc = 128;
uintn total = 0;
- for (i = 0; i < nx; i++) {
- for (j = 0; j < ny; j++) {
- for (k = 0; k < nz; k++) {
+ for (i=0; i<nx; i++) {
+ for (j=0; j<ny; j++) {
+ for (k=0; k<nz; k++) {
total += acc;
*array++ = acc++;
}
@@ -77,22 +77,22 @@ init_full(uint8 *array, size_t nx, size_t ny, size_t nz)
static void
print_array(uint8 *array, size_t nx, size_t ny, size_t nz)
{
- int i, j, k;
+ size_t i, j, k;
- for (i = 0; i < nx; i++) {
- if (nz > 1) {
+ for (i=0; i<nx; i++) {
+ if (nz>1) {
printf("i=%d:\n", i);
} else {
printf("%03d:", i);
}
- for (j = 0; j < ny; j++) {
- if (nz > 1)
+ for (j=0; j<ny; j++) {
+ if (nz>1)
printf("%03d:", j);
- for (k = 0; k < nz; k++) {
+ for (k=0; k<nz; k++) {
printf(" %3d", *array++);
}
- if (nz > 1)
+ if (nz>1)
printf("\n");
}
printf("\n");
@@ -120,7 +120,7 @@ print_ref(size_t nx, size_t ny, size_t nz)
{
uint8 *array;
- array = H5MM_xcalloc(nx * ny * nz, sizeof(uint8));
+ array = H5MM_xcalloc((intn)(nx*ny*nz), sizeof(uint8));
printf("Reference array:\n");
init_full(array, nx, ny, nz);
@@ -154,7 +154,7 @@ test_fill(size_t nx, size_t ny, size_t nz,
size_t dst_offset[3]; /*offset of hyperslab in dest */
uintn ref_value; /*reference value */
uintn acc; /*accumulator */
- int i, j, k, dx, dy, dz; /*counters */
+ size_t i, j, k, dx, dy, dz; /*counters */
size_t u, v, w;
int ndims; /*hyperslab dimensionality */
char dim[64], s[256]; /*temp string */
@@ -183,7 +183,7 @@ test_fill(size_t nx, size_t ny, size_t nz,
fflush(stdout);
/* Allocate array */
- dst = H5MM_xcalloc(nx * ny * nz, 1);
+ dst = H5MM_xcalloc(1, nx*ny*nz);
init_full(dst, nx, ny, nz);
for (i = 0; i < nx; i += di) {
@@ -321,7 +321,7 @@ test_copy(int mode,
size_t src_offset[3]; /*offset of hyperslab in source */
uintn ref_value; /*reference value */
uintn acc; /*accumulator */
- int i, j, k, dx, dy, dz; /*counters */
+ size_t i, j, k, dx, dy, dz; /*counters */
size_t u, v, w;
int ndims; /*hyperslab dimensionality */
char dim[64], s[256]; /*temp string */
@@ -380,8 +380,8 @@ test_copy(int mode,
/*
* Allocate arrays
*/
- src = H5MM_xcalloc(nx * ny * nz, 1);
- dst = H5MM_xcalloc(nx * ny * nz, 1);
+ src = H5MM_xcalloc(1, nx*ny*nz);
+ dst = H5MM_xcalloc(1, nx*ny*nz);
init_full(src, nx, ny, nz);
for (i = 0; i < nx; i += di) {
@@ -571,9 +571,9 @@ test_copy(int mode,
*-------------------------------------------------------------------------
*/
static herr_t
-test_multifill(int nx)
+test_multifill(size_t nx)
{
- int i, j;
+ size_t i, j;
size_t size;
ssize_t src_stride;
ssize_t dst_stride;
@@ -690,7 +690,7 @@ test_endian(size_t nx)
ssize_t src_stride[2]; /*source strides */
ssize_t dst_stride[2]; /*destination strides */
size_t size[2]; /*size vector */
- int i, j;
+ size_t i, j;
printf("%-70s", "Testing endian conversion by stride");
fflush(stdout);
@@ -698,7 +698,7 @@ test_endian(size_t nx)
/* Initialize arrays */
src = H5MM_xmalloc(nx * 4);
init_full(src, nx, 4, 1);
- dst = H5MM_xcalloc(nx, 4);
+ dst = H5MM_xcalloc(4, nx);
/* Initialize strides */
src_stride[0] = 0;
@@ -766,7 +766,7 @@ test_transpose(size_t nx, size_t ny)
{
intn *src = NULL;
intn *dst = NULL;
- int i, j;
+ size_t i, j;
ssize_t src_stride[2], dst_stride[2];
size_t size[2];
char s[256];
@@ -783,7 +783,7 @@ test_transpose(size_t nx, size_t ny)
src[i * ny + j] = (intn)(i * ny + j);
}
}
- dst = H5MM_xcalloc(nx * ny, sizeof(*dst));
+ dst = H5MM_xcalloc((intn)(nx*ny), sizeof(*dst));
/* Build stride info */
size[0] = nx;
@@ -873,7 +873,7 @@ test_sub_super(size_t nx, size_t ny)
ssize_t src_stride[4]; /*source stride info */
ssize_t dst_stride[4]; /*destination stride info */
size_t size[4]; /*number of sample points */
- int i, j;
+ size_t i, j;
char s[256];
sprintf(s, "Testing image sampling %4lux%-4lu to %4lux%-4lu ",
@@ -885,8 +885,8 @@ test_sub_super(size_t nx, size_t ny)
/* Initialize */
full = H5MM_xmalloc(4 * nx * ny);
init_full(full, 2 * nx, 2 * ny, 1);
- half = H5MM_xcalloc(nx * ny, 1);
- twice = H5MM_xcalloc(4 * nx * ny, 1);
+ half = H5MM_xcalloc(1, nx*ny);
+ twice = H5MM_xcalloc(1, 4*nx*ny);
/* Setup */
size[0] = nx;
diff --git a/test/iopipe.c b/test/iopipe.c
index 4d856b9..640b2d3 100644
--- a/test/iopipe.c
+++ b/test/iopipe.c
@@ -213,7 +213,7 @@ main (void)
offset = lseek (fd, 0, SEEK_SET);
assert (0==offset);
n = write (fd, the_data, size[0]*size[1]);
- assert (n==size[0]*size[1]);
+ assert (n>=0 && (size_t)n==size[0]*size[1]);
}
getrusage (RUSAGE_SELF, &r_stop);
gettimeofday (&t_stop, NULL);
@@ -252,7 +252,7 @@ main (void)
offset = lseek (fd, 0, SEEK_SET);
assert (0==offset);
n = read (fd, the_data, size[0]*size[1]);
- assert (n==size[0]*size[1]);
+ assert (n>=0 && (size_t)n==size[0]*size[1]);
}
getrusage (RUSAGE_SELF, &r_stop);
gettimeofday (&t_stop, NULL);
diff --git a/test/istore.c b/test/istore.c
index f95c3fd..9a906cc 100644
--- a/test/istore.c
+++ b/test/istore.c
@@ -60,7 +60,7 @@ size_t zero[H5O_LAYOUT_NDIMS];
static void
print_array(uint8 *array, size_t nx, size_t ny, size_t nz)
{
- int i, j, k;
+ size_t i, j, k;
for (i = 0; i < nx; i++) {
if (nz > 1) {
@@ -118,7 +118,7 @@ new_object(H5F_t *f, const char *name, intn ndims, H5G_entry_t *ent/*out*/)
layout.type = H5D_CHUNKED;
layout.ndims = ndims;
for (i = 0; i < ndims; i++) {
- if (i < NELMTS(align_g)) {
+ if (i < (int)NELMTS(align_g)) {
layout.dim[i] = align_g[i];
} else {
layout.dim[i] = 2;
@@ -206,16 +206,17 @@ static herr_t
test_extend(H5F_t *f, const char *prefix,
size_t nx, size_t ny, size_t nz)
{
- H5G_entry_t handle;
- int i, j, k, ndims, ctr;
- uint8 *buf = NULL, *check = NULL, *whole = NULL;
- char dims[64], s[256], name[256];
- size_t offset[3];
- size_t max_corner[3];
- size_t size[3];
- size_t whole_size[3];
- size_t nelmts;
- H5O_layout_t layout;
+ H5G_entry_t handle;
+ size_t i, j, k, ctr;
+ int ndims;
+ uint8 *buf = NULL, *check = NULL, *whole = NULL;
+ char dims[64], s[256], name[256];
+ size_t offset[3];
+ size_t max_corner[3];
+ size_t size[3];
+ size_t whole_size[3];
+ size_t nelmts;
+ H5O_layout_t layout;
if (!nz) {
if (!ny) {
@@ -237,7 +238,7 @@ test_extend(H5F_t *f, const char *prefix,
printf("%-70s", s);
buf = H5MM_xmalloc(nx * ny * nz);
check = H5MM_xmalloc(nx * ny * nz);
- whole = H5MM_xcalloc(nx * ny * nz, 1);
+ whole = H5MM_xcalloc(1, nx*ny*nz);
/* Build the new empty object */
sprintf(name, "%s_%s", prefix, dims);
@@ -279,7 +280,7 @@ test_extend(H5F_t *f, const char *prefix,
size[0] = size[1] = size[2] = 1;
nelmts = 1;
} else {
- for (i = 0, nelmts = 1; i < ndims; i++) {
+ for (i=0, nelmts=1; i<(size_t)ndims; i++) {
if (ctr % ndims == i) {
offset[i] = max_corner[i];
size[i] = MIN(1, whole_size[i] - offset[i]);
@@ -311,9 +312,8 @@ test_extend(H5F_t *f, const char *prefix,
#endif
/* Fill the source array */
- if (0 == nelmts)
- continue;
- memset(buf, 128 + ctr, nelmts);
+ if (0 == nelmts) continue;
+ memset(buf, (signed)(128+ctr), nelmts);
/* Write to disk */
if (H5F_arr_write(f, &layout, NULL, size, size, zero, offset, buf)<0) {
@@ -353,7 +353,7 @@ test_extend(H5F_t *f, const char *prefix,
size, H5V_ZERO, buf); /*src */
/* Update max corner */
- for (i = 0; i < ndims; i++) {
+ for (i=0; i<(size_t)ndims; i++) {
max_corner[i] = MAX(max_corner[i], offset[i] + size[i]);
}
}
@@ -426,12 +426,13 @@ static herr_t
test_sparse(H5F_t *f, const char *prefix, size_t nblocks,
size_t nx, size_t ny, size_t nz)
{
- intn ndims, ctr;
- char dims[64], s[256], name[256];
- size_t offset[3], size[3], total = 0;
- H5G_entry_t handle;
- H5O_layout_t layout;
- uint8 *buf = NULL;
+ intn ndims;
+ size_t ctr;
+ char dims[64], s[256], name[256];
+ size_t offset[3], size[3], total = 0;
+ H5G_entry_t handle;
+ H5O_layout_t layout;
+ uint8 *buf = NULL;
if (!nz) {
if (!ny) {
@@ -470,14 +471,14 @@ test_sparse(H5F_t *f, const char *prefix, size_t nblocks,
}
goto error;
}
- for (ctr = 0; ctr < nblocks; ctr++) {
+ for (ctr=0; ctr<nblocks; ctr++) {
offset[0] = rand() % 1000000;
offset[1] = rand() % 1000000;
offset[2] = rand() % 1000000;
size[0] = nx;
size[1] = ny;
size[2] = nz;
- memset(buf, 128 + ctr, nx * ny * nz);
+ memset(buf, (signed)(128+ctr), nx * ny * nz);
/* write to disk */
if (H5F_arr_write(f, &layout, NULL, size, size, zero, offset, buf)<0) {
diff --git a/test/shtype.c b/test/shtype.c
index e1b1aa9..944941b 100644
--- a/test/shtype.c
+++ b/test/shtype.c
@@ -10,6 +10,12 @@
#include <assert.h>
#include <hdf5.h>
+#include <H5config.h>
+#ifndef HAVE_ATTRIBUTE
+# undef __attribute__
+# define __attribute__(X) /*void*/
+#endif
+
/*-------------------------------------------------------------------------
* Function: display_error_cb
@@ -28,7 +34,7 @@
*-------------------------------------------------------------------------
*/
static herr_t
-display_error_cb (void *client_data)
+display_error_cb (void *client_data __attribute__((unused)))
{
puts ("*FAILED*");
H5Eprint (stdout);
diff --git a/test/tstab.c b/test/tstab.c
index 94641aa..291dbd4 100644
--- a/test/tstab.c
+++ b/test/tstab.c
@@ -102,7 +102,7 @@ test_2(void)
* Create a directory that has so many entries that the root
* of the B-tree ends up splitting.
*/
- dir = H5Gcreate(fid, "/big", nsyms * 16 + 2);
+ dir = H5Gcreate(fid, "/big", (size_t)nsyms*16+2);
CHECK_I(dir, "H5Gcreate");
status = H5Gclose(dir);
CHECK_I(status, "H5Gclose");