summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2005-05-07 19:37:48 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2005-05-07 19:37:48 (GMT)
commitbbe03d73613afbcdeca14c045c8b90fac37e0fe8 (patch)
tree6c6468ecf923ad7f1101e0719d2af1894e63ad64
parentc952661afbac41d4bf2622899bf2a4c2c02b07b5 (diff)
downloadhdf5-bbe03d73613afbcdeca14c045c8b90fac37e0fe8.zip
hdf5-bbe03d73613afbcdeca14c045c8b90fac37e0fe8.tar.gz
hdf5-bbe03d73613afbcdeca14c045c8b90fac37e0fe8.tar.bz2
[svn-r10736] Purpose:
Code cleanup Description: Clean up some compiler warnings Platforms tested: FreeBSD 4.11 (sleipnir) h5committest
-rw-r--r--config/freebsd4
-rw-r--r--fortran/src/H5match_types.c192
-rw-r--r--hl/src/H5PT.c6
-rw-r--r--hl/test/test_packet.c11
-rw-r--r--hl/tools/gif2h5/readhdf.c4
-rw-r--r--hl/tools/gif2h5/writehdf.c3
-rw-r--r--src/H5.c2
-rw-r--r--src/H5A.c6
-rw-r--r--src/H5B.c12
-rw-r--r--src/H5Bpkg.h2
-rw-r--r--src/H5C.c2
-rw-r--r--src/H5Dprivate.h2
-rw-r--r--src/H5E.c4
-rw-r--r--src/H5F.c28
-rw-r--r--src/H5Fpkg.h10
-rw-r--r--src/H5G.c4
-rw-r--r--src/H5Gpkg.h2
-rw-r--r--src/H5Ipublic.h1
-rw-r--r--src/H5Opkg.h2
-rw-r--r--src/H5P.c2
-rw-r--r--src/H5SHcache.c2
-rw-r--r--src/H5T.c4
-rw-r--r--src/H5Znbit.c6
-rw-r--r--src/H5Zscaleoffset.c19
-rw-r--r--src/H5public.h2
-rw-r--r--test/bittests.c32
-rw-r--r--test/dsets.c26
-rw-r--r--test/dt_atomic.c40
-rw-r--r--test/testmeta.c6
-rw-r--r--tools/gifconv/readhdf.c4
-rw-r--r--tools/gifconv/writehdf.c3
-rw-r--r--tools/lib/h5diff.c2
-rw-r--r--tools/lib/h5tools_str.c12
33 files changed, 167 insertions, 290 deletions
diff --git a/config/freebsd b/config/freebsd
index c3b3904..e07054e 100644
--- a/config/freebsd
+++ b/config/freebsd
@@ -11,9 +11,9 @@ if test "X-" = "X-$CC"; then
CC_BASENAME=gcc
fi
-# Add "_POSIX_C_SOURCE" define to cpp flags, to quiet warnings
+# Add "_XOPEN_SOURCE" define to cpp flags, to quiet warnings
# from /usr/include/sys/cdefs.h
-CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=1"
+CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=600"
# Figure out C compiler flags
. $srcdir/config/gnu-flags
diff --git a/fortran/src/H5match_types.c b/fortran/src/H5match_types.c
index 13c6d4c..97dcf33 100644
--- a/fortran/src/H5match_types.c
+++ b/fortran/src/H5match_types.c
@@ -17,7 +17,8 @@ FILE * fort_header;
#define CFILE "H5f90i_gen.h"
#define FFILE "H5fortran_types.f90"
-void initCfile()
+static void
+initCfile(void)
{
fprintf(c_header,
"/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n\
@@ -42,7 +43,8 @@ void initCfile()
#include \"H5public.h\"\n\n");
}
-void initFfile()
+static void
+initFfile(void)
{
fprintf(fort_header,
"! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \n\
@@ -67,11 +69,13 @@ void initFfile()
}
-void endCfile()
+static void
+endCfile(void)
{
fprintf(c_header, "\n#endif /* _H5f90i_gen_H */\n");
}
-void endFfile()
+static void
+endFfile(void)
{
fprintf(fort_header, "\n INTEGER(SIZE_T), PARAMETER :: OBJECT_NAMELEN_DEFAULT_F = -1\n\n");
fprintf(fort_header, " END MODULE H5FORTRAN_TYPES\n");
@@ -98,11 +102,6 @@ void writeToFiles(const char* fortran_type, const char* c_type, unsigned int siz
fprintf(c_header, "typedef c_int_%d %s;\n", size, c_type);
}
-/* hid_t and hssize_t don't have their sizes defined anywhere.
- * Use sizeof() instead. */
-#define H5_SIZEOF_HID_T sizeof(hid_t)
-#define H5_SIZEOF_HSSIZE_T sizeof(hssize_t)
-
int main()
{
/* Open target files */
@@ -165,184 +164,89 @@ int main()
fprintf(c_header, "\n");
/* haddr_t */
- if( H5_SIZEOF_HADDR_T >= 8) {
- #ifdef H5_FORTRAN_HAS_INTEGER_8
- writeToFiles("HADDR_T", "haddr_t_f", 8);
- goto hsize_t_start;
- #endif
- }
- if( H5_SIZEOF_HADDR_T >= 4) {
- #ifdef H5_FORTRAN_HAS_INTEGER_4
- writeToFiles("HADDR_T", "haddr_t_f", 4);
- goto hsize_t_start;
- #endif
- }
- if( H5_SIZEOF_HADDR_T >= 2) {
- #ifdef H5_FORTRAN_HAS_INTEGER_2
- writeToFiles("HADDR_T", "haddr_t_f", 2);
- goto hsize_t_start;
- #endif
- }
- if( H5_SIZEOF_HADDR_T >= 1) {
- #ifdef H5_FORTRAN_HAS_INTEGER_1
- writeToFiles("HADDR_T", "haddr_t_f", 1);
- goto hsize_t_start;
- #endif
- }
+#if defined H5_FORTRAN_HAS_INTEGER_8 && H5_SIZEOF_HADDR_T >= 8
+ writeToFiles("HADDR_T", "haddr_t_f", 8);
+#elif defined H5_FORTRAN_HAS_INTEGER_4 && H5_SIZEOF_HADDR_T >= 4
+ writeToFiles("HADDR_T", "haddr_t_f", 4);
+#elif defined H5_FORTRAN_HAS_INTEGER_2 && H5_SIZEOF_HADDR_T >= 2
+ writeToFiles("HADDR_T", "haddr_t_f", 2);
+#elif defined H5_FORTRAN_HAS_INTEGER_1 && H5_SIZEOF_HADDR_T >= 1
+ writeToFiles("HADDR_T", "haddr_t_f", 1);
+#else
/* Error: couldn't find a size for haddr_t */
return -1;
-
- hsize_t_start:
+#endif
/* hsize_t */
- if( H5_SIZEOF_HSIZE_T >= 8) {
- #ifdef H5_FORTRAN_HAS_INTEGER_8
+#if defined H5_FORTRAN_HAS_INTEGER_8 && H5_SIZEOF_HSIZE_T >= 8
writeToFiles("HSIZE_T", "hsize_t_f", 8);
- goto hssize_t_start;
- #endif
- }
- if( H5_SIZEOF_HSIZE_T >= 4) {
- #ifdef H5_FORTRAN_HAS_INTEGER_4
+#elif defined H5_FORTRAN_HAS_INTEGER_4 && H5_SIZEOF_HSIZE_T >= 4
writeToFiles("HSIZE_T", "hsize_t_f", 4);
- goto hssize_t_start;
- #endif
- }
- if( H5_SIZEOF_HSIZE_T >= 2) {
- #ifdef H5_FORTRAN_HAS_INTEGER_2
+#elif defined H5_FORTRAN_HAS_INTEGER_2 && H5_SIZEOF_HSIZE_T >= 2
writeToFiles("HSIZE_T", "hsize_t_f", 2);
- goto hssize_t_start;
- #endif
- }
- if( H5_SIZEOF_HSIZE_T >= 1) {
- #ifdef H5_FORTRAN_HAS_INTEGER_1
+#elif defined H5_FORTRAN_HAS_INTEGER_1 && H5_SIZEOF_HSIZE_T >= 1
writeToFiles("HSIZE_T", "hsize_t_f", 1);
- goto hssize_t_start;
- #endif
- }
+#else
/* Error: couldn't find a size for hsize_t */
return -1;
-
- hssize_t_start:
+#endif
/* hssize_t */
- if( H5_SIZEOF_HSSIZE_T >= 8) {
- #ifdef H5_FORTRAN_HAS_INTEGER_8
+#if defined H5_FORTRAN_HAS_INTEGER_8 && H5_SIZEOF_HSSIZE_T >= 8
writeToFiles("HSSIZE_T", "hssize_t_f", 8);
- goto size_t_start;
- #endif
- }
- if( H5_SIZEOF_HSSIZE_T >= 4) {
- #ifdef H5_FORTRAN_HAS_INTEGER_4
+#elif defined H5_FORTRAN_HAS_INTEGER_4 && H5_SIZEOF_HSSIZE_T >= 4
writeToFiles("HSSIZE_T", "hssize_t_f", 4);
- goto size_t_start;
- #endif
- }
- if( H5_SIZEOF_HSSIZE_T >= 2) {
- #ifdef H5_FORTRAN_HAS_INTEGER_2
+#elif defined H5_FORTRAN_HAS_INTEGER_2 && H5_SIZEOF_HSSIZE_T >= 2
writeToFiles("HSSIZE_T", "hssize_t_f", 2);
- goto size_t_start;
- #endif
- }
- if( H5_SIZEOF_HSSIZE_T >= 1) {
- #ifdef H5_FORTRAN_HAS_INTEGER_1
+#elif defined H5_FORTRAN_HAS_INTEGER_1 && H5_SIZEOF_HSSIZE_T >= 1
writeToFiles("HSSIZE_T", "hssize_t_f", 1);
- goto size_t_start;
- #endif
- }
+#else
/* Error: couldn't find a size for hssize_t */
return -1;
+#endif
- size_t_start:
/* size_t */
- if( H5_SIZEOF_SIZE_T >= 8) {
- #ifdef H5_FORTRAN_HAS_INTEGER_8
+#if defined H5_FORTRAN_HAS_INTEGER_8 && H5_SIZEOF_SIZE_T >= 8
writeToFiles("SIZE_T", "size_t_f", 8);
- goto int_start;
- #endif
- }
- if( H5_SIZEOF_SIZE_T >= 4) {
- #ifdef H5_FORTRAN_HAS_INTEGER_4
+#elif defined H5_FORTRAN_HAS_INTEGER_4 && H5_SIZEOF_SIZE_T >= 4
writeToFiles("SIZE_T", "size_t_f", 4);
- goto int_start;
- #endif
- }
- if( H5_SIZEOF_SIZE_T >= 2) {
- #ifdef H5_FORTRAN_HAS_INTEGER_2
+#elif defined H5_FORTRAN_HAS_INTEGER_2 && H5_SIZEOF_SIZE_T >= 2
writeToFiles("SIZE_T", "size_t_f", 2);
- goto int_start;
- #endif
- }
- if( H5_SIZEOF_SIZE_T >= 1) {
- #ifdef H5_FORTRAN_HAS_INTEGER_1
+#elif defined H5_FORTRAN_HAS_INTEGER_1 && H5_SIZEOF_SIZE_T >= 1
writeToFiles("SIZE_T", "size_t_f", 1);
- goto int_start;
- #endif
- }
+#else
/* Error: couldn't find a size for size_t */
return -1;
+#endif
- int_start:
/* int */
- if( H5_SIZEOF_INT >= 8) {
- #ifdef H5_FORTRAN_HAS_INTEGER_8
+#if defined H5_FORTRAN_HAS_INTEGER_8 && H5_SIZEOF_INT >= 8
writeToFiles("INT", "int_f", 8);
- goto hid_t_start;
- #endif
- }
- if( H5_SIZEOF_INT >= 4) {
- #ifdef H5_FORTRAN_HAS_INTEGER_4
+#elif defined H5_FORTRAN_HAS_INTEGER_4 && H5_SIZEOF_INT >= 4
writeToFiles("INT", "int_f", 4);
- goto hid_t_start;
- #endif
- }
- if( H5_SIZEOF_INT >= 2) {
- #ifdef H5_FORTRAN_HAS_INTEGER_2
+#elif defined H5_FORTRAN_HAS_INTEGER_2 && H5_SIZEOF_INT >= 2
writeToFiles("INT", "int_f", 2);
- goto hid_t_start;
- #endif
- }
- if( H5_SIZEOF_INT >= 1) {
- #ifdef H5_FORTRAN_HAS_INTEGER_1
+#elif defined H5_FORTRAN_HAS_INTEGER_1 && H5_SIZEOF_INT >= 1
writeToFiles("INT", "int_f", 1);
- goto hid_t_start;
- #endif
- }
+#else
/* Error: couldn't find a size for int */
return -1;
+#endif
- hid_t_start:
/* hid_t */
- if( H5_SIZEOF_HID_T >= 8) {
- #ifdef H5_FORTRAN_HAS_INTEGER_8
+#if defined H5_FORTRAN_HAS_INTEGER_8 && H5_SIZEOF_HID_T >= 8
writeToFiles("HID_T", "hid_t_f", 8);
- goto real_start;
- #endif
- }
- if( H5_SIZEOF_HID_T >= 4) {
- #ifdef H5_FORTRAN_HAS_INTEGER_4
+#elif defined H5_FORTRAN_HAS_INTEGER_4 && H5_SIZEOF_HID_T >= 4
writeToFiles("HID_T", "hid_t_f", 4);
- goto real_start;
- #endif
- }
- if( H5_SIZEOF_HID_T >= 2) {
- #ifdef H5_FORTRAN_HAS_INTEGER_2
+#elif defined H5_FORTRAN_HAS_INTEGER_2 && H5_SIZEOF_HID_T >= 2
writeToFiles("HID_T", "hid_t_f", 2);
- goto real_start;
- #endif
- }
- if( H5_SIZEOF_HID_T >= 1) {
- #ifdef H5_FORTRAN_HAS_INTEGER_1
+#elif defined H5_FORTRAN_HAS_INTEGER_1 && H5_SIZEOF_HID_T >= 1
writeToFiles("HID_T", "hid_t_f", 1);
- goto real_start;
- #endif
- }
+#else
/* Error: couldn't find a size for hid_t */
return -1;
-
- real_start:
- goto done;
- done:
+#endif
/* Close files */
endCfile();
diff --git a/hl/src/H5PT.c b/hl/src/H5PT.c
index 10b148b..d59e9ed 100644
--- a/hl/src/H5PT.c
+++ b/hl/src/H5PT.c
@@ -291,8 +291,6 @@ out:
*/
herr_t H5PT_close( htbl_t* table)
{
- herr_t return_status = 0;
-
if(table == NULL)
goto out;
@@ -670,10 +668,8 @@ out:
*/
herr_t H5PTis_valid(hid_t table_id)
{
- htbl_t * table;
-
/* find the table struct from its ID */
- if((table = (htbl_t *) H5Iobject_verify(table_id, H5PT_ptable_id_type)) ==NULL)
+ if(H5Iobject_verify(table_id, H5PT_ptable_id_type) ==NULL)
return -1;
return 0;
diff --git a/hl/test/test_packet.c b/hl/test/test_packet.c
index 0500edd..0593579 100644
--- a/hl/test/test_packet.c
+++ b/hl/test/test_packet.c
@@ -82,7 +82,8 @@ static int cmp_par(hsize_t i, hsize_t j, particle_t *rbuf, particle_t *wbuf )
* function to create a datatype representing the particle struct
*-------------------------------------------------------------------------
*/
-static hid_t make_particle_type()
+static hid_t
+make_particle_type(void)
{
hid_t type_id;
hid_t string_type;
@@ -113,8 +114,6 @@ static hid_t make_particle_type()
/* Create a normal HL table just like the HL examples do */
static int create_hl_table(hid_t fid)
{
- particle_t testparticle;
-
/* Calculate the offsets of the particle struct members in memory */
size_t part_offset[NFIELDS] = { HOFFSET( particle_t, name ),
HOFFSET( particle_t, lati ),
@@ -122,12 +121,6 @@ static int create_hl_table(hid_t fid)
HOFFSET( particle_t, pressure ),
HOFFSET( particle_t, temperature )};
- size_t part_sizes[NFIELDS] = { sizeof( testparticle.name),
- sizeof( testparticle.lati),
- sizeof( testparticle.longi),
- sizeof( testparticle.pressure),
- sizeof( testparticle.temperature)};
-
/* Define field information */
const char *field_names[NFIELDS] =
{ "Name","Latitude", "Longitude", "Pressure", "Temperature" };
diff --git a/hl/tools/gif2h5/readhdf.c b/hl/tools/gif2h5/readhdf.c
index 4b05ad9..2720d4d 100644
--- a/hl/tools/gif2h5/readhdf.c
+++ b/hl/tools/gif2h5/readhdf.c
@@ -86,7 +86,7 @@ int ReadHDF(BYTE** data, BYTE palette[256][3], hsize_t *image_size,
return -1;
}
if (H5Tget_size(dtype) != 1) {
- fprintf(stderr , "Data is %d bytes per pixel. Cannot convert to GIF\n",H5Tget_size(dtype));
+ fprintf(stderr , "Data is %d bytes per pixel. Cannot convert to GIF\n",(int)H5Tget_size(dtype));
return -1;
}
@@ -141,7 +141,7 @@ int ReadHDF(BYTE** data, BYTE palette[256][3], hsize_t *image_size,
return -1;
}
if (H5Tget_size(pal_dtype) != 1) {
- fprintf(stderr , "Palette data is %d bytes per pixel. Cannot convert to GIF\n",H5Tget_size(pal_dtype));
+ fprintf(stderr , "Palette data is %d bytes per pixel. Cannot convert to GIF\n",(int)H5Tget_size(pal_dtype));
return -1;
}
diff --git a/hl/tools/gif2h5/writehdf.c b/hl/tools/gif2h5/writehdf.c
index 7df7f29..d343aae 100644
--- a/hl/tools/gif2h5/writehdf.c
+++ b/hl/tools/gif2h5/writehdf.c
@@ -25,7 +25,6 @@ static int write_text_attribute(hid_t dataset_id , const char *attr_name,
const char *attr_value, const size_t attr_len)
{
/* variables for the attributes */
- hsize_t attr_dims; /* dimensions for the attribute */
hsize_t attr_size; /* dimensions for the attribute */
hid_t attr_dataspace_id; /* dataspaces needed for the various attributes */
hid_t attr_attr_id; /* attribute id */
@@ -35,8 +34,6 @@ static int write_text_attribute(hid_t dataset_id , const char *attr_name,
if (!attr_name || !attr_value)
return -1;
- attr_dims = 1;
-
/* figure out size of the data */
attr_size = (hsize_t)attr_len;
diff --git a/src/H5.c b/src/H5.c
index ab488ba..821ee3a 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -1564,7 +1564,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
if (argname) {
unsigned n = (unsigned)MAX (0, (int)HDstrlen(argname)-3); /*lint !e666 Allow expression with side effects */
if (!HDstrcmp (argname+n, "_id")) {
- HDstrncpy (buf, argname, MIN ((int)sizeof(buf)-1, n));
+ HDstrncpy (buf, argname, (size_t)MIN ((int)sizeof(buf)-1, n));
buf[MIN((int)sizeof(buf)-1, n)] = '\0';
argname = buf;
}
diff --git a/src/H5A.c b/src/H5A.c
index 863cf75..a8acc3a 100644
--- a/src/H5A.c
+++ b/src/H5A.c
@@ -77,7 +77,7 @@ H5A_init_interface(void)
/*
* Create attribute group.
*/
- if (H5I_register_type(H5I_ATTR, H5I_ATTRID_HASHSIZE, H5A_RESERVED_ATOMS, (H5I_free_t)H5A_close)<H5I_FILE)
+ if (H5I_register_type(H5I_ATTR, (size_t)H5I_ATTRID_HASHSIZE, H5A_RESERVED_ATOMS, (H5I_free_t)H5A_close)<H5I_FILE)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "unable to initialize interface")
done:
@@ -692,7 +692,7 @@ H5A_write(H5A_t *attr, const H5T_t *mem_type, const void *buf, hid_t dxpl_id)
HDmemcpy(tconv_buf,buf,(src_type_size*nelmts));
/* Perform datatype conversion */
- if (H5T_convert(tpath, src_id, dst_id, nelmts, 0, 0, tconv_buf, bkg_buf, dxpl_id)<0)
+ if (H5T_convert(tpath, src_id, dst_id, nelmts, (size_t)0, (size_t)0, tconv_buf, bkg_buf, dxpl_id)<0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "datatype conversion failed")
/* Free the previous attribute data buffer, if there is one */
@@ -858,7 +858,7 @@ H5A_read(const H5A_t *attr, const H5T_t *mem_type, void *buf, hid_t dxpl_id)
HDmemcpy(tconv_buf,attr->data,(src_type_size*nelmts));
/* Perform datatype conversion. */
- if (H5T_convert(tpath, src_id, dst_id, nelmts, 0, 0, tconv_buf, bkg_buf, dxpl_id)<0)
+ if (H5T_convert(tpath, src_id, dst_id, nelmts, (size_t)0, (size_t)0, tconv_buf, bkg_buf, dxpl_id)<0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "datatype conversion failed")
/* Copy the converted data into the user's buffer */
diff --git a/src/H5B.c b/src/H5B.c
index 525e12e..aa752cf 100644
--- a/src/H5B.c
+++ b/src/H5B.c
@@ -230,7 +230,7 @@ H5B_create(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, void *udata,
shared=H5RC_GET_OBJ(bt->rc_shared);
HDassert(shared);
if (NULL==(bt->native=H5FL_BLK_MALLOC(native_block,shared->sizeof_keys)) ||
- NULL==(bt->child=H5FL_SEQ_MALLOC(haddr_t,shared->two_k)))
+ NULL==(bt->child=H5FL_SEQ_MALLOC(haddr_t,(size_t)shared->two_k)))
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree root node")
if (HADDR_UNDEF==(*addr_p=H5MF_alloc(f, H5FD_MEM_BTREE, dxpl_id, (hsize_t)shared->sizeof_rnode)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for B-tree root node")
@@ -307,7 +307,7 @@ H5B_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata)
shared=H5RC_GET_OBJ(bt->rc_shared);
HDassert(shared);
if (NULL==(bt->native=H5FL_BLK_MALLOC(native_block,shared->sizeof_keys)) ||
- NULL==(bt->child=H5FL_SEQ_MALLOC(haddr_t,shared->two_k)))
+ NULL==(bt->child=H5FL_SEQ_MALLOC(haddr_t,(size_t)shared->two_k)))
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
if (H5F_block_read(f, H5FD_MEM_BTREE, addr, shared->sizeof_rnode, dxpl_id, shared->page)<0)
@@ -316,7 +316,7 @@ H5B_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata)
p = shared->page;
/* magic number */
- if (HDmemcmp(p, H5B_MAGIC, H5B_SIZEOF_MAGIC))
+ if (HDmemcmp(p, H5B_MAGIC, (size_t)H5B_SIZEOF_MAGIC))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, NULL, "wrong B-tree signature")
p += 4;
@@ -400,7 +400,7 @@ H5B_serialize(const H5F_t *f, const H5B_t *bt)
p = shared->page;
/* magic number */
- HDmemcpy(p, H5B_MAGIC, H5B_SIZEOF_MAGIC);
+ HDmemcpy(p, H5B_MAGIC, (size_t)H5B_SIZEOF_MAGIC);
p += 4;
/* node type and level */
@@ -1537,7 +1537,7 @@ H5B_iterate (H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, H5B_operator_t op
* We've reached the left-most leaf. Now follow the right-sibling
* pointer from leaf to leaf until we've processed all leaves.
*/
- if (NULL==(child=H5FL_SEQ_MALLOC(haddr_t,shared->two_k)) ||
+ if (NULL==(child=H5FL_SEQ_MALLOC(haddr_t,(size_t)shared->two_k)) ||
NULL==(key=H5FL_BLK_MALLOC(native_block,shared->sizeof_keys)))
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
@@ -2114,7 +2114,7 @@ H5B_copy(const H5B_t *old_bt)
HDmemcpy(new_node,old_bt,sizeof(H5B_t));
if ( NULL==(new_node->native=H5FL_BLK_MALLOC(native_block,shared->sizeof_keys)) ||
- NULL==(new_node->child=H5FL_SEQ_MALLOC(haddr_t,shared->two_k)))
+ NULL==(new_node->child=H5FL_SEQ_MALLOC(haddr_t,(size_t)shared->two_k)))
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for B-tree root node")
/* Copy the other structures */
diff --git a/src/H5Bpkg.h b/src/H5Bpkg.h
index 37047e7..74fa393 100644
--- a/src/H5Bpkg.h
+++ b/src/H5Bpkg.h
@@ -49,9 +49,9 @@ struct H5B_t {
/* first field in structure */
H5RC_t *rc_shared; /*ref-counted shared info */
unsigned level; /*node level */
+ unsigned nchildren; /*number of child pointers */
haddr_t left; /*address of left sibling */
haddr_t right; /*address of right sibling */
- unsigned nchildren; /*number of child pointers */
uint8_t *native; /*array of keys in native format */
haddr_t *child; /*2k child pointers */
};
diff --git a/src/H5C.c b/src/H5C.c
index 0e1064a..28cb17a 100644
--- a/src/H5C.c
+++ b/src/H5C.c
@@ -1919,7 +1919,7 @@ H5C_create(size_t max_cache_size,
"memory allocation failed")
}
- if ( (cache_ptr->slist_ptr = H5SL_create(H5SL_TYPE_HADDR,0.5,16))
+ if ( (cache_ptr->slist_ptr = H5SL_create(H5SL_TYPE_HADDR,0.5,(size_t)16))
== NULL ) {
HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, NULL, "can't create skip list.")
diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h
index d6d2333..732af1f 100644
--- a/src/H5Dprivate.h
+++ b/src/H5Dprivate.h
@@ -192,12 +192,12 @@ typedef struct H5D_dxpl_cache_t {
void *tconv_buf; /* Temporary conversion buffer (H5D_XFER_TCONV_BUF_NAME) */
void *bkgr_buf; /* Background conversion buffer (H5D_XFER_BKGR_BUF_NAME) */
H5T_bkg_t bkgr_buf_type; /* Background buffer type (H5D_XFER_BKGR_BUF_NAME) */
+ H5Z_EDC_t err_detect; /* Error detection info (H5D_XFER_EDC_NAME) */
double btree_split_ratio[3];/* B-tree split ratios (H5D_XFER_BTREE_SPLIT_RATIO_NAME) */
size_t vec_size; /* Size of hyperslab vector (H5D_XFER_HYPER_VECTOR_SIZE_NAME) */
#ifdef H5_HAVE_PARALLEL
H5FD_mpio_xfer_t xfer_mode; /* Parallel transfer for this request (H5D_XFER_IO_XFER_MODE_NAME) */
#endif /*H5_HAVE_PARALLEL*/
- H5Z_EDC_t err_detect; /* Error detection info (H5D_XFER_EDC_NAME) */
H5Z_cb_t filter_cb; /* Filter callback function (H5D_XFER_FILTER_CB_NAME) */
H5Z_data_xform_t *data_xform_prop; /* Data transform prop (H5D_XFER_XFORM_NAME) */
} H5D_dxpl_cache_t;
diff --git a/src/H5E.c b/src/H5E.c
index 74c67fa..2323288 100644
--- a/src/H5E.c
+++ b/src/H5E.c
@@ -105,7 +105,7 @@ static herr_t H5E_set_current_stack(H5E_t *estack);
static herr_t H5E_close_stack(H5E_t *err_stack);
static int H5E_get_num(const H5E_t *err_stack);
static herr_t H5E_pop(H5E_t *err_stack, size_t count);
-static herr_t H5E_clear_entries(H5E_t *estack, unsigned nentries);
+static herr_t H5E_clear_entries(H5E_t *estack, size_t nentries);
static herr_t H5E_print_stack(const H5E_t *estack, FILE *stream);
static herr_t H5E_walk_stack(const H5E_t *estack, H5E_direction_t direction, H5E_walk_t func,
void *client_data);
@@ -1755,7 +1755,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5E_clear_entries(H5E_t *estack, unsigned nentries)
+H5E_clear_entries(H5E_t *estack, size_t nentries)
{
H5E_error_t *error; /* Pointer to error stack entry to clear */
unsigned u; /* Local index variable */
diff --git a/src/H5F.c b/src/H5F.c
index 8ad29cb..442baac 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -227,8 +227,8 @@ H5F_init_interface(void)
* which are pending completion because there are object headers still
* open within the file.
*/
- if (H5I_register_type(H5I_FILE, H5I_FILEID_HASHSIZE, 0, (H5I_free_t)H5F_close)<H5I_FILE ||
- H5I_register_type(H5I_FILE_CLOSING, H5I_FILEID_HASHSIZE, 0, (H5I_free_t)H5F_close)<H5I_FILE)
+ if (H5I_register_type(H5I_FILE, (size_t)H5I_FILEID_HASHSIZE, 0, (H5I_free_t)H5F_close)<H5I_FILE ||
+ H5I_register_type(H5I_FILE_CLOSING, (size_t)H5I_FILEID_HASHSIZE, 0, (H5I_free_t)H5F_close)<H5I_FILE)
HGOTO_ERROR (H5E_FILE, H5E_CANTINIT, FAIL, "unable to initialize interface")
/* ========== File Creation Property Class Initialization ============*/
@@ -1304,9 +1304,9 @@ H5F_locate_signature(H5FD_t *file, hid_t dxpl_id)
addr = (8==n) ? 0 : (haddr_t)1 << n;
if (H5FD_set_eoa(file, addr+H5F_SIGNATURE_LEN)<0)
HGOTO_ERROR(H5E_IO, H5E_CANTINIT, HADDR_UNDEF, "unable to set EOA value for file signature")
- if (H5FD_read(file, H5FD_MEM_SUPER, dxpl_id, addr, H5F_SIGNATURE_LEN, buf)<0)
+ if (H5FD_read(file, H5FD_MEM_SUPER, dxpl_id, addr, (size_t)H5F_SIGNATURE_LEN, buf)<0)
HGOTO_ERROR(H5E_IO, H5E_CANTINIT, HADDR_UNDEF, "unable to read file signature")
- if (!HDmemcmp(buf, H5F_SIGNATURE, H5F_SIGNATURE_LEN))
+ if (!HDmemcmp(buf, H5F_SIGNATURE, (size_t)H5F_SIGNATURE_LEN))
break;
}
@@ -1955,7 +1955,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t d
#endif /* H5_HAVE_FPHDF5 */
/* Read the superblock if it hasn't been read before. */
- if (H5F_read_superblock(file, dxpl_id, &root_ent, HADDR_UNDEF, NULL, 0) < 0)
+ if (H5F_read_superblock(file, dxpl_id, &root_ent, HADDR_UNDEF, NULL, (size_t)0) < 0)
HGOTO_ERROR(H5E_FILE, H5E_READERROR, NULL, "unable to read superblock")
#ifdef H5_HAVE_FPHDF5
@@ -2523,7 +2523,7 @@ H5F_read_superblock(H5F_t *f, hid_t dxpl_id, H5G_entry_t *root_ent, haddr_t addr
dbuf_size=sizeof(dbuf);
if (H5FD_set_eoa(lf, drv_addr + 16) < 0 ||
- H5FD_read(lf, H5FD_MEM_SUPER, dxpl_id, drv_addr, 16, p) < 0)
+ H5FD_read(lf, H5FD_MEM_SUPER, dxpl_id, drv_addr, (size_t)16, p) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to read driver information block")
} /* end if */
else {
@@ -2541,7 +2541,7 @@ H5F_read_superblock(H5F_t *f, hid_t dxpl_id, H5G_entry_t *root_ent, haddr_t addr
UINT32DECODE(p, driver_size);
/* Driver name and/or version */
- HDstrncpy(driver_name, (const char *)p, 8);
+ HDstrncpy(driver_name, (const char *)p, (size_t)8);
driver_name[8] = '\0';
p += 8; /* advance past name/version */
@@ -2754,7 +2754,7 @@ H5F_write_superblock(H5F_t *f, hid_t dxpl_id, uint8_t *buf)
/* Encode the file super block */
p = sbuf;
- HDmemcpy(p, H5F_SIGNATURE, H5F_SIGNATURE_LEN);
+ HDmemcpy(p, H5F_SIGNATURE, (size_t)H5F_SIGNATURE_LEN);
p += H5F_SIGNATURE_LEN;
*p++ = (uint8_t)super_vers;
*p++ = (uint8_t)freespace_vers;
@@ -2817,7 +2817,7 @@ H5F_write_superblock(H5F_t *f, hid_t dxpl_id, uint8_t *buf)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to encode driver information")
/* Driver name */
- HDmemcpy(dbuf + 8, driver_name, 8);
+ HDmemcpy(dbuf + 8, driver_name, (size_t)8);
} /* end if */
/* Compute super block checksum */
@@ -3103,7 +3103,7 @@ H5F_close(H5F_t *f)
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5F_close, FAIL)
+ FUNC_ENTER_NOAPI_NOINIT(H5F_close)
assert(f->nrefs>0);
@@ -3232,7 +3232,7 @@ H5F_close(H5F_t *f)
int i; /* Local index variable */
/* Get the list of IDs of open dataset objects */
- while((obj_count=H5F_get_obj_ids(f, H5F_OBJ_DATASET, (sizeof(objs)/sizeof(objs[0])), objs))!=0) {
+ while((obj_count=H5F_get_obj_ids(f, H5F_OBJ_DATASET, (int)(sizeof(objs)/sizeof(objs[0])), objs))!=0) {
/* Try to close all the open objects */
for(i=0; i<obj_count; i++)
@@ -3241,7 +3241,7 @@ H5F_close(H5F_t *f)
} /* end while */
/* Get the list of IDs of open group objects */
- while((obj_count=H5F_get_obj_ids(f, H5F_OBJ_GROUP, (sizeof(objs)/sizeof(objs[0])), objs))!=0) {
+ while((obj_count=H5F_get_obj_ids(f, H5F_OBJ_GROUP, (int)(sizeof(objs)/sizeof(objs[0])), objs))!=0) {
/* Try to close all the open objects */
for(i=0; i<obj_count; i++)
@@ -3250,7 +3250,7 @@ H5F_close(H5F_t *f)
} /* end while */
/* Get the list of IDs of open named datatype objects */
- while((obj_count=H5F_get_obj_ids(f, H5F_OBJ_DATATYPE, (sizeof(objs)/sizeof(objs[0])), objs))!=0) {
+ while((obj_count=H5F_get_obj_ids(f, H5F_OBJ_DATATYPE, (int)(sizeof(objs)/sizeof(objs[0])), objs))!=0) {
/* Try to close all the open objects */
for(i=0; i<obj_count; i++)
@@ -3259,7 +3259,7 @@ H5F_close(H5F_t *f)
} /* end while */
/* Get the list of IDs of open attribute objects */
- while((obj_count=H5F_get_obj_ids(f, H5F_OBJ_ATTR, (sizeof(objs)/sizeof(objs[0])), objs))!=0) {
+ while((obj_count=H5F_get_obj_ids(f, H5F_OBJ_ATTR, (int)(sizeof(objs)/sizeof(objs[0])), objs))!=0) {
/* Try to close all the open objects */
for(i=0; i<obj_count; i++)
diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h
index c281da3..17dcfdc 100644
--- a/src/H5Fpkg.h
+++ b/src/H5Fpkg.h
@@ -78,16 +78,16 @@
* pointing to this struct.
*/
typedef struct H5F_file_t {
- unsigned flags; /* Access Permissions for file */
H5FD_t *lf; /* Lower level file handle for I/O */
unsigned nrefs; /* Ref count for times file is opened */
uint32_t consist_flags; /* File Consistency Flags */
+ unsigned flags; /* Access Permissions for file */
/* Cached values from FCPL */
- size_t sizeof_addr; /* Size of addresses in file */
- size_t sizeof_size; /* Size of offsets in file */
unsigned sym_leaf_k; /* Size of leaves in symbol tables */
unsigned btree_k[H5B_NUM_BTREE_ID]; /* B-tree key values for each type */
+ size_t sizeof_addr; /* Size of addresses in file */
+ size_t sizeof_size; /* Size of offsets in file */
haddr_t super_addr; /* Absolute address of super block */
haddr_t base_addr; /* Absolute base address for rel.addrs. */
haddr_t freespace_addr; /* Relative address of free-space info */
@@ -102,6 +102,7 @@ typedef struct H5F_file_t {
/* fixed at creation time and should */
/* not change thereafter. */
hid_t fcpl_id; /* File creation property list ID */
+ H5F_close_degree_t fc_degree; /* File close behavior degree */
size_t rdcc_nelmts; /* Size of raw data chunk cache (elmts) */
size_t rdcc_nbytes; /* Size of raw data chunk cache (bytes) */
double rdcc_w0; /* Preempt read chunks first? [0.0..1.0]*/
@@ -109,11 +110,10 @@ typedef struct H5F_file_t {
hsize_t threshold; /* Threshold for alignment */
hsize_t alignment; /* Alignment */
unsigned gc_ref; /* Garbage-collect references? */
- struct H5G_t *root_grp; /* Open root group */
int ncwfs; /* Num entries on cwfs list */
struct H5HG_heap_t **cwfs; /* Global heap cache */
+ struct H5G_t *root_grp; /* Open root group */
H5FO_t *open_objs; /* Open objects in file */
- H5F_close_degree_t fc_degree; /* File close behavior degree */
H5RC_t *grp_btree_shared; /* Ref-counted group B-tree node info */
} H5F_file_t;
diff --git a/src/H5G.c b/src/H5G.c
index 7f0b9ca..fa4bbfb 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -975,7 +975,7 @@ H5G_init_interface(void)
FUNC_ENTER_NOAPI_NOINIT(H5G_init_interface);
/* Initialize the atom group for the group IDs */
- if (H5I_register_type(H5I_GROUP, H5I_GROUPID_HASHSIZE, H5G_RESERVED_ATOMS,
+ if (H5I_register_type(H5I_GROUP, (size_t)H5I_GROUPID_HASHSIZE, H5G_RESERVED_ATOMS,
(H5I_free_t)H5G_close) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to initialize interface");
@@ -1700,7 +1700,7 @@ H5G_mkroot (H5F_t *f, hid_t dxpl_id, H5G_entry_t *ent)
if (!ent) {
ent = &new_root;
HDmemset(ent, 0, sizeof(H5G_entry_t));
- if (H5G_stab_create (f, dxpl_id, H5G_SIZE_HINT, ent/*out*/)<0)
+ if (H5G_stab_create (f, dxpl_id, (size_t)H5G_SIZE_HINT, ent/*out*/)<0)
HGOTO_ERROR (H5E_SYM, H5E_CANTINIT, FAIL, "unable to create root group");
if (1 != H5O_link (ent, 1, dxpl_id))
HGOTO_ERROR (H5E_SYM, H5E_LINK, FAIL, "internal error (wrong link count)");
diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h
index 9bee5ee..47056d4 100644
--- a/src/H5Gpkg.h
+++ b/src/H5Gpkg.h
@@ -97,9 +97,9 @@ typedef struct H5G_bt_ud2_t {
/* downward */
hid_t group_id; /*group id to pass to iteration operator */
H5G_entry_t *ent; /*the entry to which group_id points */
- int skip; /*initial entries to skip */
H5G_iterate_t op; /*iteration operator */
void *op_data; /*user-defined operator data */
+ int skip; /*initial entries to skip */
/* upward */
int final_ent; /*final entry looked at */
diff --git a/src/H5Ipublic.h b/src/H5Ipublic.h
index 0f6e1b7..78915a6 100644
--- a/src/H5Ipublic.h
+++ b/src/H5Ipublic.h
@@ -54,6 +54,7 @@ typedef enum H5I_type_t {
/* Type of atoms to return to users */
typedef int hid_t;
+#define H5_SIZEOF_HID_T H5_SIZEOF_INT
/* An invalid object ID. This is also negative for error return. */
#define H5I_INVALID_HID (-1)
diff --git a/src/H5Opkg.h b/src/H5Opkg.h
index 5735d9c..116c223 100644
--- a/src/H5Opkg.h
+++ b/src/H5Opkg.h
@@ -77,10 +77,10 @@ typedef struct H5O_mesg_t {
const H5O_class_t *type; /*type of message */
hbool_t dirty; /*raw out of date wrt native */
uint8_t flags; /*message flags */
+ unsigned chunkno; /*chunk number for this mesg */
void *native; /*native format message */
uint8_t *raw; /*ptr to raw data */
size_t raw_size; /*size with alignment */
- unsigned chunkno; /*chunk number for this mesg */
} H5O_mesg_t;
typedef struct H5O_chunk_t {
diff --git a/src/H5P.c b/src/H5P.c
index c11a3ec..fc3359f 100644
--- a/src/H5P.c
+++ b/src/H5P.c
@@ -5166,7 +5166,7 @@ H5P_close(void *_plist)
H5SL_t *seen=NULL; /* Skip list to hold names of properties already seen */
size_t nseen; /* Number of items 'seen' */
hbool_t has_parent_class; /* Flag to indicate that this property list's class has a parent */
- ssize_t ndel; /* Number of items deleted */
+ size_t ndel; /* Number of items deleted */
H5SL_node_t *curr_node; /* Current node in skip list */
H5P_genprop_t *tmp; /* Temporary pointer to properties */
unsigned make_cb=0; /* Operator data for property free callback */
diff --git a/src/H5SHcache.c b/src/H5SHcache.c
index e8cdf30..5a57084 100644
--- a/src/H5SHcache.c
+++ b/src/H5SHcache.c
@@ -122,7 +122,7 @@ H5SH_cache_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1
HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "wrong segmented heap info version")
/* Type of data in heap blocks */
- sh->heap_type = *p++;
+ sh->heap_type = (H5SH_data_type_t)*p++;
if(sh->heap_type == H5SH_RAW)
sh->file_mem_type = H5FD_MEM_DRAW;
else
diff --git a/src/H5T.c b/src/H5T.c
index bc20caf..0c41d7f 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -675,7 +675,9 @@ H5T_init_interface(void)
H5T_t *native_ullong=NULL; /* Datatype structure for native unsigned llong */
H5T_t *native_float=NULL; /* Datatype structure for native float */
H5T_t *native_double=NULL; /* Datatype structure for native double */
+#if H5_SW_LDOUBLE_TO_INTEGER_WORKS
H5T_t *native_ldouble=NULL; /* Datatype structure for native double */
+#endif /*H5_SW_LDOUBLE_TO_INTEGER_WORKS*/
H5T_t *std_u8le=NULL; /* Datatype structure for unsigned 8-bit little-endian integer */
H5T_t *std_u8be=NULL; /* Datatype structure for unsigned 8-bit big-endian integer */
H5T_t *std_u16le=NULL; /* Datatype structure for unsigned 16-bit little-endian integer */
@@ -747,8 +749,10 @@ H5T_init_interface(void)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object");
if (NULL==(native_double=H5I_object(H5T_NATIVE_DOUBLE_g)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object");
+#if H5_SW_LDOUBLE_TO_INTEGER_WORKS
if (NULL==(native_ldouble=H5I_object(H5T_NATIVE_LDOUBLE_g)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object");
+#endif /*H5_SW_LDOUBLE_TO_INTEGER_WORKS*/
/*------------------------------------------------------------
* Native types
diff --git a/src/H5Znbit.c b/src/H5Znbit.c
index ab47461..938528c 100644
--- a/src/H5Znbit.c
+++ b/src/H5Znbit.c
@@ -130,18 +130,16 @@ static unsigned parms_index = 0;
static herr_t
H5Z_can_apply_nbit(hid_t UNUSED dcpl_id, hid_t type_id, hid_t UNUSED space_id)
{
- H5T_class_t dtype_class; /* Datatype's class */
- unsigned dtype_size; /* Datatype's size (in bytes) */
herr_t ret_value=TRUE; /* Return value */
FUNC_ENTER_NOAPI(H5Z_can_apply_nbit, FAIL)
/* Get datatype's class, for checking the "datatype class" */
- if((dtype_class = H5Tget_class(type_id)) == H5T_NO_CLASS )
+ if(H5Tget_class(type_id) == H5T_NO_CLASS )
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype class")
/* Get datatype's size, for checking the "datatype size" */
- if((dtype_size = H5Tget_size(type_id)) == 0)
+ if(H5Tget_size(type_id) == 0)
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size")
done:
diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c
index 417d60b..cfbe59c 100644
--- a/src/H5Zscaleoffset.c
+++ b/src/H5Zscaleoffset.c
@@ -31,7 +31,7 @@ typedef struct {
unsigned mem_order; /* current memory endianness order */
} parms_atomic;
-enum H5Z_scaleoffset_type {t_uchar=1, t_ushort, t_uint, t_ulong, t_ulong_long,
+enum H5Z_scaleoffset_type {t_bad=0, t_uchar=1, t_ushort, t_uint, t_ulong, t_ulong_long,
t_schar, t_short, t_int, t_long, t_long_long,
t_float, t_double};
@@ -584,7 +584,6 @@ static herr_t
H5Z_can_apply_scaleoffset(hid_t UNUSED dcpl_id, hid_t type_id, hid_t UNUSED space_id)
{
H5T_class_t dtype_class; /* Datatype's class */
- unsigned dtype_size; /* Datatype's size (in bytes) */
H5T_order_t dtype_order; /* Datatype's endianness order */
herr_t ret_value=TRUE; /* Return value */
@@ -595,7 +594,7 @@ H5Z_can_apply_scaleoffset(hid_t UNUSED dcpl_id, hid_t type_id, hid_t UNUSED spac
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype class")
/* Get datatype's size, for checking the "datatype size" */
- if((dtype_size = H5Tget_size(type_id)) == 0)
+ if(H5Tget_size(type_id) == 0)
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size")
if(dtype_class == H5T_INTEGER || dtype_class == H5T_FLOAT) {
@@ -634,9 +633,9 @@ static enum H5Z_scaleoffset_type
H5Z_scaleoffset_get_type(unsigned dtype_class, unsigned dtype_size, unsigned dtype_sign)
{
enum H5Z_scaleoffset_type type; /* integer type */
- unsigned ret_value; /* return value */
+ enum H5Z_scaleoffset_type ret_value; /* return value */
- FUNC_ENTER_NOAPI(H5Z_scaleoffset_get_type, 0)
+ FUNC_ENTER_NOAPI_NOINIT(H5Z_scaleoffset_get_type)
if(dtype_class==H5Z_SCALEOFFSET_CLS_INTEGER) {
if(dtype_sign==H5Z_SCALEOFFSET_SGN_NONE) { /* unsigned integer */
@@ -646,7 +645,7 @@ H5Z_scaleoffset_get_type(unsigned dtype_class, unsigned dtype_size, unsigned dty
else if(dtype_size == sizeof(unsigned long)) type = t_ulong;
else if(dtype_size == sizeof(unsigned long_long)) type = t_ulong_long;
else
- HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, 0, "cannot find matched memory dataype")
+ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, t_bad, "cannot find matched memory dataype")
}
if(dtype_sign==H5Z_SCALEOFFSET_SGN_2) { /* signed integer */
@@ -656,7 +655,7 @@ H5Z_scaleoffset_get_type(unsigned dtype_class, unsigned dtype_size, unsigned dty
else if(dtype_size == sizeof(long)) type = t_long;
else if(dtype_size == sizeof(long_long)) type = t_long_long;
else
- HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, 0, "cannot find matched memory dataype")
+ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, t_bad, "cannot find matched memory dataype")
}
}
@@ -664,11 +663,13 @@ H5Z_scaleoffset_get_type(unsigned dtype_class, unsigned dtype_size, unsigned dty
if(dtype_size == sizeof(float)) type = t_float;
else if(dtype_size == sizeof(double)) type = t_double;
else
- HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, 0, "cannot find matched memory dataype")
+ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, t_bad, "cannot find matched memory dataype")
}
-done:
+ /* Set return value */
ret_value = type;
+
+done:
FUNC_LEAVE_NOAPI(ret_value)
}
diff --git a/src/H5public.h b/src/H5public.h
index d4ccce1..ce4aa22 100644
--- a/src/H5public.h
+++ b/src/H5public.h
@@ -152,11 +152,13 @@ typedef long_long ssize_t;
typedef unsigned long_long hsize_t;
typedef signed long_long hssize_t;
# define H5_SIZEOF_HSIZE_T H5_SIZEOF_LONG_LONG
+# define H5_SIZEOF_HSSIZE_T H5_SIZEOF_LONG_LONG
# endif
#else /* H5_HAVE_LARGE_HSIZET */
typedef size_t hsize_t;
typedef ssize_t hssize_t;
# define H5_SIZEOF_HSIZE_T H5_SIZEOF_SIZE_T
+# define H5_SIZEOF_HSSIZE_T H5_SIZEOF_SIZE_T
#endif /* H5_HAVE_LARGE_HSIZET */
/*
diff --git a/test/bittests.c b/test/bittests.c
index cb038f7..872a01a 100644
--- a/test/bittests.c
+++ b/test/bittests.c
@@ -174,9 +174,9 @@ test_copy (void)
TESTING("bit copy operations");
for (i=0; i<NTESTS; i++) {
- s_offset = rand() % (8*sizeof v1);
- d_offset = rand() % (8*sizeof v2);
- size = (unsigned)rand() % MIN (8*sizeof(v1), 8*sizeof(v2));
+ s_offset = HDrand() % (8*sizeof v1);
+ d_offset = HDrand() % (8*sizeof v2);
+ size = (unsigned)HDrand() % MIN (8*sizeof(v1), 8*sizeof(v2));
size = MIN3 (size, 8*sizeof(v1)-s_offset, 8*sizeof(v2)-d_offset);
memset (v1, 0xff, sizeof v1);
memset (v2, 0x00, sizeof v2);
@@ -296,11 +296,11 @@ test_shift (void)
TESTING("bit shift operations");
for (i=0; i<NTESTS; i++) {
- offset = rand() % (8*sizeof vector);
- size = (unsigned)rand() % (8*sizeof(vector)-offset);
+ offset = HDrand() % (8*sizeof vector);
+ size = (unsigned)HDrand() % (8*sizeof(vector)-offset);
/* Don't want size to be 0 */
if(size == 0) continue;
- shift_dist = rand() % size;
+ shift_dist = HDrand() % size;
/*-------- LEFT-shift some bits and make sure something was shifted --------*/
memset (vector, 0x00, sizeof vector);
@@ -429,8 +429,8 @@ test_increment (void)
TESTING("bit increment operations");
for (i=0; i<NTESTS; i++) {
- offset = rand() % (8*sizeof vector);
- size = (unsigned)rand() % (8*sizeof(vector)-offset);
+ offset = HDrand() % (8*sizeof vector);
+ size = (unsigned)HDrand() % (8*sizeof(vector)-offset);
/* Don't want size to be 0 */
if(size == 0) continue;
@@ -516,8 +516,8 @@ test_decrement (void)
TESTING("bit decrement operations");
for (i=0; i<NTESTS; i++) {
- offset = rand() % (8*sizeof vector);
- size = (unsigned)rand() % (8*sizeof(vector)-offset);
+ offset = HDrand() % (8*sizeof vector);
+ size = (unsigned)HDrand() % (8*sizeof(vector)-offset);
/* Don't want size to be 0 */
if(size == 0) continue;
@@ -588,8 +588,8 @@ test_negate (void)
TESTING("bit negate operations");
for (i=0; i<NTESTS; i++) {
- offset = rand() % (8*sizeof vector);
- size = (unsigned)rand() % (8*sizeof(vector)-offset);
+ offset = HDrand() % (8*sizeof vector);
+ size = (unsigned)HDrand() % (8*sizeof(vector)-offset);
/* Don't want size to be 0 */
if(size == 0) continue;
@@ -688,8 +688,8 @@ test_set (void)
TESTING("bit set operations");
for (i=0; i<NTESTS; i++) {
- d_offset = rand() % (8*sizeof v2);
- size = (unsigned)rand() % (8*sizeof(v2));
+ d_offset = HDrand() % (8*sizeof v2);
+ size = (unsigned)HDrand() % (8*sizeof(v2));
size = MIN (size, 8*sizeof(v2)-d_offset);
memset (v2, 0x00, sizeof v2);
@@ -805,8 +805,8 @@ test_clear (void)
TESTING("bit clear operations");
for (i=0; i<NTESTS; i++) {
- d_offset = rand() % (8*sizeof v2);
- size = (unsigned)rand() % (8*sizeof(v2));
+ d_offset = HDrand() % (8*sizeof v2);
+ size = (unsigned)HDrand() % (8*sizeof(v2));
size = MIN (size, 8*sizeof(v2)-d_offset);
memset (v2, 0xff, sizeof v2);
diff --git a/test/dsets.c b/test/dsets.c
index e49d51b..b444e0e 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -2942,7 +2942,6 @@ test_nbit_array(hid_t file)
const hsize_t chunk_size[2] = {2,5};
unsigned int orig_data[2][5][3][2];
unsigned int new_data[2][5][3][2];
- unsigned int mask;
size_t precision, offset;
hsize_t i, j, m, n;
#else /* H5_HAVE_FILTER_NBIT */
@@ -3026,9 +3025,7 @@ test_nbit_array(hid_t file)
goto error;
/* Check that the values read are the same as the values written
- * Use mask for checking the significant bits, ignoring the padding bits
*/
- mask = ~(~0 << (precision + offset)) & (~0 << offset);
for (i=0; i<size[0]; i++)
for (j=0; j<size[1]; j++)
for (m = 0; m < adims[0]; m++)
@@ -3319,7 +3316,7 @@ test_nbit_compound_2(hid_t file)
5.2045898}, {-49140.000, 2350.2500, -3.2110596e-1, 6.4998865e-5, -0.0000000}};
complex orig_data[2][5];
complex new_data[2][5];
- unsigned int i_mask, s_mask, c_mask, v_mask, b_mask;
+ unsigned int i_mask, s_mask, c_mask, b_mask;
hsize_t i, j, m, n, b_failed, d_failed;
#else /* H5_HAVE_FILTER_NBIT */
@@ -3485,7 +3482,6 @@ test_nbit_compound_2(hid_t file)
i_mask = ~(~0 << (precision[0] + offset[0])) & (~0 << offset[0]);
c_mask = ~(~0 << (precision[1] + offset[1])) & (~0 << offset[1]);
s_mask = ~(~0 << (precision[2] + offset[2])) & (~0 << offset[2]);
- v_mask = ~(~0 << (precision[3] + offset[3])) & (~0 << offset[3]);
b_mask = ~(~0 << (precision[4] + offset[4])) & (~0 << offset[4]);
for (i=0; i<size[0]; i++) {
for (j=0; j<size[1]; j++) {
@@ -3587,7 +3583,7 @@ test_nbit_compound_3(hid_t file)
} atomic;
hid_t i_tid, str_tid, vl_str_tid, v_tid, o_tid;
hid_t cmpd_tid; /* atomic compound datatype */
- hid_t dataset, space, dc, obj_ref_dataset;
+ hid_t dataset, space, dc, obj_ref_dataset = -1;
const hsize_t size[1] = {5};
const hsize_t chunk_size[1] = {5};
atomic orig_data[5];
@@ -3739,6 +3735,7 @@ test_nbit_compound_3(hid_t file)
if (H5Tclose(cmpd_tid)<0) goto error;
if (H5Pclose(dc)<0) goto error;
if (H5Sclose(space)<0) goto error;
+ if (H5Dclose(obj_ref_dataset)<0) goto error;
if (H5Dclose(dataset)<0) goto error;
PASSED();
@@ -3910,7 +3907,7 @@ test_scaleoffset_int_2(hid_t file)
const hsize_t chunk_size[2] = {2,5};
int orig_data[2][5];
int new_data[2][5];
- hssize_t start[2]; /* Start of hyperslab */
+ hsize_t start[2]; /* Start of hyperslab */
hsize_t stride[2]; /* Stride of hyperslab */
hsize_t count[2]; /* Block count */
hsize_t block[2]; /* Block sizes */
@@ -4006,7 +4003,7 @@ test_scaleoffset_int_2(hid_t file)
if (new_data[0][j] != orig_data[0][j]) {
H5_FAILED();
printf(" Read different values than written.\n");
- printf(" At index %lu,%lu\n", 0, (unsigned long)j);
+ printf(" At index %lu,%lu\n", (unsigned long)0, (unsigned long)j);
goto error;
}
}
@@ -4190,7 +4187,7 @@ test_scaleoffset_float_2(hid_t file)
float orig_data[2][5];
float new_data[2][5];
float fillval;
- hssize_t start[2]; /* Start of hyperslab */
+ hsize_t start[2]; /* Start of hyperslab */
hsize_t stride[2]; /* Stride of hyperslab */
hsize_t count[2]; /* Block count */
hsize_t block[2]; /* Block sizes */
@@ -4287,7 +4284,7 @@ test_scaleoffset_float_2(hid_t file)
if (HDfabs(new_data[0][j]-orig_data[0][j]) > HDpow(10, -3)) {
H5_FAILED();
printf(" Read different values than written.\n");
- printf(" At index %lu,%lu\n", 0, (unsigned long)j);
+ printf(" At index %lu,%lu\n", (unsigned long)0, (unsigned long)j);
goto error;
}
}
@@ -4470,7 +4467,7 @@ test_scaleoffset_double_2(hid_t file)
double orig_data[2][5];
double new_data[2][5];
double fillval;
- hssize_t start[2]; /* Start of hyperslab */
+ hsize_t start[2]; /* Start of hyperslab */
hsize_t stride[2]; /* Stride of hyperslab */
hsize_t count[2]; /* Block count */
hsize_t block[2]; /* Block sizes */
@@ -4567,7 +4564,7 @@ test_scaleoffset_double_2(hid_t file)
if (HDfabs(new_data[0][j]-orig_data[0][j]) > HDpow(10, -7)) {
H5_FAILED();
printf(" Read different values than written.\n");
- printf(" At index %lu,%lu\n", 0, (unsigned long)j);
+ printf(" At index %lu,%lu\n", (unsigned long)0, (unsigned long)j);
goto error;
}
}
@@ -5982,7 +5979,8 @@ error:
*
*-------------------------------------------------------------------------
*/
-int main(void)
+int
+main(void)
{
hid_t file, grp, fapl;
int mdc_nelmts;
@@ -5996,7 +5994,7 @@ int main(void)
fapl = h5_fileaccess();
/* Set the random # seed */
- HDsrandom((unsigned long)HDtime(NULL));
+ HDsrandom((unsigned long)HDtime(NULL));
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
diff --git a/test/dt_atomic.c b/test/dt_atomic.c
index 7348a9f..31a7c76 100644
--- a/test/dt_atomic.c
+++ b/test/dt_atomic.c
@@ -275,7 +275,7 @@ static int without_hardware_g = 0;
#define INIT_FP_SPECIAL(SRC_SIZE, SRC_PREC, SRC_ORDR, SRC_MANT_DIG, DST_SIZE, \
BUF, SAVED, NELMTS) \
{ \
- unsigned char *buf_p, *saved_p; \
+ unsigned char *buf_p; \
unsigned char *value; \
int n; \
\
@@ -291,7 +291,6 @@ static int without_hardware_g = 0;
value = (unsigned char*)calloc(SRC_SIZE, sizeof(unsigned char)); \
\
buf_p = BUF; \
- saved_p = SAVED; \
\
/* +0 */ \
H5T_bit_set(value, 0, SRC_PREC, FALSE); \
@@ -562,8 +561,7 @@ test_derived_flt(void)
hid_t file=-1, tid1=-1, tid2=-1;
hid_t dxpl_id=-1;
char filename[1024];
- size_t precision, spos, epos, esize, mpos, msize, size, ebias;
- int offset;
+ size_t spos, epos, esize, mpos, msize, size;
size_t src_size, dst_size;
unsigned char *buf=NULL, *saved_buf=NULL;
int *aligned=NULL;
@@ -679,12 +677,12 @@ test_derived_flt(void)
goto error;
}
- if((precision = H5Tget_precision(tid1))!=42) {
+ if(H5Tget_precision(tid1)!=42) {
H5_FAILED();
printf("Can't get precision or wrong precision\n");
goto error;
}
- if((offset = H5Tget_offset(tid1))!=3) {
+ if(H5Tget_offset(tid1)!=3) {
H5_FAILED();
printf("Can't get offset or wrong offset\n");
goto error;
@@ -694,7 +692,7 @@ test_derived_flt(void)
printf("Can't get size or wrong size\n");
goto error;
}
- if((ebias = H5Tget_ebias(tid1))!=511) {
+ if(H5Tget_ebias(tid1)!=511) {
H5_FAILED();
printf("Can't get exponent bias or wrong bias\n");
goto error;
@@ -841,12 +839,12 @@ test_derived_flt(void)
goto error;
}
- if((precision = H5Tget_precision(tid2))!=24) {
+ if(H5Tget_precision(tid2)!=24) {
H5_FAILED();
printf("Can't get precision or wrong precision\n");
goto error;
}
- if((offset = H5Tget_offset(tid2))!=0) {
+ if(H5Tget_offset(tid2)!=0) {
H5_FAILED();
printf("Can't get offset or wrong offset\n");
goto error;
@@ -856,7 +854,7 @@ test_derived_flt(void)
printf("Can't get size or wrong size\n");
goto error;
}
- if((ebias = H5Tget_ebias(tid2))!=63) {
+ if(H5Tget_ebias(tid2)!=63) {
H5_FAILED();
printf("Can't get exponent bias or wrong bias\n");
goto error;
@@ -1003,10 +1001,6 @@ test_derived_integer(void)
hid_t file=-1, tid1=-1, tid2=-1;
hid_t dxpl_id=-1;
char filename[1024];
- size_t precision, size;
- int offset;
- H5T_order_t order;
- H5T_sign_t sign;
size_t src_size, dst_size;
unsigned char *buf=NULL, *saved_buf=NULL;
int *aligned=NULL;
@@ -1099,22 +1093,22 @@ test_derived_integer(void)
goto error;
}
- if((precision = H5Tget_precision(tid1))!=24) {
+ if(H5Tget_precision(tid1)!=24) {
H5_FAILED();
printf("Can't get precision or wrong precision\n");
goto error;
}
- if((offset = H5Tget_offset(tid1))!=0) {
+ if(H5Tget_offset(tid1)!=0) {
H5_FAILED();
printf("Can't get offset or wrong offset\n");
goto error;
}
- if((size = H5Tget_size(tid1))!=3) {
+ if(H5Tget_size(tid1)!=3) {
H5_FAILED();
printf("Can't get size or wrong size\n");
goto error;
}
- if((order = H5Tget_order(tid1))!=H5T_ORDER_BE) {
+ if(H5Tget_order(tid1)!=H5T_ORDER_BE) {
H5_FAILED();
printf("Can't get order or wrong order\n");
goto error;
@@ -1164,22 +1158,22 @@ test_derived_integer(void)
goto error;
}
- if((precision = H5Tget_precision(tid2))!=48) {
+ if(H5Tget_precision(tid2)!=48) {
H5_FAILED();
printf("Can't get precision or wrong precision\n");
goto error;
}
- if((offset = H5Tget_offset(tid2))!=10) {
+ if(H5Tget_offset(tid2)!=10) {
H5_FAILED();
printf("Can't get offset or wrong offset\n");
goto error;
}
- if((size = H5Tget_size(tid2))!=8) {
+ if(H5Tget_size(tid2)!=8) {
H5_FAILED();
printf("Can't get size or wrong size\n");
goto error;
}
- if((sign = H5Tget_sign(tid2))!=H5T_SGN_2) {
+ if(H5Tget_sign(tid2)!=H5T_SGN_2) {
H5_FAILED();
printf("Can't get sign or wrong sign\n");
goto error;
@@ -4476,13 +4470,11 @@ int
main(void)
{
unsigned long nerrors = 0;
- hid_t fapl=-1;
/* Set the random # seed */
HDsrandom((unsigned long)HDtime(NULL));
reset_hdf5();
- fapl = h5_fileaccess();
if (ALIGNMENT)
printf("Testing non-aligned conversions (ALIGNMENT=%d)....\n", ALIGNMENT);
diff --git a/test/testmeta.c b/test/testmeta.c
index c7edafc..03fd841 100644
--- a/test/testmeta.c
+++ b/test/testmeta.c
@@ -41,8 +41,8 @@
int main(void)
{
hid_t file_id, prop_id, memspace_id, type_id;
- hid_t group_id, access_plist;
- hid_t dataset_id, dataspace_id, s_dataspace_id;
+ hid_t group_id;
+ hid_t dataset_id, dataspace_id;
herr_t status;
hsize_t dims[1];
hsize_t maxdims[1];
@@ -51,7 +51,7 @@ int main(void)
unsigned numdataobj = 0;
unsigned i, j;
char name[80];
- hssize_t start[1] = {0};
+ hsize_t start[1] = {0};
hsize_t stride[1] = {1};
hsize_t count[1] = {1};
diff --git a/tools/gifconv/readhdf.c b/tools/gifconv/readhdf.c
index 4b05ad9..2720d4d 100644
--- a/tools/gifconv/readhdf.c
+++ b/tools/gifconv/readhdf.c
@@ -86,7 +86,7 @@ int ReadHDF(BYTE** data, BYTE palette[256][3], hsize_t *image_size,
return -1;
}
if (H5Tget_size(dtype) != 1) {
- fprintf(stderr , "Data is %d bytes per pixel. Cannot convert to GIF\n",H5Tget_size(dtype));
+ fprintf(stderr , "Data is %d bytes per pixel. Cannot convert to GIF\n",(int)H5Tget_size(dtype));
return -1;
}
@@ -141,7 +141,7 @@ int ReadHDF(BYTE** data, BYTE palette[256][3], hsize_t *image_size,
return -1;
}
if (H5Tget_size(pal_dtype) != 1) {
- fprintf(stderr , "Palette data is %d bytes per pixel. Cannot convert to GIF\n",H5Tget_size(pal_dtype));
+ fprintf(stderr , "Palette data is %d bytes per pixel. Cannot convert to GIF\n",(int)H5Tget_size(pal_dtype));
return -1;
}
diff --git a/tools/gifconv/writehdf.c b/tools/gifconv/writehdf.c
index 7df7f29..d343aae 100644
--- a/tools/gifconv/writehdf.c
+++ b/tools/gifconv/writehdf.c
@@ -25,7 +25,6 @@ static int write_text_attribute(hid_t dataset_id , const char *attr_name,
const char *attr_value, const size_t attr_len)
{
/* variables for the attributes */
- hsize_t attr_dims; /* dimensions for the attribute */
hsize_t attr_size; /* dimensions for the attribute */
hid_t attr_dataspace_id; /* dataspaces needed for the various attributes */
hid_t attr_attr_id; /* attribute id */
@@ -35,8 +34,6 @@ static int write_text_attribute(hid_t dataset_id , const char *attr_name,
if (!attr_name || !attr_value)
return -1;
- attr_dims = 1;
-
/* figure out size of the data */
attr_size = (hsize_t)attr_len;
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c
index a13232d..d9380d0 100644
--- a/tools/lib/h5diff.c
+++ b/tools/lib/h5diff.c
@@ -487,7 +487,9 @@ diff_match (hid_t file1_id,
{
if (table->objs[i].flags[0] && table->objs[i].flags[1])
{
+#ifdef H5_HAVE_PARALLEL
int workerFound = 0;
+#endif /* H5_HAVE_PARALLEL */
options->cmn_objs = 1;
if(!g_Parallel)
{
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c
index 32fea3d..c611715 100644
--- a/tools/lib/h5tools_str.c
+++ b/tools/lib/h5tools_str.c
@@ -312,10 +312,9 @@ h5tools_str_prefix(h5tools_str_t *str/*in,out*/, const h5dump_t *info,
hsize_t elmtno, int ndims, hsize_t min_idx[],
hsize_t max_idx[], h5tools_context_t *ctx)
{
- hsize_t p_prod[H5S_MAX_RANK], p_idx[H5S_MAX_RANK];
- hsize_t n, i = 0;
+ hsize_t p_prod[H5S_MAX_RANK];
+ hsize_t i = 0;
hsize_t curr_pos=elmtno;
-
h5tools_str_reset(str);
@@ -327,13 +326,6 @@ h5tools_str_prefix(h5tools_str_t *str/*in,out*/, const h5dump_t *info,
for (i = ndims - 1, p_prod[ndims - 1] = 1; i > 0; --i)
p_prod[i - 1] = (max_idx[i] - min_idx[i]) * p_prod[i];
- /* Calculate the index values from the element number. */
- for (i = 0, n = elmtno; i < (hsize_t)ndims; i++) {
- p_idx[i] = n / p_prod[i] + min_idx[i];
- n %= p_prod[i];
- }
-
-
for ( i = 0; i < (hsize_t)ndims; i++)
{
ctx->pos[i] = curr_pos/ctx->acc[i];