summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2014-03-17 14:28:40 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2014-03-17 14:28:40 (GMT)
commitf2aa62ec76993c04c807c27e7a577a1ac3b0da3f (patch)
tree8bfa87fd91e47b88afc4c98e2ba0c2c97e3a10f1
parent4ffe2f78c524e8edfc4be77117187870a5fd5a7a (diff)
downloadhdf5-f2aa62ec76993c04c807c27e7a577a1ac3b0da3f.zip
hdf5-f2aa62ec76993c04c807c27e7a577a1ac3b0da3f.tar.gz
hdf5-f2aa62ec76993c04c807c27e7a577a1ac3b0da3f.tar.bz2
[svn-r24810] Description:
Bring r24803 & r24804 from trunk to 1.8 branch: r24804: Brought changes from Coverity branch back to trunk, and cleaned up misc. other warnings & formatting issues: r20833: Fixed Coverity 667 and 668 with real integer overflow tests this time. r20834: Use HDstrncpy and HDstrncat. --gh r20835: Change to use strncpy - use base_len + 1 for line 156, use HDstrlen(path) + 1 for line 159 r20836: Fixed coverity 585 by casting output of fgetc() to a char. r20837: Changed sprintf calls to snprintf with size 1 less than the allocated buffer to address coverity issue #967. r24803: Rename GCC_DIAG_OFF/ON macros to H5_GCC_DIAG_OFF/ON and move from src/H5private.h to src/H5public.h. Wrap typedef of hsize_t and hssize_t in DIAG_OFF(long-long) macros. Clean up a bunch of "macro '-' is unused" warnings. Tested on: Mac OSX/64 10.9.2 (amazon) w/C++, FORTRAN & parallel (too minor to require h5committest)
-rw-r--r--hl/test/test_image.c24
-rw-r--r--hl/tools/gif2h5/decompress.c6
-rw-r--r--hl/tools/gif2h5/gif2mem.c2
-rw-r--r--hl/tools/gif2h5/hdfgifwr.c65
-rw-r--r--perform/sio_engine.c12
-rw-r--r--perform/zip_perf.c6
-rw-r--r--src/H5Tconv.c108
-rw-r--r--src/H5private.h19
-rw-r--r--src/H5public.h21
-rw-r--r--test/H5srcdir.h8
-rw-r--r--test/cross_read.c2
-rw-r--r--test/dt_arith.c174
-rw-r--r--test/gen_cross.c2
-rw-r--r--test/gen_new_group.c7
-rw-r--r--test/h5test.c152
-rw-r--r--test/testmeta.c2
-rw-r--r--test/titerate.c1
-rw-r--r--test/ttime.c2
-rw-r--r--test/ttsafe_dcreate.c1
-rw-r--r--test/tunicode.c3
-rw-r--r--test/tvltypes.c5
-rw-r--r--tools/h5import/h5import.c17
-rw-r--r--tools/h5jam/getub.c23
-rw-r--r--tools/h5jam/h5jamgentest.c31
-rw-r--r--tools/h5jam/tellub.c23
-rw-r--r--tools/lib/h5diff.c2
-rw-r--r--tools/lib/h5trav.c102
-rw-r--r--tools/lib/h5trav.h12
-rw-r--r--tools/misc/h5repart_gentest.c1
29 files changed, 332 insertions, 501 deletions
diff --git a/hl/test/test_image.c b/hl/test/test_image.c
index 5a52980..d2d9cab 100644
--- a/hl/test/test_image.c
+++ b/hl/test/test_image.c
@@ -13,8 +13,10 @@
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#include <limits.h>
#include <stdlib.h>
#include <string.h>
+
#include "h5hltest.h"
#include "H5srcdir.h"
#include "H5LTpublic.h"
@@ -634,10 +636,12 @@ static int test_generate(void)
if(n_elements > INT_MAX / (int)sizeof(float))
goto out;
- data = (float *)HDmalloc((size_t)n_elements * sizeof( float ));
- HDassert(data);
- image_data = (unsigned char *)HDmalloc((size_t)n_elements * sizeof( unsigned char ));
- HDassert(image_data);
+ data = (float *)HDmalloc((size_t)n_elements * sizeof(float));
+ if(NULL == data)
+ goto out;
+ image_data = (unsigned char *)HDmalloc((size_t)n_elements * sizeof(unsigned char));
+ if(NULL == image_data)
+ goto out;
for ( i = 0; i < n_elements; i++ )
{
@@ -806,9 +810,6 @@ static int read_data( const char* fname, /*IN*/
fscanf(f, "%s", str);
fscanf(f, "%d", &w);
- *width = (hsize_t)w;
- *height = (hsize_t)h;
-
/* Check product for overflow */
if(w < 1 || h < 1 || color_planes < 1)
goto out;
@@ -825,13 +826,16 @@ static int read_data( const char* fname, /*IN*/
goto out;
/* Release the buffer, if it was previously allocated */
- if(image_data) {
+ if(image_data)
HDfree(image_data);
- image_data = NULL;
- } /* end if */
/* Allocate the image data buffer */
image_data = (unsigned char *)HDmalloc((size_t)n_elements * sizeof(unsigned char));
+ if(NULL == image_data)
+ goto out;
+
+ *width = (hsize_t)w;
+ *height = (hsize_t)h;
/* Read data elements */
for(i = 0; i < n_elements; i++) {
diff --git a/hl/tools/gif2h5/decompress.c b/hl/tools/gif2h5/decompress.c
index 2e44f1c..d4e4cdc 100644
--- a/hl/tools/gif2h5/decompress.c
+++ b/hl/tools/gif2h5/decompress.c
@@ -17,12 +17,6 @@
#include "gif.h"
-#define NEXTBYTE (*ptr++)
-
-#define IMAGESEP 0x2c
-#define INTERLACEMASK 0x40
-#define COLORMAPMASK 0x80
-
WORD iWIDE, iHIGH, eWIDE, eHIGH, expand, numcols, strip, nostrip;
unsigned long cols[256];
char *cmd;
diff --git a/hl/tools/gif2h5/gif2mem.c b/hl/tools/gif2h5/gif2mem.c
index 7995bb4..ac4b0ec 100644
--- a/hl/tools/gif2h5/gif2mem.c
+++ b/hl/tools/gif2h5/gif2mem.c
@@ -37,8 +37,6 @@
#include "gif.h"
-#define GIF2VERSION "1.00"
-
GIFTOMEM
Gif2Mem(BYTE *MemGif)
{
diff --git a/hl/tools/gif2h5/hdfgifwr.c b/hl/tools/gif2h5/hdfgifwr.c
index 1771d06..d828226 100644
--- a/hl/tools/gif2h5/hdfgifwr.c
+++ b/hl/tools/gif2h5/hdfgifwr.c
@@ -56,31 +56,6 @@
typedef BYTE byte;
typedef long int count_int;
-/* indicies into conv24MB */
-#define CONV24_8BIT 0
-#define CONV24_24BIT 1
-#define CONV24_SEP1 2
-#define CONV24_LOCK 3
-#define CONV24_SEP2 4
-#define CONV24_FAST 5
-#define CONV24_SLOW 6
-#define CONV24_BEST 7
-#define CONV24_MAX 8
-
-/* values 'picType' can take */
-#define PIC8 CONV24_8BIT
-#define PIC24 CONV24_24BIT
-
-/* MONO returns total intensity of r,g,b components */
-#define MONO(rd,gn,bl) (((rd)*11 + (gn)*16 + (bl)*5) >> 5) /*.33R+ .5G+ .17B*/
-
-#ifdef UNUSED
-static int Width, Height;
-static int curx, cury;
-static long CountDown;
-static int Interlace;
-#endif /* UNUSED */
-
#ifdef __STDC__
static void compress(int, FILE *, byte *, int);
static void output(int);
@@ -95,20 +70,12 @@ static void char_init(), char_out(), flush_char();
#endif /* __STDC__ */
static byte pc2nc[256];
-#ifdef UNUSED
-static byte r1[256],g1[256],b1[256];
-#endif /* UNUSED */
/*************************************************************/
int hdfWriteGIF(FILE *fp, byte *pic, int ptype, int w, int h, byte *rmap,
byte *gmap, byte *bmap, byte *pc2ncmap, int numcols,
int colorstyle, int BitsPerPixel)
{
-#ifdef UNUSED
- int RWidth, RHeight;
- int LeftOfs, TopOfs;
- int ColorMapSize, Background;
-#endif /* UNUSED */
int InitCodeSize;
int i;
byte *pic8 = pic;
@@ -121,39 +88,15 @@ int hdfWriteGIF(FILE *fp, byte *pic, int ptype, int w, int h, byte *rmap,
numcols=numcols;
colorstyle=colorstyle;
-#ifdef UNUSED
- Interlace = 0;
- Background = 0;
-#endif /* UNUSED */
-
for (i = 0; i < 256; i++) {
pc2nc[i] = pc2ncmap[i];
-#ifdef UNUSED
- r1[i] = rmap[i];
- g1[i] = gmap[i];
- b1[i] = bmap[i];
-#endif /* UNUSED */
}
-#ifdef UNUSED
- ColorMapSize = 1 << BitsPerPixel;
-
- RWidth = Width = w;
- RHeight = Height = h;
- LeftOfs = TopOfs = 0;
-
- CountDown = w * h; /* # of pixels we'll be doing */
-#endif /* UNUSED */
-
if (BitsPerPixel <= 1)
InitCodeSize = 2;
else
InitCodeSize = BitsPerPixel;
-#ifdef UNUSED
- curx = cury = 0;
-#endif /* UNUSED */
-
if (!fp) {
fprintf(stderr, "WriteGIF: file not open for writing\n" );
return (1);
@@ -172,11 +115,7 @@ static unsigned long cur_accum = 0;
static int cur_bits = 0;
#define MAXCODE(n_bits) ( (1 << (n_bits)) - 1)
-#ifndef min
-#define min(a,b) ((a>b) ? b : a)
-#endif /* min */
#define XV_BITS 12 /* BITS was already defined on some systems */
-#define MSDOS 1
#define HSIZE 5003 /* 80% occupancy */
typedef unsigned char char_type;
@@ -203,10 +142,6 @@ static int hsize = HSIZE; /* for dynamic table sizing */
* used to be 8000 characters).
*/
-#define tab_prefixof(i) CodeTabOf(i)
-#define tab_suffixof(i) ((char_type *)(htab))[i]
-#define de_stack ((char_type *)&tab_suffixof(1<<XV_BITS))
-
static int free_ent = 0; /* first unused entry */
/*
diff --git a/perform/sio_engine.c b/perform/sio_engine.c
index 4ce3aa0..0ab5c3e 100644
--- a/perform/sio_engine.c
+++ b/perform/sio_engine.c
@@ -38,22 +38,14 @@
/* Macro definitions */
/* sizes of various items. these sizes won't change during program execution */
-/* The following three must have the same type */
-#define ELMT_SIZE (sizeof(unsigned char)) /* we're doing bytes */
#define ELMT_H5_TYPE H5T_NATIVE_UCHAR
#define GOTOERROR(errcode) { ret_code = errcode; goto done; }
-#define GOTODONE { goto done; }
#define ERRMSG(mesg) { \
fprintf(stderr, "*** Assertion failed (%s) at line %4d in %s\n", \
mesg, (int)__LINE__, __FILE__); \
}
-#define MSG(mesg) { \
- fprintf(stderr, "(%s) at line %4d in %s\n", \
- mesg, (int)__LINE__, __FILE__); \
-}
-
/* verify: if val is false (0), print mesg. */
#define VRFY(val, mesg) do { \
if (!val) { \
@@ -81,10 +73,6 @@ static int clean_file_g = -1; /*whether to cleanup temporary test */
/*files. -1 is not defined; */
/*0 is no cleanup; 1 is do cleanup */
-#ifndef MIN
-# define MIN(a,b) ((a) < (b) ? (a) : (b))
-#endif /* !MIN */
-
/* the different types of file descriptors we can expect */
typedef union _file_descr {
int posixfd; /* POSIX file handle*/
diff --git a/perform/zip_perf.c b/perform/zip_perf.c
index f76e10b..edd5b0f 100644
--- a/perform/zip_perf.c
+++ b/perform/zip_perf.c
@@ -32,19 +32,13 @@
#ifdef VMS
# define unlink delete
-# define GZ_SUFFIX "-gz"
#endif /* VMS */
#ifdef RISCOS
# define unlink remove
-# define GZ_SUFFIX "-gz"
# define fileno(file) file->__file
#endif /* RISCOS */
-#ifndef GZ_SUFFIX
-# define GZ_SUFFIX ".gz"
-#endif /* GZ_SUFFIX */
-
#define ONE_KB 1024
#define ONE_MB (ONE_KB * ONE_KB)
#define ONE_GB (ONE_MB * ONE_KB)
diff --git a/src/H5Tconv.c b/src/H5Tconv.c
index 50e9dc5..72da1bd 100644
--- a/src/H5Tconv.c
+++ b/src/H5Tconv.c
@@ -8039,9 +8039,9 @@ H5T__conv_float_schar (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
-GCC_DIAG_OFF(float-equal)
+H5_GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(FLOAT, SCHAR, float, signed char, SCHAR_MIN, SCHAR_MAX);
-GCC_DIAG_ON(float-equal)
+H5_GCC_DIAG_ON(float-equal)
}
@@ -8066,9 +8066,9 @@ H5T__conv_float_uchar (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
-GCC_DIAG_OFF(float-equal)
+H5_GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(FLOAT, UCHAR, float, unsigned char, 0, UCHAR_MAX);
-GCC_DIAG_ON(float-equal)
+H5_GCC_DIAG_ON(float-equal)
}
@@ -8093,9 +8093,9 @@ H5T__conv_double_schar (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
-GCC_DIAG_OFF(float-equal)
+H5_GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(DOUBLE, SCHAR, double, signed char, SCHAR_MIN, SCHAR_MAX);
-GCC_DIAG_ON(float-equal)
+H5_GCC_DIAG_ON(float-equal)
}
@@ -8120,9 +8120,9 @@ H5T__conv_double_uchar (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
-GCC_DIAG_OFF(float-equal)
+H5_GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(DOUBLE, UCHAR, double, unsigned char, 0, UCHAR_MAX);
-GCC_DIAG_ON(float-equal)
+H5_GCC_DIAG_ON(float-equal)
}
@@ -8148,9 +8148,9 @@ H5T__conv_ldouble_schar (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
-GCC_DIAG_OFF(float-equal)
+H5_GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(LDOUBLE, SCHAR, long double, signed char, SCHAR_MIN, SCHAR_MAX);
-GCC_DIAG_ON(float-equal)
+H5_GCC_DIAG_ON(float-equal)
}
#endif /* H5T_CONV_INTERNAL_LDOUBLE_INTEGER */
@@ -8177,9 +8177,9 @@ H5T__conv_ldouble_uchar (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
-GCC_DIAG_OFF(float-equal)
+H5_GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(LDOUBLE, UCHAR, long double, unsigned char, 0, UCHAR_MAX);
-GCC_DIAG_ON(float-equal)
+H5_GCC_DIAG_ON(float-equal)
}
#endif /* H5T_CONV_INTERNAL_LDOUBLE_INTEGER */
@@ -8205,9 +8205,9 @@ H5T__conv_float_short (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
-GCC_DIAG_OFF(float-equal)
+H5_GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(FLOAT, SHORT, float, short, SHRT_MIN, SHRT_MAX);
-GCC_DIAG_ON(float-equal)
+H5_GCC_DIAG_ON(float-equal)
}
@@ -8232,9 +8232,9 @@ H5T__conv_float_ushort (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
-GCC_DIAG_OFF(float-equal)
+H5_GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(FLOAT, USHORT, float, unsigned short, 0, USHRT_MAX);
-GCC_DIAG_ON(float-equal)
+H5_GCC_DIAG_ON(float-equal)
}
@@ -8259,9 +8259,9 @@ H5T__conv_double_short (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
-GCC_DIAG_OFF(float-equal)
+H5_GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(DOUBLE, SHORT, double, short, SHRT_MIN, SHRT_MAX);
-GCC_DIAG_ON(float-equal)
+H5_GCC_DIAG_ON(float-equal)
}
@@ -8286,9 +8286,9 @@ H5T__conv_double_ushort (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
-GCC_DIAG_OFF(float-equal)
+H5_GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(DOUBLE, USHORT, double, unsigned short, 0, USHRT_MAX);
-GCC_DIAG_ON(float-equal)
+H5_GCC_DIAG_ON(float-equal)
}
@@ -8314,9 +8314,9 @@ H5T__conv_ldouble_short (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
-GCC_DIAG_OFF(float-equal)
+H5_GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(LDOUBLE, SHORT, long double, short, SHRT_MIN, SHRT_MAX);
-GCC_DIAG_ON(float-equal)
+H5_GCC_DIAG_ON(float-equal)
}
#endif /*H5T_CONV_INTERNAL_LDOUBLE_INTEGER*/
@@ -8343,9 +8343,9 @@ H5T__conv_ldouble_ushort (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
-GCC_DIAG_OFF(float-equal)
+H5_GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(LDOUBLE, USHORT, long double, unsigned short, 0, USHRT_MAX);
-GCC_DIAG_ON(float-equal)
+H5_GCC_DIAG_ON(float-equal)
}
#endif /* H5T_CONV_INTERNAL_LDOUBLE_INTEGER */
@@ -8371,9 +8371,9 @@ H5T__conv_float_int (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
-GCC_DIAG_OFF(float-equal)
+H5_GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(FLOAT, INT, float, int, INT_MIN, INT_MAX);
-GCC_DIAG_ON(float-equal)
+H5_GCC_DIAG_ON(float-equal)
}
@@ -8398,9 +8398,9 @@ H5T__conv_float_uint (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
-GCC_DIAG_OFF(float-equal)
+H5_GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(FLOAT, UINT, float, unsigned int, 0, UINT_MAX);
-GCC_DIAG_ON(float-equal)
+H5_GCC_DIAG_ON(float-equal)
}
@@ -8425,9 +8425,9 @@ H5T__conv_double_int (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
-GCC_DIAG_OFF(float-equal)
+H5_GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(DOUBLE, INT, double, int, INT_MIN, INT_MAX);
-GCC_DIAG_ON(float-equal)
+H5_GCC_DIAG_ON(float-equal)
}
@@ -8452,9 +8452,9 @@ H5T__conv_double_uint (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
-GCC_DIAG_OFF(float-equal)
+H5_GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(DOUBLE, UINT, double, unsigned int, 0, UINT_MAX);
-GCC_DIAG_ON(float-equal)
+H5_GCC_DIAG_ON(float-equal)
}
@@ -8480,9 +8480,9 @@ H5T__conv_ldouble_int (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
-GCC_DIAG_OFF(float-equal)
+H5_GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(LDOUBLE, INT, long double, int, INT_MIN, INT_MAX);
-GCC_DIAG_ON(float-equal)
+H5_GCC_DIAG_ON(float-equal)
}
#endif /* H5T_CONV_INTERNAL_LDOUBLE_INTEGER */
@@ -8509,9 +8509,9 @@ H5T__conv_ldouble_uint (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
-GCC_DIAG_OFF(float-equal)
+H5_GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(LDOUBLE, UINT, long double, unsigned int, 0, UINT_MAX);
-GCC_DIAG_ON(float-equal)
+H5_GCC_DIAG_ON(float-equal)
}
#endif /* H5T_CONV_INTERNAL_LDOUBLE_UINT */
@@ -8537,9 +8537,9 @@ H5T__conv_float_long (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
-GCC_DIAG_OFF(float-equal)
+H5_GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(FLOAT, LONG, float, long, LONG_MIN, LONG_MAX);
-GCC_DIAG_ON(float-equal)
+H5_GCC_DIAG_ON(float-equal)
}
@@ -8564,9 +8564,9 @@ H5T__conv_float_ulong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
-GCC_DIAG_OFF(float-equal)
+H5_GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(FLOAT, ULONG, float, unsigned long, 0, ULONG_MAX);
-GCC_DIAG_ON(float-equal)
+H5_GCC_DIAG_ON(float-equal)
}
@@ -8591,9 +8591,9 @@ H5T__conv_double_long (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
-GCC_DIAG_OFF(float-equal)
+H5_GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(DOUBLE, LONG, double, long, LONG_MIN, LONG_MAX);
-GCC_DIAG_ON(float-equal)
+H5_GCC_DIAG_ON(float-equal)
}
@@ -8618,9 +8618,9 @@ H5T__conv_double_ulong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
-GCC_DIAG_OFF(float-equal)
+H5_GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(DOUBLE, ULONG, double, unsigned long, 0, ULONG_MAX);
-GCC_DIAG_ON(float-equal)
+H5_GCC_DIAG_ON(float-equal)
}
@@ -8646,9 +8646,9 @@ H5T__conv_ldouble_long (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
-GCC_DIAG_OFF(float-equal)
+H5_GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(LDOUBLE, LONG, long double, long, LONG_MIN, LONG_MAX);
-GCC_DIAG_ON(float-equal)
+H5_GCC_DIAG_ON(float-equal)
}
#endif /*H5T_CONV_INTERNAL_LDOUBLE_INTEGER*/
@@ -8675,9 +8675,9 @@ H5T__conv_ldouble_ulong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
-GCC_DIAG_OFF(float-equal)
+H5_GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(LDOUBLE, ULONG, long double, unsigned long, 0, ULONG_MAX);
-GCC_DIAG_ON(float-equal)
+H5_GCC_DIAG_ON(float-equal)
}
#endif /* H5T_CONV_INTERNAL_LDOUBLE_INTEGER */
@@ -8704,9 +8704,9 @@ H5T__conv_float_llong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
-GCC_DIAG_OFF(float-equal)
+H5_GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(FLOAT, LLONG, float, long long, LLONG_MIN, LLONG_MAX);
-GCC_DIAG_ON(float-equal)
+H5_GCC_DIAG_ON(float-equal)
}
#endif /* H5T_CONV_INTERNAL_FP_LLONG */
@@ -8760,9 +8760,9 @@ H5T__conv_double_llong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
-GCC_DIAG_OFF(float-equal)
+H5_GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(DOUBLE, LLONG, double, long long, LLONG_MIN, LLONG_MAX);
-GCC_DIAG_ON(float-equal)
+H5_GCC_DIAG_ON(float-equal)
}
#endif /*H5T_CONV_INTERNAL_FP_LLONG*/
@@ -8816,9 +8816,9 @@ H5T__conv_ldouble_llong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
-GCC_DIAG_OFF(float-equal)
+H5_GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(LDOUBLE, LLONG, long double, long long, LLONG_MIN, LLONG_MAX);
-GCC_DIAG_ON(float-equal)
+H5_GCC_DIAG_ON(float-equal)
}
#endif /*H5T_CONV_INTERNAL_LDOUBLE_LLONG*/
diff --git a/src/H5private.h b/src/H5private.h
index 7462eda..f8ede63 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -2062,25 +2062,6 @@ static herr_t H5_INTERFACE_INIT_FUNC(void);
#define HDcompile_assert(e) do { typedef struct { unsigned int b: (e); } x; } while(0)
*/
-/* Macros for enabling/disabling particular GCC warnings */
-/* (see the following web-sites for more info:
- * http://www.dbp-consulting.com/tutorials/SuppressingGCCWarnings.html
- * http://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html#Diagnostic-Pragmas
- */
-/* These pragmas are only implemented usefully in gcc 4.6+ */
-#if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406
- #define GCC_DIAG_STR(s) #s
- #define GCC_DIAG_JOINSTR(x,y) GCC_DIAG_STR(x ## y)
- #define GCC_DIAG_DO_PRAGMA(x) _Pragma (#x)
- #define GCC_DIAG_PRAGMA(x) GCC_DIAG_DO_PRAGMA(GCC diagnostic x)
-
- #define GCC_DIAG_OFF(x) GCC_DIAG_PRAGMA(push) GCC_DIAG_PRAGMA(ignored GCC_DIAG_JOINSTR(-W,x))
- #define GCC_DIAG_ON(x) GCC_DIAG_PRAGMA(pop)
-#else
- #define GCC_DIAG_OFF(x)
- #define GCC_DIAG_ON(x)
-#endif
-
/* Private functions, not part of the publicly documented API */
H5_DLL herr_t H5_init_library(void);
H5_DLL void H5_term_library(void);
diff --git a/src/H5public.h b/src/H5public.h
index 5db8deb..c92a18d 100644
--- a/src/H5public.h
+++ b/src/H5public.h
@@ -72,6 +72,25 @@
extern "C" {
#endif
+/* Macros for enabling/disabling particular GCC warnings */
+/* (see the following web-sites for more info:
+ * http://www.dbp-consulting.com/tutorials/SuppressingGCCWarnings.html
+ * http://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html#Diagnostic-Pragmas
+ */
+/* These pragmas are only implemented usefully in gcc 4.6+ */
+#if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406
+ #define H5_GCC_DIAG_STR(s) #s
+ #define H5_GCC_DIAG_JOINSTR(x,y) H5_GCC_DIAG_STR(x ## y)
+ #define H5_GCC_DIAG_DO_PRAGMA(x) _Pragma (#x)
+ #define H5_GCC_DIAG_PRAGMA(x) H5_GCC_DIAG_DO_PRAGMA(GCC diagnostic x)
+
+ #define H5_GCC_DIAG_OFF(x) H5_GCC_DIAG_PRAGMA(push) H5_GCC_DIAG_PRAGMA(ignored H5_GCC_DIAG_JOINSTR(-W,x))
+ #define H5_GCC_DIAG_ON(x) H5_GCC_DIAG_PRAGMA(pop)
+#else
+ #define H5_GCC_DIAG_OFF(x)
+ #define H5_GCC_DIAG_ON(x)
+#endif
+
/* Version numbers */
#define H5_VERS_MAJOR 1 /* For major interface/format changes */
#define H5_VERS_MINOR 8 /* For minor interface/format changes */
@@ -148,8 +167,10 @@ typedef long long ssize_t;
* type.
*/
#if H5_SIZEOF_LONG_LONG >= 8
+H5_GCC_DIAG_OFF(long-long)
typedef unsigned long long hsize_t;
typedef signed long long hssize_t;
+H5_GCC_DIAG_ON(long-long)
# define H5_SIZEOF_HSIZE_T H5_SIZEOF_LONG_LONG
# define H5_SIZEOF_HSSIZE_T H5_SIZEOF_LONG_LONG
#else
diff --git a/test/H5srcdir.h b/test/H5srcdir.h
index 202d050..4f0f439 100644
--- a/test/H5srcdir.h
+++ b/test/H5srcdir.h
@@ -46,8 +46,8 @@ static const char *H5_get_srcdir_filename(const char *filename)
/* Build path to test file */
if((HDstrlen(srcdir) + HDstrlen(filename) + 2) < sizeof(srcdir_testpath)) {
- HDstrcpy(srcdir_testpath, srcdir);
#ifdef H5_VMS
+ HDstrcpy(srcdir_testpath, srcdir);
if(filename[0] == '[') {
char *tmp = filename;
@@ -57,8 +57,7 @@ static const char *H5_get_srcdir_filename(const char *filename)
else
HDstrcat(srcdir_testpath, filename);
#else
- HDstrcat(srcdir_testpath, "/");
- HDstrcat(srcdir_testpath, filename);
+ HDsnprintf(srcdir_testpath, sizeof(srcdir_testpath), "%s/%s", srcdir, filename);
#endif
return(srcdir_testpath);
} /* end if */
@@ -77,8 +76,7 @@ static const char *H5_get_srcdir(void)
/* Build path to all test files */
if((HDstrlen(srcdir) + 2) < sizeof(srcdir_path)) {
- HDstrcpy(srcdir_path, srcdir);
- HDstrcat(srcdir_path, "/");
+ HDsnprintf(srcdir_path, sizeof(srcdir_path), "%s/", srcdir);
return(srcdir_path);
} /* end if */
else
diff --git a/test/cross_read.c b/test/cross_read.c
index 308a0c1..ba99c9e 100644
--- a/test/cross_read.c
+++ b/test/cross_read.c
@@ -50,8 +50,10 @@ const char *FILENAME[] = {
#define DATASETNAME15 "Fletcher_float_data_be"
#define DATASETNAME16 "Deflate_float_data_le"
#define DATASETNAME17 "Deflate_float_data_be"
+#ifdef H5_HAVE_FILTER_SZIP
#define DATASETNAME18 "Szip_float_data_le"
#define DATASETNAME19 "Szip_float_data_be"
+#endif /* H5_HAVE_FILTER_SZIP */
#define DATASETNAME20 "Shuffle_float_data_le"
#define DATASETNAME21 "Shuffle_float_data_be"
#define DATASETNAME22 "Nbit_float_data_le"
diff --git a/test/dt_arith.c b/test/dt_arith.c
index a22bd6d..be795dd 100644
--- a/test/dt_arith.c
+++ b/test/dt_arith.c
@@ -531,15 +531,14 @@ except_func(H5T_conv_except_t except_type, hid_t UNUSED src_id, hid_t UNUSED dst
* Programmer: Robb Matzke
* Tuesday, July 21, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void
some_dummy_func(float x)
{
char s[128];
- sprintf(s, "%g", x);
+
+ HDsnprintf(s, sizeof(s), "%g", x);
}
@@ -576,7 +575,8 @@ generates_sigfpe(void)
HDexit(1);
} else if (0==pid) {
for (i=0; i<2000; i++) {
- for (j=0; j<sizeof(double); j++) dp[j] = HDrand();
+ for(j = 0; j < sizeof(double); j++)
+ dp[j] = (unsigned char)HDrand();
f = (float)d;
some_dummy_func((float)f);
}
@@ -1050,14 +1050,14 @@ test_derived_flt(void)
*/
src_size = H5Tget_size(H5T_NATIVE_INT);
endian = H5Tget_order(H5T_NATIVE_INT);
- buf = (unsigned char*)malloc(nelmts * (MAX(src_size, size)));
- saved_buf = (unsigned char*)malloc(nelmts * src_size);
+ buf = (unsigned char *)HDmalloc(nelmts * (MAX(src_size, size)));
+ saved_buf = (unsigned char *)HDmalloc(nelmts * src_size);
HDmemset(buf, 0, nelmts * MAX(src_size, size));
HDmemset(saved_buf, 0, nelmts * src_size);
- aligned = (int*)calloc((size_t)1, src_size);
+ aligned = (int *)HDcalloc((size_t)1, src_size);
for(i = 0; i < nelmts * src_size; i++)
- buf[i] = saved_buf[i] = HDrand();
+ buf[i] = saved_buf[i] = (unsigned char)HDrand();
/* Convert data from native integer to derived floating-point type.
* The mantissa is big enough to retain the integer's precision. */
@@ -1083,7 +1083,7 @@ test_derived_flt(void)
/* Print errors */
if (0==fails_this_test++) {
- sprintf(str, "\nTesting random sw derived floating-point -> derived floating-point conversions");
+ HDsnprintf(str, sizeof(str), "\nTesting random sw derived floating-point -> derived floating-point conversions");
printf("%-70s", str);
HDfflush(stdout);
H5_FAILED();
@@ -1210,13 +1210,13 @@ test_derived_flt(void)
src_size = H5Tget_size(tid2);
dst_size = H5Tget_size(tid1);
endian = H5Tget_order(tid2);
- buf = (unsigned char*)malloc(nelmts*(MAX(src_size, dst_size)));
- saved_buf = (unsigned char*)malloc(nelmts*src_size);
- HDmemset(buf, 0, nelmts*MAX(src_size, dst_size));
+ buf = (unsigned char *)HDmalloc(nelmts * (MAX(src_size, dst_size)));
+ saved_buf = (unsigned char *)HDmalloc(nelmts * src_size);
+ HDmemset(buf, 0, nelmts * MAX(src_size, dst_size));
HDmemset(saved_buf, 0, nelmts*src_size);
for(i=0; i<nelmts*src_size; i++)
- buf[i] = saved_buf[i] = HDrand();
+ buf[i] = saved_buf[i] = (unsigned char)HDrand();
/* Convert data from the 2nd to the 1st derived floating-point type.
* The mantissa and exponent of the 2nd type are big enough to retain
@@ -1251,7 +1251,7 @@ test_derived_flt(void)
/* Print errors */
if (0==fails_this_test++) {
- sprintf(str, "\nTesting random sw derived floating-point -> derived floating-point conversions");
+ HDsnprintf(str, sizeof(str), "\nTesting random sw derived floating-point -> derived floating-point conversions");
printf("%-70s", str);
HDfflush(stdout);
H5_FAILED();
@@ -1520,13 +1520,13 @@ test_derived_integer(void)
src_size = H5Tget_size(tid1);
dst_size = H5Tget_size(tid2);
endian = H5Tget_order(tid1);
- buf = (unsigned char*)HDmalloc(nelmts*(MAX(src_size, dst_size)));
- saved_buf = (unsigned char*)HDmalloc(nelmts*src_size);
- HDmemset(buf, 0, nelmts*MAX(src_size, dst_size));
+ buf = (unsigned char *)HDmalloc(nelmts*(MAX(src_size, dst_size)));
+ saved_buf = (unsigned char *)HDmalloc(nelmts*src_size);
+ HDmemset(buf, 0, nelmts * MAX(src_size, dst_size));
HDmemset(saved_buf, 0, nelmts*src_size);
- for(i=0; i<nelmts*src_size; i++)
- buf[i] = saved_buf[i] = HDrand();
+ for(i=0; i<nelmts * src_size; i++)
+ buf[i] = saved_buf[i] = (unsigned char)HDrand();
/* Convert data from the 1st to the 2nd derived integer type.
* The precision of the 2nd type are big enough to retain
@@ -1553,7 +1553,7 @@ test_derived_integer(void)
/* Print errors */
if (0==fails_this_test++) {
- sprintf(str, "\nTesting random sw derived integer -> derived integer conversions");
+ HDsnprintf(str, sizeof(str), "\nTesting random sw derived integer -> derived integer conversions");
printf("%-70s", str);
HDfflush(stdout);
H5_FAILED();
@@ -1754,14 +1754,14 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
/* Sanity checks */
if (OTHER==src_type || OTHER==dst_type) {
- sprintf(str, "Testing %s %s -> %s conversions",
+ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
name, src_type_name, dst_type_name);
printf("%-70s", str);
H5_FAILED();
HDputs(" Unknown data type.");
goto error;
} else {
- sprintf(str, "Testing %s %s -> %s conversions",
+ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
name, src_type_name, dst_type_name);
printf("%-70s", str);
HDfflush(stdout);
@@ -2711,17 +2711,20 @@ my_isnan(dtype_t type, void *val)
if (!retval) {
if (FLT_FLOAT==type) {
float x;
+
HDmemcpy(&x, val, sizeof(float));
- sprintf(s, "%g", x);
+ HDsnprintf(s, sizeof(s), "%g", x);
} else if (FLT_DOUBLE==type) {
double x;
+
HDmemcpy(&x, val, sizeof(double));
- sprintf(s, "%g", x);
+ HDsnprintf(s, sizeof(s), "%g", x);
#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0
} else if (FLT_LDOUBLE==type) {
long double x;
+
HDmemcpy(&x, val, sizeof(long double));
- sprintf(s, "%Lg", x);
+ HDsnprintf(s, sizeof(s), "%Lg", x);
#endif
} else {
return 0;
@@ -2889,7 +2892,7 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
} else if (WIFEXITED(status)) {
return WEXITSTATUS(status);
} else if (WIFSIGNALED(status)) {
- sprintf(str, " Child caught signal %d.", WTERMSIG(status));
+ HDsnprintf(str, sizeof(str), " Child caught signal %d.", WTERMSIG(status));
HDputs(str);
return 1; /*child exit after catching non-SIGFPE signal */
} else {
@@ -2945,16 +2948,16 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
HDputs("Sizeof(float)==sizeof(double) - some tests may not be sensible.");
if (OTHER==src_type || OTHER==dst_type) {
if(!strcmp(name, "noop"))
- sprintf(str, "Testing %s %s -> %s conversions",
+ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
name, src_type_name, dst_type_name);
else if(run_test==TEST_SPECIAL)
- sprintf(str, "Testing %s special %s -> %s conversions",
+ HDsnprintf(str, sizeof(str), "Testing %s special %s -> %s conversions",
name, src_type_name, dst_type_name);
else if(run_test==TEST_NORMAL)
- sprintf(str, "Testing %s normalized %s -> %s conversions",
+ HDsnprintf(str, sizeof(str), "Testing %s normalized %s -> %s conversions",
name, src_type_name, dst_type_name);
else if(run_test==TEST_DENORM)
- sprintf(str, "Testing %s denormalized %s -> %s conversions",
+ HDsnprintf(str, sizeof(str), "Testing %s denormalized %s -> %s conversions",
name, src_type_name, dst_type_name);
printf("%-70s", str);
@@ -2963,16 +2966,16 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
goto error;
} else {
if(!strcmp(name, "noop"))
- sprintf(str, "Testing %s %s -> %s conversions",
+ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
name, src_type_name, dst_type_name);
else if(run_test==TEST_SPECIAL)
- sprintf(str, "Testing %s special %s -> %s conversions",
+ HDsnprintf(str, sizeof(str), "Testing %s special %s -> %s conversions",
name, src_type_name, dst_type_name);
else if(run_test==TEST_NORMAL)
- sprintf(str, "Testing %s normalized %s -> %s conversions",
+ HDsnprintf(str, sizeof(str), "Testing %s normalized %s -> %s conversions",
name, src_type_name, dst_type_name);
else if(run_test==TEST_DENORM)
- sprintf(str, "Testing %s denormalized %s -> %s conversions",
+ HDsnprintf(str, sizeof(str), "Testing %s denormalized %s -> %s conversions",
name, src_type_name, dst_type_name);
printf("%-70s", str);
@@ -3090,10 +3093,10 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
/* Check the software results against the hardware */
for (j=0; j<nelmts; j++) {
underflow = 0;
- hw_f = 911.0;
- hw_d = 911.0;
+ hw_f = 911.0f;
+ hw_d = 911.0f;
#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
- hw_ld = 911.0;
+ hw_ld = 911.0f;
#endif
/* The hardware conversion */
@@ -3167,10 +3170,11 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
* 0s before compare the values.
*/
#if H5_SIZEOF_LONG_DOUBLE !=0
- if(sendian==H5T_ORDER_LE && dst_type==FLT_LDOUBLE) {
- unsigned int q;
- for(q=dst_nbits/8; q<dst_size; q++) {
- buf[j*dst_size+q] = 0x00;
+ if(sendian == H5T_ORDER_LE && dst_type == FLT_LDOUBLE) {
+ size_t q;
+
+ for(q = dst_nbits / 8; q < dst_size; q++) {
+ buf[j * dst_size + q] = 0x00;
hw[q] = 0x00;
}
}
@@ -3645,7 +3649,7 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
/* Sanity checks */
if (OTHER==src_type || OTHER==dst_type) {
- sprintf(str, "Testing %s %s -> %s conversions",
+ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
name, src_type_name, dst_type_name);
printf("%-70s", str);
H5_FAILED();
@@ -3654,15 +3658,15 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
}
if ((INT_SCHAR==src_type || INT_UCHAR==src_type || INT_SHORT==src_type ||
- INT_USHORT==src_type || INT_INT==src_type || INT_UINT==src_type ||
- INT_LONG==src_type || INT_ULONG==src_type || INT_LLONG==src_type ||
- INT_ULLONG==src_type) &&
- (FLT_FLOAT!=dst_type && FLT_DOUBLE!=dst_type
+ INT_USHORT==src_type || INT_INT==src_type || INT_UINT==src_type ||
+ INT_LONG==src_type || INT_ULONG==src_type || INT_LLONG==src_type ||
+ INT_ULLONG==src_type) &&
+ (FLT_FLOAT!=dst_type && FLT_DOUBLE!=dst_type
#if H5_SIZEOF_LONG_DOUBLE !=0
- && FLT_LDOUBLE!=dst_type
+ && FLT_LDOUBLE!=dst_type
#endif
- )) {
- sprintf(str, "Testing %s %s -> %s conversions",
+ )) {
+ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
name, src_type_name, dst_type_name);
printf("%-70s", str);
H5_FAILED();
@@ -3672,14 +3676,14 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
if ((FLT_FLOAT==src_type || FLT_DOUBLE==src_type
#if H5_SIZEOF_LONG_DOUBLE !=0
- || FLT_LDOUBLE==src_type
+ || FLT_LDOUBLE==src_type
#endif
- )
- && (INT_SCHAR!=dst_type && INT_UCHAR!=dst_type && INT_SHORT!=dst_type
- && INT_USHORT!=dst_type && INT_INT!=dst_type && INT_UINT!=dst_type
- && INT_LONG!=dst_type && INT_ULONG!=dst_type && INT_LLONG!=dst_type
- && INT_ULLONG!=dst_type)) {
- sprintf(str, "Testing %s %s -> %s conversions",
+ )
+ && (INT_SCHAR!=dst_type && INT_UCHAR!=dst_type && INT_SHORT!=dst_type
+ && INT_USHORT!=dst_type && INT_INT!=dst_type && INT_UINT!=dst_type
+ && INT_LONG!=dst_type && INT_ULONG!=dst_type && INT_LLONG!=dst_type
+ && INT_ULLONG!=dst_type)) {
+ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
name, src_type_name, dst_type_name);
printf("%-70s", str);
H5_FAILED();
@@ -3688,23 +3692,23 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
}
if (INT_SCHAR==src_type || INT_UCHAR==src_type || INT_SHORT==src_type ||
- INT_USHORT==src_type || INT_INT==src_type || INT_UINT==src_type ||
- INT_LONG==src_type || INT_ULONG==src_type || INT_LLONG==src_type ||
- INT_ULLONG==src_type) {
- sprintf(str, "Testing %s %s -> %s conversions",
+ INT_USHORT==src_type || INT_INT==src_type || INT_UINT==src_type ||
+ INT_LONG==src_type || INT_ULONG==src_type || INT_LLONG==src_type ||
+ INT_ULLONG==src_type) {
+ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
name, src_type_name, dst_type_name);
printf("%-70s", str);
HDfflush(stdout);
fails_this_test=0;
} else {
if(run_test==TEST_NORMAL)
- sprintf(str, "Testing %s normalized %s -> %s conversions",
+ HDsnprintf(str, sizeof(str), "Testing %s normalized %s -> %s conversions",
name, src_type_name, dst_type_name);
else if(run_test==TEST_DENORM)
- sprintf(str, "Testing %s denormalized %s -> %s conversions",
+ HDsnprintf(str, sizeof(str), "Testing %s denormalized %s -> %s conversions",
name, src_type_name, dst_type_name);
else
- sprintf(str, "Testing %s special %s -> %s conversions",
+ HDsnprintf(str, sizeof(str), "Testing %s special %s -> %s conversions",
name, src_type_name, dst_type_name);
printf("%-70s", str);
HDfflush(stdout);
@@ -5122,13 +5126,13 @@ run_int_fp_conv(const char *name)
{
char str[256]; /*hello string */
- sprintf(str, "Testing %s %s -> %s conversions",
+ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
name, "unsigned long long", "float");
printf("%-70s", str);
SKIPPED();
HDputs(" Test skipped due to compiler not handling conversion.");
- sprintf(str, "Testing %s %s -> %s conversions",
+ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
name, "unsigned long long", "double");
printf("%-70s", str);
SKIPPED();
@@ -5150,19 +5154,19 @@ run_int_fp_conv(const char *name)
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_LONG, H5T_NATIVE_LDOUBLE);
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_ULONG, H5T_NATIVE_LDOUBLE);
#else
- {
- char str[256]; /*string */
+ {
+ char str[256]; /*string */
- sprintf(str, "Testing %s %s -> %s conversions",
- name, "(unsigned) long", "long double");
- printf("%-70s", str);
- SKIPPED();
+ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
+ name, "(unsigned) long", "long double");
+ printf("%-70s", str);
+ SKIPPED();
#if H5_SIZEOF_LONG_DOUBLE!=0
- HDputs(" Test skipped due to the special algorithm of hardware conversion.");
+ HDputs(" Test skipped due to the special algorithm of hardware conversion.");
#else
- HDputs(" Test skipped due to disabled long double.");
+ HDputs(" Test skipped due to disabled long double.");
#endif
- }
+ }
#endif
#endif /* H5_SIZEOF_LONG!=H5_SIZEOF_INT */
#if H5_SIZEOF_LONG_LONG!=H5_SIZEOF_LONG
@@ -5172,7 +5176,7 @@ run_int_fp_conv(const char *name)
{
char str[256]; /*hello string */
- sprintf(str, "Testing %s %s -> %s conversions",
+ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
name, "long long", "long double");
printf("%-70s", str);
SKIPPED();
@@ -5185,7 +5189,7 @@ run_int_fp_conv(const char *name)
{
char str[256]; /*hello string */
- sprintf(str, "Testing %s %s -> %s conversions",
+ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
name, "unsigned long long", "long double");
printf("%-70s", str);
SKIPPED();
@@ -5198,7 +5202,7 @@ run_int_fp_conv(const char *name)
{
char str[256]; /*string */
- sprintf(str, "Testing %s %s -> %s conversions",
+ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
name, "all integers", "long double");
printf("%-70s", str);
SKIPPED();
@@ -5287,13 +5291,13 @@ run_fp_int_conv(const char *name)
{
char str[256]; /*hello string */
- sprintf(str, "Testing %s %s -> %s conversions",
+ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
name, "float", "unsigned long long");
printf("%-70s", str);
SKIPPED();
HDputs(" Test skipped due to hardware conversion error.");
- sprintf(str, "Testing %s %s -> %s conversions",
+ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
name, "double", "unsigned long long");
printf("%-70s", str);
SKIPPED();
@@ -5315,7 +5319,7 @@ run_fp_int_conv(const char *name)
{
char str[256]; /*string */
- sprintf(str, "Testing %s %s -> %s conversions",
+ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
name, "long double", "unsigned int");
printf("%-70s", str);
SKIPPED();
@@ -5334,7 +5338,7 @@ run_fp_int_conv(const char *name)
{
char str[256]; /*string */
- sprintf(str, "Testing %s %s -> %s conversions",
+ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
name, "long double", "(unsigned) long");
printf("%-70s", str);
SKIPPED();
@@ -5354,7 +5358,7 @@ run_fp_int_conv(const char *name)
{
char str[256]; /*string */
- sprintf(str, "Testing %s %s -> %s conversions",
+ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
name, "long double", "long long");
printf("%-70s", str);
SKIPPED();
@@ -5371,7 +5375,7 @@ run_fp_int_conv(const char *name)
{
char str[256]; /*string */
- sprintf(str, "Testing %s %s -> %s conversions",
+ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
name, "long double", "unsigned long long");
printf("%-70s", str);
SKIPPED();
@@ -5388,7 +5392,7 @@ run_fp_int_conv(const char *name)
{
char str[256]; /*hello string */
- sprintf(str, "Testing %s %s -> %s conversions",
+ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
name, "long double", "all integers");
printf("%-70s", str);
SKIPPED();
@@ -5409,7 +5413,7 @@ run_fp_int_conv(const char *name)
*/
char str[256]; /*string */
- sprintf(str, "Testing %s %s -> %s conversions",
+ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
name, "all floating-point numbers", "all integers");
printf("%-70s", str);
SKIPPED();
diff --git a/test/gen_cross.c b/test/gen_cross.c
index 8cbb2f5..bdc2835 100644
--- a/test/gen_cross.c
+++ b/test/gen_cross.c
@@ -46,8 +46,10 @@
#define DATASETNAME15 "Fletcher_float_data_be"
#define DATASETNAME16 "Deflate_float_data_le"
#define DATASETNAME17 "Deflate_float_data_be"
+#ifdef H5_HAVE_FILTER_SZIP
#define DATASETNAME18 "Szip_float_data_le"
#define DATASETNAME19 "Szip_float_data_be"
+#endif /* H5_HAVE_FILTER_SZIP */
#define DATASETNAME20 "Shuffle_float_data_le"
#define DATASETNAME21 "Shuffle_float_data_be"
#define DATASETNAME22 "Nbit_float_data_le"
diff --git a/test/gen_new_group.c b/test/gen_new_group.c
index 6d16031..b998913 100644
--- a/test/gen_new_group.c
+++ b/test/gen_new_group.c
@@ -31,13 +31,6 @@
#define FILENAME "group_new.h5"
-#ifndef TRUE
-#define TRUE 1
-#endif /* TRUE */
-#ifndef FALSE
-#define FALSE 0
-#endif /* FALSE */
-
int main(void)
{
hid_t fid = -1; /* File ID */
diff --git a/test/h5test.c b/test/h5test.c
index b9da3c6..7ae6cb0 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -75,7 +75,6 @@ char *paraprefix = NULL; /* for command line option para-prefix */
MPI_Info h5_io_info_g=MPI_INFO_NULL;/* MPI INFO object for IO */
#endif
-#define FILENAME_BUF_SIZE 1024
#define READ_BUF_SIZE 4096
/*
@@ -132,63 +131,61 @@ h5_errors(hid_t estack, void UNUSED *client_data)
* Programmer: Albert Cheng
* May 28, 1998
*
- * Modifications:
- * Albert Cheng, 2000-09-09
- * Added the explicite base_name argument to replace the
- * global variable FILENAME.
- *
*-------------------------------------------------------------------------
*/
int
h5_cleanup(const char *base_name[], hid_t fapl)
{
- char filename[1024];
- char temp[2048];
- int i, j;
- int retval=0;
- hid_t driver;
+ int retval = 0;
+
+ if(GetTestCleanup()) {
+ int i;
- if (GetTestCleanup()){
- for (i = 0; base_name[i]; i++) {
- if (h5_fixname(base_name[i], fapl, filename, sizeof(filename)) == NULL)
- continue;
+ for(i = 0; base_name[i]; i++) {
+ char filename[1024];
+ char temp[2048];
+ hid_t driver;
+
+ if(NULL == h5_fixname(base_name[i], fapl, filename, sizeof(filename)))
+ continue;
driver = H5Pget_driver(fapl);
- if (driver == H5FD_FAMILY) {
- for (j = 0; /*void*/; j++) {
- HDsnprintf(temp, sizeof temp, filename, j);
+ if(driver == H5FD_FAMILY) {
+ int j;
+
+ for(j = 0; /*void*/; j++) {
+ HDsnprintf(temp, sizeof temp, filename, j);
- if (HDaccess(temp, F_OK) < 0)
+ if(HDaccess(temp, F_OK) < 0)
break;
- HDremove(temp);
- }
- } else if (driver == H5FD_CORE) {
+ HDremove(temp);
+ } /* end for */
+ } else if(driver == H5FD_CORE) {
hbool_t backing; /* Whether the core file has backing store */
- H5Pget_fapl_core(fapl,NULL,&backing);
+ H5Pget_fapl_core(fapl, NULL, &backing);
/* If the file was stored to disk with bacing store, remove it */
if(backing)
HDremove(filename);
+ } else if (driver == H5FD_MULTI) {
+ H5FD_mem_t mt;
- } else if (driver == H5FD_MULTI) {
- H5FD_mem_t mt;
- assert(HDstrlen(multi_letters)==H5FD_MEM_NTYPES);
+ HDassert(HDstrlen(multi_letters)==H5FD_MEM_NTYPES);
- for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,mt)) {
- HDsnprintf(temp, sizeof temp, "%s-%c.h5",
- filename, multi_letters[mt]);
- HDremove(temp); /*don't care if it fails*/
- }
- } else {
- HDremove(filename);
- }
- }
+ for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,mt)) {
+ HDsnprintf(temp, sizeof temp, "%s-%c.h5", filename, multi_letters[mt]);
+ HDremove(temp); /*don't care if it fails*/
+ } /* end for */
+ } else {
+ HDremove(filename);
+ }
+ } /* end for */
- retval = 1;
- }
+ retval = 1;
+ } /* end if */
H5Pclose(fapl);
return retval;
@@ -205,8 +202,6 @@ h5_cleanup(const char *base_name[], hid_t fapl)
* Programmer: Robb Matzke
* Friday, November 20, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void
@@ -268,16 +263,6 @@ h5_reset(void)
* Programmer: Robb Matzke
* Thursday, November 19, 1998
*
- * Modifications:
- * Robb Matzke, 1999-08-03
- * Modified to use the virtual file layer.
- *
- * Albert Cheng, 2000-01-25
- * Added prefix for parallel test files.
- *
- * Albert Cheng, 2003-05-08
- * Changed the default parallel prefix back to NULL but added
- * an explanation remark of $HDF5_PARAPREFIX.
*-------------------------------------------------------------------------
*/
char *
@@ -293,37 +278,36 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size)
if (!base_name || !fullname || size < 1)
return NULL;
- memset(fullname, 0, size);
+ HDmemset(fullname, 0, size);
/* figure out the suffix */
- if (H5P_DEFAULT != fapl) {
- if ((driver = H5Pget_driver(fapl)) < 0)
+ if(H5P_DEFAULT != fapl) {
+ if((driver = H5Pget_driver(fapl)) < 0)
return NULL;
- if (H5FD_FAMILY == driver)
- suffix = "%05d.h5";
- else if (H5FD_MULTI == driver)
- suffix = NULL;
+ if(H5FD_FAMILY == driver)
+ suffix = "%05d.h5";
+ else if (H5FD_MULTI == driver)
+ suffix = NULL;
}
/* Must first check fapl is not H5P_DEFAULT (-1) because H5FD_XXX
* could be of value -1 if it is not defined.
*/
- isppdriver = H5P_DEFAULT != fapl &&
- (H5FD_MPIO==driver || H5FD_MPIPOSIX==driver);
+ isppdriver = H5P_DEFAULT != fapl && (H5FD_MPIO==driver || H5FD_MPIPOSIX==driver);
/* Check HDF5_NOCLEANUP environment setting.
* (The #ifdef is needed to prevent compile failure in case MPI is not
* configured.)
*/
- if (isppdriver){
+ if(isppdriver) {
#ifdef H5_HAVE_PARALLEL
- if (getenv_all(MPI_COMM_WORLD, 0, "HDF5_NOCLEANUP"))
- SetTestNoCleanup();
+ if(getenv_all(MPI_COMM_WORLD, 0, "HDF5_NOCLEANUP"))
+ SetTestNoCleanup();
#endif /* H5_HAVE_PARALLEL */
- }else{
- if (HDgetenv("HDF5_NOCLEANUP"))
- SetTestNoCleanup();
+ } else {
+ if(HDgetenv("HDF5_NOCLEANUP"))
+ SetTestNoCleanup();
}
/* Check what prefix to use for test files. Process HDF5_PARAPREFIX and
@@ -332,7 +316,7 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size)
* (The #ifdef is needed to prevent compile failure in case MPI is not
* configured.)
*/
- if (isppdriver){
+ if(isppdriver) {
#ifdef H5_HAVE_PARALLEL
/*
* For parallel:
@@ -341,38 +325,38 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size)
*/
static int explained = 0;
- prefix = (paraprefix ? paraprefix : getenv_all(MPI_COMM_WORLD, 0, "HDF5_PARAPREFIX"));
+ prefix = (paraprefix ? paraprefix : getenv_all(MPI_COMM_WORLD, 0, "HDF5_PARAPREFIX"));
- if (!prefix && !explained) {
- /* print hint by process 0 once. */
- int mpi_rank;
+ if (!prefix && !explained) {
+ /* print hint by process 0 once. */
+ int mpi_rank;
- MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
+ MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
- if (mpi_rank == 0)
- printf("*** Hint ***\n"
- "You can use environment variable HDF5_PARAPREFIX to "
- "run parallel test files in a\n"
- "different directory or to add file type prefix. E.g.,\n"
- " HDF5_PARAPREFIX=pfs:/PFS/user/me\n"
- " export HDF5_PARAPREFIX\n"
- "*** End of Hint ***\n");
+ if (mpi_rank == 0)
+ printf("*** Hint ***\n"
+ "You can use environment variable HDF5_PARAPREFIX to "
+ "run parallel test files in a\n"
+ "different directory or to add file type prefix. E.g.,\n"
+ " HDF5_PARAPREFIX=pfs:/PFS/user/me\n"
+ " export HDF5_PARAPREFIX\n"
+ "*** End of Hint ***\n");
- explained = TRUE;
+ explained = TRUE;
#ifdef HDF5_PARAPREFIX
prefix = HDF5_PARAPREFIX;
#endif /* HDF5_PARAPREFIX */
- }
+ }
#endif /* H5_HAVE_PARALLEL */
} else {
- /*
+ /*
* For serial:
* First use the environment variable, then try the constant
- */
- prefix = HDgetenv("HDF5_PREFIX");
+ */
+ prefix = HDgetenv("HDF5_PREFIX");
#ifdef HDF5_PREFIX
- if (!prefix)
+ if (!prefix)
prefix = HDF5_PREFIX;
#endif /* HDF5_PREFIX */
}
diff --git a/test/testmeta.c b/test/testmeta.c
index 9aa4972..a008cc7 100644
--- a/test/testmeta.c
+++ b/test/testmeta.c
@@ -29,14 +29,12 @@
#define FILEN "testmeta.h5"
-#define MEMB_SIZE 100000000
#define CHUNK_SIZE 512
#define NDATAARRAYS 3
/*#define NPOINTS 2048*/
#define NPOINTS 20
#define NEXTARRAYS 10
-#define NWATTRS 2
#define NDATAOBJECTS 100000
int main(void)
diff --git a/test/titerate.c b/test/titerate.c
index d41df84..049e258 100644
--- a/test/titerate.c
+++ b/test/titerate.c
@@ -40,7 +40,6 @@
#define NAMELEN 80
/* 1-D dataset with fixed dimensions */
-#define SPACE1_NAME "Space1"
#define SPACE1_RANK 1
#define SPACE1_DIM1 4
diff --git a/test/ttime.c b/test/ttime.c
index 4762656..16acd3e 100644
--- a/test/ttime.c
+++ b/test/ttime.c
@@ -26,7 +26,9 @@
#include "hdf5.h"
#define DATAFILE "ttime.h5"
+#ifdef NOT_YET
#define DATASETNAME "Dataset"
+#endif /* NOT_YET */
/****************************************************************
**
diff --git a/test/ttsafe_dcreate.c b/test/ttsafe_dcreate.c
index f83332d..df51f72 100644
--- a/test/ttsafe_dcreate.c
+++ b/test/ttsafe_dcreate.c
@@ -45,7 +45,6 @@
#ifdef H5_HAVE_THREADSAFE
#define FILENAME "ttsafe_dcreate.h5"
-#define DATASETNAME_LENGTH 10
#define NUM_THREAD 16
void *tts_dcreate_creator(void *);
diff --git a/test/tunicode.c b/test/tunicode.c
index bd3090c..9725a9b 100644
--- a/test/tunicode.c
+++ b/test/tunicode.c
@@ -29,16 +29,13 @@
#define LONG_BUF_SIZE (2 * MAX_STRING_LENGTH + 4)
#define DSET1_NAME "fl_string_dataset"
-#define DSET2_NAME "dataset2"
#define DSET3_NAME "dataset3"
#define DSET4_NAME "dataset4"
#define VL_DSET1_NAME "vl_dset_1"
-#define VL_DSET2_NAME "vl_dset_2"
#define GROUP1_NAME "group1"
#define GROUP2_NAME "group2"
#define GROUP3_NAME "group3"
#define GROUP4_NAME "group4"
-#define SLINK_NAME "soft_link"
#define RANK 1
#define COMP_INT_VAL 7
diff --git a/test/tvltypes.c b/test/tvltypes.c
index ab4d880..516974e 100644
--- a/test/tvltypes.c
+++ b/test/tvltypes.c
@@ -32,11 +32,6 @@
#define SPACE1_RANK 1
#define SPACE1_DIM1 4
-/* 2-D dataset with fixed dimensions */
-#define SPACE2_RANK 2
-#define SPACE2_DIM1 10
-#define SPACE2_DIM2 10
-
/* 1-D dataset with fixed dimensions */
#define SPACE3_RANK 1
#define SPACE3_DIM1 128
diff --git a/tools/h5import/h5import.c b/tools/h5import/h5import.c
index a10ef24..74c67b9 100644
--- a/tools/h5import/h5import.c
+++ b/tools/h5import/h5import.c
@@ -863,11 +863,11 @@ static int processStrData(FILE *strm, struct Input *in, hid_t file_id)
hid_t handle;
hsize_t dims[1];
char str[1024];
- char c;
+ int c;
int i = 0;
int j;
- int nlines = 0;
- int line;
+ hsize_t nlines = 0;
+ hsize_t line;
/*-------------------------------------------------------------------------
* get number of lines in the input file
@@ -877,9 +877,8 @@ static int processStrData(FILE *strm, struct Input *in, hid_t file_id)
while (!HDfeof(strm)) {
c = HDfgetc(strm);
- if (c == 10) { /* eol */
+ if (c == 10) /* eol */
nlines++;
- }
}
if (!nlines)
@@ -944,7 +943,7 @@ static int processStrData(FILE *strm, struct Input *in, hid_t file_id)
while (!HDfeof(strm)) {
c = HDfgetc(strm);
- str[i] = c;
+ str[i] = (char)c;
i++;
@@ -1012,7 +1011,7 @@ static int processStrHDFData(FILE *strm, struct Input *in, hid_t file_id)
char *str3 = NULL;
char str[1024] = "";
int j;
- int line;
+ hsize_t line;
/*-------------------------------------------------------------------------
* read file and generate an HDF5 dataset
@@ -1079,7 +1078,7 @@ static int processStrHDFData(FILE *strm, struct Input *in, hid_t file_id)
str2 = NULL;
str3 = NULL;
#ifdef H5DEBUGIMPORT
- printf("processStrHDFData DATATYPE STRING[%d]={%s}\n", line, str1);
+ printf("processStrHDFData DATATYPE STRING[%llu]={%s}\n", (unsigned long long)line, str1);
#endif
/* process string to remove the first and last quote char */
str2 = strchr(str1, '"');
@@ -1108,7 +1107,7 @@ static int processStrHDFData(FILE *strm, struct Input *in, hid_t file_id)
hsize_t count[1] = { 1 };
#ifdef H5DEBUGIMPORT
- printf("processStrHDFData DATATYPE STRING[%d] store %s\n", line, str2);
+ printf("processStrHDFData DATATYPE STRING[%llu] store %s\n", (unsigned long long)line, str2);
#endif
if ((fspace_id = H5Dget_space(dset_id)) < 0)
goto out;
diff --git a/tools/h5jam/getub.c b/tools/h5jam/getub.c
index d84f7f2..afb0da6 100644
--- a/tools/h5jam/getub.c
+++ b/tools/h5jam/getub.c
@@ -26,9 +26,6 @@
void parse_command_line (int argc, const char *argv[]);
-#define TRUE 1
-#define FALSE 0
-
/* Name of tool */
#define PROGRAMNAME "getub"
char *nbytes = NULL;
@@ -79,21 +76,21 @@ usage (const char *prog)
void
parse_command_line (int argc, const char *argv[])
{
- int opt = FALSE;
+ int opt;
/* parse command line options */
while ((opt = get_option (argc, argv, s_opts, l_opts)) != EOF)
{
switch ((char) opt)
- {
- case 'c':
- nbytes = HDstrdup (opt_arg);
- break;
- case '?':
- default:
- usage (h5tools_getprogname());
- exit (EXIT_FAILURE);
- }
+ {
+ case 'c':
+ nbytes = HDstrdup (opt_arg);
+ break;
+ case '?':
+ default:
+ usage (h5tools_getprogname());
+ exit (EXIT_FAILURE);
+ }
}
if (argc <= opt_ind)
diff --git a/tools/h5jam/h5jamgentest.c b/tools/h5jam/h5jamgentest.c
index ca3d86c..9636597 100644
--- a/tools/h5jam/h5jamgentest.c
+++ b/tools/h5jam/h5jamgentest.c
@@ -28,7 +28,9 @@
#include "hdf5.h"
#include "H5private.h"
+/* not used yet
#define UBTXT1 "u0.txt"
+*/
#define UBTXT2 "u10.txt"
#define UBTXT3 "u511.txt"
#define UBTXT4 "u512.txt"
@@ -69,24 +71,7 @@ char pattern[11] = "abcdefghij";
#define BUF_SIZE 1024
-#define LENSTR 50
-#define LENSTR2 11
-
-#define SPACE2_RANK 2
-#define SPACE2_DIM1 10
-#define SPACE2_DIM2 10
-
-#define SPACE1_RANK 1
-#define SPACE1_DIM1 4
-
-#define DIM1 20
-#define DIM2 10
-#define CDIM1 DIM1/2
-#define CDIM2 DIM2/2
-#define RANK 2
-
/* Element selection information */
-#define POINT1_NPOINTS 10
typedef enum{
RED,
@@ -106,22 +91,10 @@ typedef struct s1_t {
/* 1-D array datatype */
#define ARRAY1_RANK 1
-#define ARRAY1_DIM1 4
-
-/* 3-D array datatype */
-#define ARRAY2_RANK 3
-#define ARRAY2_DIM1 3
-#define ARRAY2_DIM2 4
-#define ARRAY2_DIM3 5
/* 2-D array datatype */
-#define ARRAY3_RANK 2
-#define ARRAY3_DIM1 6
#define ARRAY3_DIM2 3
-/* VL string datatype name */
-#define VLSTR_TYPE "vl_string_type"
-
/* A UD link traversal function. Shouldn't actually be called. */
static hid_t UD_traverse(const char UNUSED * link_name, hid_t UNUSED cur_group,
const void UNUSED * udata, size_t UNUSED udata_size, hid_t UNUSED lapl_id)
diff --git a/tools/h5jam/tellub.c b/tools/h5jam/tellub.c
index 0169d71..b4f87af 100644
--- a/tools/h5jam/tellub.c
+++ b/tools/h5jam/tellub.c
@@ -24,9 +24,6 @@
#include "h5tools.h"
#include "h5tools_utils.h"
-#define TRUE 1
-#define FALSE 0
-
/* Name of tool */
#define PROGRAMNAME "tellub"
@@ -85,21 +82,21 @@ usage (const char *prog)
static void
parse_command_line (int argc, const char *argv[])
{
- int opt = FALSE;
+ int opt;
/* parse command line options */
while ((opt = get_option (argc, argv, s_opts, l_opts)) != EOF)
{
switch ((char) opt)
- {
- case 'h':
- usage (h5tools_getprogname());
- exit (EXIT_SUCCESS);
- case '?':
- default:
- usage (h5tools_getprogname());
- exit (EXIT_FAILURE);
- }
+ {
+ case 'h':
+ usage (h5tools_getprogname());
+ exit (EXIT_SUCCESS);
+ case '?':
+ default:
+ usage (h5tools_getprogname());
+ exit (EXIT_FAILURE);
+ }
}
/* check for file name to be processed */
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c
index 4ff3440..883bd5f 100644
--- a/tools/lib/h5diff.c
+++ b/tools/lib/h5diff.c
@@ -1078,7 +1078,6 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
char * grp2_path = "";
char * obj1_fullpath = NULL;
char * obj2_fullpath = NULL;
- h5trav_type_t objtype;
diff_args_t argdata;
size_t idx1 = 0;
size_t idx2 = 0;
@@ -1144,7 +1143,6 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
{
if( table->objs[i].flags[0] && table->objs[i].flags[1])
{
- objtype = table->objs[i].type;
/* make full path for obj1 */
obj1_fullpath = (char*)HDcalloc (HDstrlen(grp1_path) + strlen (table->objs[i].name) + 1, sizeof (char));
HDstrcpy(obj1_fullpath, grp1_path);
diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c
index fca3096..d0a4a76 100644
--- a/tools/lib/h5trav.c
+++ b/tools/lib/h5trav.c
@@ -21,13 +21,15 @@
* local typedefs
*-------------------------------------------------------------------------
*/
+typedef struct trav_addr_path_t {
+ haddr_t addr;
+ char *path;
+} trav_addr_path_t;
+
typedef struct trav_addr_t {
size_t nalloc;
size_t nused;
- struct {
- haddr_t addr;
- char *path;
- } *objs;
+ trav_addr_path_t *objs;
} trav_addr_t;
typedef struct {
@@ -132,7 +134,7 @@ trav_addr_add(trav_addr_t *visited, haddr_t addr, const char *path)
/* Allocate space if necessary */
if(visited->nused == visited->nalloc) {
visited->nalloc = MAX(1, visited->nalloc * 2);;
- visited->objs = HDrealloc(visited->objs, visited->nalloc * sizeof(visited->objs[0]));
+ visited->objs = (trav_addr_path_t *)HDrealloc(visited->objs, visited->nalloc * sizeof(trav_addr_path_t));
} /* end if */
/* Append it */
@@ -194,14 +196,15 @@ traverse_cb(hid_t loc_id, const char *path, const H5L_info_t *linfo,
/* Create the full path name for the link */
if(udata->is_absolute) {
size_t base_len = HDstrlen(udata->base_grp_name);
- size_t add_slash = base_len ? ((udata->base_grp_name)[base_len-1] != '/') : 1;
+ size_t add_slash = base_len ? ((udata->base_grp_name)[base_len - 1] != '/') : 1;
+ size_t new_name_len = base_len + add_slash + HDstrlen(path) + 1;
- if(NULL == (new_name = (char*)HDmalloc(base_len + add_slash + HDstrlen(path) + 1)))
+ if(NULL == (new_name = (char*)HDmalloc(new_name_len)))
return(H5_ITER_ERROR);
- HDstrcpy(new_name, udata->base_grp_name);
- if (add_slash)
- new_name[base_len] = '/';
- HDstrcpy(new_name + base_len + add_slash, path);
+ if(add_slash)
+ HDsnprintf(new_name, new_name_len, "%s/%s", udata->base_grp_name, path);
+ else
+ HDsnprintf(new_name, new_name_len, "%s%s", udata->base_grp_name, path);
full_name = new_name;
} /* end if */
else
@@ -216,7 +219,7 @@ traverse_cb(hid_t loc_id, const char *path, const H5L_info_t *linfo,
if(new_name)
HDfree(new_name);
return(H5_ITER_ERROR);
- }
+ } /* end if */
/* If the object has multiple links, add it to the list of addresses
* already visited, if it isn't there already
@@ -231,7 +234,7 @@ traverse_cb(hid_t loc_id, const char *path, const H5L_info_t *linfo,
if(new_name)
HDfree(new_name);
return(H5_ITER_ERROR);
- }
+ } /* end if */
} /* end if */
else {
/* Make 'visit link' callback */
@@ -240,7 +243,7 @@ traverse_cb(hid_t loc_id, const char *path, const H5L_info_t *linfo,
if(new_name)
HDfree(new_name);
return(H5_ITER_ERROR);
- }
+ } /* end if */
} /* end else */
if(new_name)
@@ -730,7 +733,7 @@ trav_table_add(trav_table_t *table,
if(table->nobjs == table->size) {
table->size = MAX(1, table->size * 2);
- table->objs = (trav_obj_t*)HDrealloc(table->objs, table->size * sizeof(trav_obj_t));
+ table->objs = (trav_obj_t *)HDrealloc(table->objs, table->size * sizeof(trav_obj_t));
} /* end if */
new_obj = table->nobjs++;
@@ -774,7 +777,7 @@ trav_table_addlink(trav_table_t *table, haddr_t objno, const char *path)
/* allocate space if necessary */
if(table->objs[i].nlinks == (unsigned)table->objs[i].sizelinks) {
table->objs[i].sizelinks = MAX(1, table->objs[i].sizelinks * 2);
- table->objs[i].links = (trav_link_t*)HDrealloc(table->objs[i].links, table->objs[i].sizelinks * sizeof(trav_link_t));
+ table->objs[i].links = (trav_link_t *)HDrealloc(table->objs[i].links, table->objs[i].sizelinks * sizeof(trav_link_t));
} /* end if */
/* insert it */
@@ -1168,31 +1171,21 @@ h5trav_visit(hid_t fid, const char *grp_name, hbool_t visit_start,
*
* Date: September 5, 2008
*
- * Modified:
- * Jonathan Kim
- * - Moved from h5ls.c to share among tools. (Sep 16, 2010)
- * - Renamed from elink_trav_add to symlink_visit_add for both soft and
- * external links. (May 25, 2010)
- * - Add type parameter to distingush between soft and external link for
- * sure, which prevent from mixing up visited link when the target names
- * are same between the soft and external link, as code marks with the
- * target name. (May 25,2010)
- *
*-------------------------------------------------------------------------
*/
herr_t
symlink_visit_add(symlink_trav_t *visited, H5L_type_t type, const char *file, const char *path)
{
size_t idx; /* Index of address to use */
- void *tmp_ptr;
/* Allocate space if necessary */
- if(visited->nused == visited->nalloc)
- {
+ if(visited->nused == visited->nalloc) {
+ void *tmp_ptr;
+
visited->nalloc = MAX(1, visited->nalloc * 2);
- if(NULL == (tmp_ptr = HDrealloc(visited->objs, visited->nalloc * sizeof(visited->objs[0]))))
+ if(NULL == (tmp_ptr = HDrealloc(visited->objs, visited->nalloc * sizeof(symlink_trav_path_t))))
return -1;
- visited->objs = tmp_ptr;
+ visited->objs = (symlink_trav_path_t *)tmp_ptr;
} /* end if */
/* Append it */
@@ -1202,22 +1195,19 @@ symlink_visit_add(symlink_trav_t *visited, H5L_type_t type, const char *file, co
visited->objs[idx].file = NULL;
visited->objs[idx].path = NULL;
- if (type == H5L_TYPE_EXTERNAL)
- {
- if(NULL == (visited->objs[idx].file = HDstrdup(file)))
- {
+ if(type == H5L_TYPE_EXTERNAL) {
+ if(NULL == (visited->objs[idx].file = HDstrdup(file))) {
visited->nused--;
return -1;
- }
- }
+ } /* end if */
+ } /* end if */
- if(NULL == (visited->objs[idx].path = HDstrdup(path)))
- {
+ if(NULL == (visited->objs[idx].path = HDstrdup(path))) {
visited->nused--;
- if (visited->objs[idx].file)
+ if(visited->objs[idx].file)
HDfree (visited->objs[idx].file);
return -1;
- }
+ } /* end if */
return 0;
} /* end symlink_visit_add() */
@@ -1235,16 +1225,6 @@ symlink_visit_add(symlink_trav_t *visited, H5L_type_t type, const char *file, co
*
* Date: September 5, 2008
*
- * Modified:
- * Jonathan Kim
- * - Moved from h5ls.c to share among tools. (Sep 16, 2010)
- * - Renamed from elink_trav_visited to symlink_is_visited for both soft and
- * external links. (May 25, 2010)
- * - Add type parameter to distingush between soft and external link for
- * sure, which prevent from mixing up visited link when the target names
- * are same between the soft and external link, as code marks with the
- * target name. (May 25,2010)
- *
*-------------------------------------------------------------------------
*/
hbool_t
@@ -1253,21 +1233,19 @@ symlink_is_visited(symlink_trav_t *visited, H5L_type_t type, const char *file, c
size_t u; /* Local index variable */
/* Look for symlink */
- for(u = 0; u < visited->nused; u++)
- {
+ for(u = 0; u < visited->nused; u++) {
/* Check for symlink values already in array */
/* check type and path pair to distingush between symbolic links */
- if ((visited->objs[u].type == type) && !HDstrcmp(visited->objs[u].path, path))
- {
+ if((visited->objs[u].type == type) && !HDstrcmp(visited->objs[u].path, path)) {
/* if external link, file need to be matched as well */
- if (visited->objs[u].type == H5L_TYPE_EXTERNAL)
- {
- if (!HDstrcmp(visited->objs[u].file, file))
- return (TRUE);
- }
+ if(visited->objs[u].type == H5L_TYPE_EXTERNAL)
+ if(!HDstrcmp(visited->objs[u].file, file))
+ return(TRUE);
+
return (TRUE);
- }
- }
+ } /* end if */
+ } /* end for */
+
/* Didn't find symlink */
return(FALSE);
} /* end symlink_is_visited() */
diff --git a/tools/lib/h5trav.h b/tools/lib/h5trav.h
index 3548c6b..352a9e5 100644
--- a/tools/lib/h5trav.h
+++ b/tools/lib/h5trav.h
@@ -51,14 +51,16 @@ typedef enum {
/* Struct to keep track of symbolic link targets visited.
* Functions: symlink_visit_add() and symlink_is_visited()
*/
+typedef struct symlink_trav_path_t {
+ H5L_type_t type;
+ char *file;
+ char *path;
+} symlink_trav_path_t;
+
typedef struct symlink_trav_t {
size_t nalloc;
size_t nused;
- struct {
- H5L_type_t type;
- char *file;
- char *path;
- } *objs;
+ symlink_trav_path_t *objs;
hbool_t dangle_link;
} symlink_trav_t;
diff --git a/tools/misc/h5repart_gentest.c b/tools/misc/h5repart_gentest.c
index 8420da5..f7d9a73 100644
--- a/tools/misc/h5repart_gentest.c
+++ b/tools/misc/h5repart_gentest.c
@@ -23,7 +23,6 @@
#include "hdf5.h"
#include "H5private.h"
-#define KB 1024
#define FAMILY_NUMBER 4
#define FAMILY_SIZE 1024
#define FILENAME "family_file%05d.h5"