summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2001-06-18 20:22:10 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2001-06-18 20:22:10 (GMT)
commitd41b9fffdfca2e97c36bc0ad0899fbb7b055f926 (patch)
tree51ed39b08a41a4f6947af07630eb40dfdb013d87 /tools
parentfcaf572430a8eda3f6519bd21311ef7a8e3c3c1f (diff)
downloadhdf5-d41b9fffdfca2e97c36bc0ad0899fbb7b055f926.zip
hdf5-d41b9fffdfca2e97c36bc0ad0899fbb7b055f926.tar.gz
hdf5-d41b9fffdfca2e97c36bc0ad0899fbb7b055f926.tar.bz2
[svn-r4012] Purpose:
Clean up compiler warnings. Description: Just code neatening mostly, some casts, etc. Platforms tested: FreeBSD 4.3 (hawkwind)
Diffstat (limited to 'tools')
-rw-r--r--tools/gifconv/decompress.c12
-rw-r--r--tools/gifconv/gif.h1
-rw-r--r--tools/gifconv/gif2hdf.c9
-rw-r--r--tools/gifconv/gif2mem.c1
-rw-r--r--tools/gifconv/gifread.c39
-rw-r--r--tools/gifconv/hdf2gif.c21
-rw-r--r--tools/gifconv/hdfgifwr.c60
-rw-r--r--tools/gifconv/readhdf.c19
-rw-r--r--tools/gifconv/writehdf.c18
-rw-r--r--tools/h5dump/h5dump.c14
-rw-r--r--tools/h5dump/h5dumptst.c42
-rw-r--r--tools/h5ls/h5ls.c4
-rw-r--r--tools/lib/h5tools.c106
-rw-r--r--tools/lib/h5tools.h2
-rw-r--r--tools/lib/h5tools_str.c140
-rw-r--r--tools/lib/h5tools_str.h2
-rw-r--r--tools/lib/h5tools_utils.c189
17 files changed, 320 insertions, 359 deletions
diff --git a/tools/gifconv/decompress.c b/tools/gifconv/decompress.c
index 18dbb3e..abccb7f 100644
--- a/tools/gifconv/decompress.c
+++ b/tools/gifconv/decompress.c
@@ -19,13 +19,8 @@ static int BitOffset = 0, /* Bit Offset of next code */
XC = 0, YC = 0, /* Output X and Y coords of current pixel */
Pass = 0, /* Used by output routine if WORDerlaced pic */
OutCount = 0, /* Decompressor output 'stack count' */
-RWidth, RHeight, /* screen dimensions */
IWidth, IHeight, /* image dimensions */
-LeftOfs, TopOfs, /* image offset */
-BitsPerPixel, /* Bits per pixel, read from GIF header */
BytesPerScanline, /* Bytes per scanline in output raster */
-ColorMapSize, /* number of colors */
-Background, /* background color */
CodeSize, /* Code size, read from GIF header */
InitCodeSize, /* Starting code size, used during Clear */
Code, /* Value returned by ReadCode */
@@ -73,7 +68,7 @@ int numused;
* three BYTEs, compute the bit Offset WORDo our 24-bit chunk, shift to
* bring the desired code to the bottom, then mask it off and return it.
*/
-ReadCode()
+static int ReadCode(void)
{
int RawCode, ByteOffset;
@@ -87,8 +82,7 @@ ReadCode()
}
-AddToPixel(Index)
-BYTE Index;
+static void AddToPixel(BYTE Index)
{
if (YC<IHeight)
*(Image + YC * BytesPerScanline + XC) = Index;
@@ -202,7 +196,7 @@ GIFHEAD *GifHead;
/* Allocate the Image */
- if (!(Image = (BYTE *)malloc(IWidth*IHeight))) {
+ if (!(Image = (BYTE *)malloc((size_t)IWidth*(size_t)IHeight))) {
printf("Out of memory");
exit(-1);
}
diff --git a/tools/gifconv/gif.h b/tools/gifconv/gif.h
index f697881..3f2a8da 100644
--- a/tools/gifconv/gif.h
+++ b/tools/gifconv/gif.h
@@ -169,7 +169,6 @@ int WriteHDF(GIFTOMEM , CHAR * , CHAR *);
*/
int ReadHDF(BYTE** data , BYTE palette[256][3] , hsize_t *image_size , CHAR *h5_file , CHAR *dset_name , CHAR *pal_name);
-BYTE *ReadDataSubBlocks(BYTE ** , WORD *);
BYTE *Decompress (GIFIMAGEDESC * , GIFHEAD *);
BYTE GetByte(BYTE *);
WORD GetWord(BYTE *);
diff --git a/tools/gifconv/gif2hdf.c b/tools/gifconv/gif2hdf.c
index 0211143..6b4ae2b 100644
--- a/tools/gifconv/gif2hdf.c
+++ b/tools/gifconv/gif2hdf.c
@@ -3,10 +3,9 @@
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
+
int
-main(argv , argc)
-int argv;
-char *argc[];
+main(int argv , char *argc[])
{
GIFTOMEM GifMemoryStruct;
@@ -60,11 +59,11 @@ char *argc[];
filesize = ftell(fpGif);
fseek(fpGif, 0L , 0);
if (filesize == 0) printf("File Size Zero");
- if (!(MemGif = StartPos = (BYTE *)malloc(filesize))) {
+ if (!(MemGif = StartPos = (BYTE *)malloc((size_t)filesize))) {
printf("Out of memory");
exit (-1);
}
- if (fread(MemGif,filesize,1,fpGif) != 1) {
+ if (fread(MemGif,(size_t)filesize,1,fpGif) != 1) {
printf("Corrupted Input File");
exit(-1);
}
diff --git a/tools/gifconv/gif2mem.c b/tools/gifconv/gif2mem.c
index 92ca8e5..830eba7 100644
--- a/tools/gifconv/gif2mem.c
+++ b/tools/gifconv/gif2mem.c
@@ -25,7 +25,6 @@
/* #include <hdf.h> */
#define VERSION "1.00"
-extern int EndianOrder;
GIFTOMEM
Gif2Mem(MemGif)
diff --git a/tools/gifconv/gifread.c b/tools/gifconv/gifread.c
index 1196241..cb033d9 100644
--- a/tools/gifconv/gifread.c
+++ b/tools/gifconv/gifread.c
@@ -3,14 +3,14 @@
#include "gif.h"
int EndianOrder;
-int i;
+static BYTE * ReadDataSubBlocks(BYTE **MemGif2, WORD *DSize);
WORD
GetWord (MemGif)
BYTE *MemGif;
{
- register WORD w;
+ WORD w;
if (EndianOrder == 1) /* LittleEndian */
{
w = (WORD) (*MemGif++ & 0xFF);
@@ -46,14 +46,14 @@ ReadGifHeader(GifHead, MemGif2)
GIFHEAD *GifHead; /* Pointer to GIF header structure */
BYTE **MemGif2; /* GIF image file input FILE stream */
{
- register WORD i; /* Loop counter */
+ WORD i; /* Loop counter */
WORD tableSize; /* Number of entires in the Global Color Table */
GifHead->TableSize = 0;
for (i = 0 ; i < 6 ; i++) {
GifHead->HeaderDump[i] = *(*MemGif2)++;
}
- if (strncmp(GifHead->HeaderDump , "GIF" , 3)) {
+ if (strncmp((const char *)GifHead->HeaderDump , "GIF" , 3)) {
printf("The file does not appear to be a valid GIF file.\n");
exit(-1);
}
@@ -114,9 +114,9 @@ ReadGifImageDesc(GifImageDesc, MemGif2)
GIFIMAGEDESC *GifImageDesc; /* Pointer to GIF image descriptor structure */
BYTE **MemGif2; /* GIF image file input FILE stream */
{
- register WORD i; /* Loop counter */
+ WORD i; /* Loop counter */
WORD tableSize; /* Number of entries in the Local Color Table */
- BYTE Interlace; /* PackedField & 0x20 gives information on interlacing */
+ /* BYTE Interlace; */ /* PackedField & 0x20 gives information on interlacing */
BYTE *TempPtr;
int ch , ch1;
@@ -210,11 +210,11 @@ ReadGifGraphicControl(GifGraphicControl, MemGif2)
GIFGRAPHICCONTROL *GifGraphicControl; /* Pointer to GC Extension structure */
BYTE **MemGif2; /* GIF image file input FILE stream */
{
+ int i;
-
- for (i = 0 ; i < 5 ; i++) {
- GifGraphicControl->GCEDump[i] = *(*MemGif2)++;
- }
+ for (i = 0 ; i < 5 ; i++) {
+ GifGraphicControl->GCEDump[i] = *(*MemGif2)++;
+ }
return(0); /* No FILE stream error occured */
}
@@ -234,6 +234,8 @@ ReadGifPlainText(GifPlainText, MemGif2)
GIFPLAINTEXT *GifPlainText; /* Pointer to Plain Text Extension structure */
BYTE **MemGif2; /* GIF image file input FILE stream */
{
+ int i;
+
for (i = 0 ; i < 13 ; i++) {
GifPlainText->PTEDump[i] = *(*MemGif2)++;
}
@@ -270,6 +272,8 @@ ReadGifApplication(GifApplication, MemGif2)
GIFAPPLICATION *GifApplication; /* Pointer to Application Extension structure */
BYTE **MemGif2; /* GIF image file input FILE stream */
{
+ int i;
+
for (i = 0 ; i < 12 ; i++) {
GifApplication->AEDump[i] = *(*MemGif2)++;
}
@@ -327,9 +331,8 @@ BYTE **MemGif2; /* GIF image file input FILE stream */
** otherwise a valid pointer if no error occured.
*/
static BYTE *
-ReadDataSubBlocks(MemGif2 , DSize)
-BYTE **MemGif2; /* GIF image file input FILE stream */
-WORD *DSize;
+ReadDataSubBlocks(BYTE **MemGif2, /* GIF image file input FILE stream */
+ WORD *DSize)
{
BYTE *ptr1; /* Pointer used to "walk the heap" */
BYTE *ptr2; /* Pointer used to mark the top of the heap */
@@ -342,7 +345,7 @@ WORD *DSize;
dataSize = *(*MemGif2)++; /* Get the size of the first sub-block */
/* Allocate initial data buffer */
- if (!(ptr1 = ptr2 = (BYTE *) malloc(dataSize + 1))) {
+ if (!(ptr1 = ptr2 = (BYTE *) malloc((size_t)dataSize + 1))) {
printf("Out of memory. Allocation of memory for data sub-blocks for\neither Comment, Plain Text or Application Extensions failed");
return((BYTE *) NULL);
}
@@ -352,7 +355,9 @@ WORD *DSize;
bufSize += (dataSize); /* Running total of the buffer size */
*DSize = bufSize;
- /* *ptr1++ = dataSize; /* Write the data count */
+#ifdef COMMENTED_OUT
+ *ptr1++ = dataSize; /* Write the data count */
+#endif /* COMMENTED_OUT */
while (dataSize--) /* Read/write the Plain Text data */
*ptr1++ = *(*MemGif2)++;
@@ -370,7 +375,9 @@ WORD *DSize;
}
- /**ptr1++ = (BYTE) NULL; /* Add NULL to simulate Terminator value */
+#ifdef COMMENTED_OUT
+ *ptr1++ = (BYTE) NULL; /* Add NULL to simulate Terminator value */
+#endif /* COMMENTED_OUT */
*ptr1++ = '\0';
return(ptr2); /* Return a pointer to the sub-block data */
diff --git a/tools/gifconv/hdf2gif.c b/tools/gifconv/hdf2gif.c
index 9c4133e..39c75d1 100644
--- a/tools/gifconv/hdf2gif.c
+++ b/tools/gifconv/hdf2gif.c
@@ -19,16 +19,18 @@ extern int hdfWriteGIF(FILE *fp, BYTE *pic, int ptype, int w, int h, BYTE *rmap,
int EndianOrder;
-void PutByte(BYTE b , FILE *fpGif)
+#ifdef NOT_USED
+static void PutByte(BYTE b , FILE *fpGif)
{
if (fputc(b , fpGif) == EOF) {
printf("File Writing Error, cannot continue");
exit(-1);
}
}
+#endif /* NOT_USED */
-void putword(int w, FILE *fp)
+static void putword(int w, FILE *fp)
{
/* writes a 16-bit integer in GIF order (LSB first) */
@@ -37,7 +39,8 @@ void putword(int w, FILE *fp)
fputc((w>>8)&0xff,fp);
}
-void usage() {
+static void usage(void )
+{
printf("Usage: h52gif <h5_file> <gif_file> -i <h5_image> [-p <h5_palette>]\n");
printf("h52gif expects *at least* one h5_image. You may repeat -i <h5_image> [-p <h5_palette>] at most 50 times (maximum of 50 images).\n");
}
@@ -53,8 +56,6 @@ int main(int argc , char **argv) {
CHAR *HDFName = NULL;
CHAR *GIFName = NULL;
- CHAR *image_path = NULL;
- CHAR *pal_path = NULL;
/* reference variables */
int has_local_palette; /* treated as a flag */
@@ -76,7 +77,7 @@ int main(int argc , char **argv) {
int CountDown;
int curx , cury;
int time_out = 0; /* time between two images in the animation */
- int n_images , index;
+ int n_images , idx;
BYTE pc2nc[256] , r1[256] , g1[256] , b1[256];
@@ -172,7 +173,7 @@ int main(int argc , char **argv) {
n_images = number_of_images;
Background = 0;
- for (index = 0 ; index < n_images ; index++) {
+ for (idx = 0 ; idx < n_images ; idx++) {
/* try to read the image and the palette */
/* Lots of funky stuff to support multiple images has been taken off.
@@ -183,7 +184,7 @@ int main(int argc , char **argv) {
** to write the global palette out and then independantly write the smaller local
** palettes
*/
- if (ReadHDF(&Image , GlobalPalette , dim_sizes , HDFName , image_name_arr[index] , pal_name_arr[index]) < 0) {
+ if (ReadHDF(&Image , GlobalPalette , dim_sizes , HDFName , image_name_arr[idx] , pal_name_arr[idx]) < 0) {
fprintf(stderr , "Unable to read HDF file\n");
return -1;
}
@@ -257,7 +258,7 @@ int main(int argc , char **argv) {
/* If it is the first image we do all the header stuff that isn't required for the
** rest of the images.
*/
- if (index == 0) {
+ if (idx == 0) {
/* Write out the GIF header and logical screen descriptor */
if (n_images > 1) {
fwrite("GIF89a", 1, 6, fpGif); /* the GIF magic number */
@@ -331,7 +332,7 @@ int main(int argc , char **argv) {
fputc (InitCodeSize , fpGif);
- i = hdfWriteGIF(fpGif , Image , 0 , dim_sizes[0] , dim_sizes[1] , r1, g1 , b1 , pc2nc , 256 , 8 , BitsPerPixel);
+ i = hdfWriteGIF(fpGif , Image , 0 , (int)dim_sizes[0] , (int)dim_sizes[1] , r1, g1 , b1 , pc2nc , 256 , 8 , BitsPerPixel);
fputc(0x00 , fpGif);
free (Image);
}
diff --git a/tools/gifconv/hdfgifwr.c b/tools/gifconv/hdfgifwr.c
index 28d556e..62b3eae 100644
--- a/tools/gifconv/hdfgifwr.c
+++ b/tools/gifconv/hdfgifwr.c
@@ -67,7 +67,6 @@ static long CountDown;
static int Interlace;
#ifdef __STDC__
-static void putword(int, FILE *);
static void compress(int, FILE *, byte *, int);
static void output(int);
static void cl_block(void);
@@ -76,27 +75,16 @@ static void char_init(void);
static void char_out(int);
static void flush_char(void);
#else
-static void putword(), compress(), output(), cl_block(), cl_hash();
+static void compress(), output(), cl_block(), cl_hash();
static void char_init(), char_out(), flush_char();
#endif
static byte pc2nc[256],r1[256],g1[256],b1[256];
-void xvbzero(s, len)
- char *s;
- int len;
-{
- for ( ; len>0; len--) *s++ = 0;
-}
-
/*************************************************************/
-int hdfWriteGIF(fp, pic, ptype, w, h, rmap, gmap, bmap, pc2ncmap, numcols, colorstyle, BitsPerPixel)
- FILE *fp;
- byte *pic;
- int ptype, w,h;
- byte *rmap, *gmap, *bmap , *pc2ncmap;
- int numcols, colorstyle;
- int BitsPerPixel;
+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)
{
int RWidth, RHeight;
int LeftOfs, TopOfs;
@@ -143,21 +131,6 @@ int hdfWriteGIF(fp, pic, ptype, w, h, rmap, gmap, bmap, pc2ncmap, numcols, colo
-/******************************/
-static void putword(w, fp)
-int w;
-FILE *fp;
-{
- /* writes a 16-bit integer in GIF order (LSB first) */
-
- fputc(w &0xff, fp);
-
- fputc((w>>8)&0xff,fp);
-}
-
-
-
-
/***********************************************************************/
static unsigned long cur_accum = 0;
static int cur_bits = 0;
@@ -252,8 +225,8 @@ int len;
/* initialize 'compress' globals */
maxbits = XV_BITS;
maxmaxcode = 1<<XV_BITS;
- xvbzero((char *) htab, sizeof(htab));
- xvbzero((char *) codetab, sizeof(codetab));
+ memset(htab, 0, sizeof(htab));
+ memset(codetab, 0, sizeof(codetab));
hsize = HSIZE;
free_ent = 0;
clear_flg = 0;
@@ -375,7 +348,7 @@ int code;
cur_bits += n_bits;
while( cur_bits >= 8 ) {
- char_out( (unsigned int) (cur_accum & 0xff) );
+ char_out( (int)((unsigned int) cur_accum & 0xff) );
cur_accum >>= 8;
cur_bits -= 8;
}
@@ -403,7 +376,7 @@ int code;
if( code == EOFCode ) {
/* At EOF, write the rest of the buffer */
while( cur_bits > 0 ) {
- char_out( (unsigned int)(cur_accum & 0xff) );
+ char_out( (int)((unsigned int)cur_accum & 0xff) );
cur_accum >>= 8;
cur_bits -= 8;
}
@@ -434,14 +407,14 @@ static void cl_block () /* table clear for block compress */
/********************************/
-static void cl_hash(hsize) /* reset code table */
-register count_int hsize;
+static void cl_hash(hashsize) /* reset code table */
+count_int hashsize;
{
- register count_int *htab_p = htab+hsize;
- register long i;
- register long m1 = -1;
+ count_int *htab_p = htab+hashsize;
+ long i;
+ long m1 = -1;
- i = hsize - 16;
+ i = hashsize - 16;
do { /* might use Sys V memset(3) here */
*(htab_p-16) = m1;
*(htab_p-15) = m1;
@@ -495,8 +468,7 @@ static char accum[ 256 ];
* Add a character to the end of the current packet, and if it is 254
* characters, flush the packet to disk.
*/
-static void char_out(c)
-int c;
+static void char_out(int c)
{
accum[ a_count++ ] = c;
if( a_count >= 254 )
@@ -510,7 +482,7 @@ static void flush_char()
{
if( a_count > 0 ) {
fputc( a_count, g_outfile );
- fwrite( accum, 1, a_count, g_outfile );
+ fwrite( accum, 1, (size_t)a_count, g_outfile );
a_count = 0;
}
}
diff --git a/tools/gifconv/readhdf.c b/tools/gifconv/readhdf.c
index a7101c9..52a1837 100644
--- a/tools/gifconv/readhdf.c
+++ b/tools/gifconv/readhdf.c
@@ -35,14 +35,10 @@ int ReadHDF(BYTE** data ,
herr_t status; /* status variable */
hid_t dspace; /* dataspace identifier for the the dataset */
hid_t dset; /* dataset identifier */
-
hid_t pal_set; /* dataset for palette */
hid_t pal_space;/* dataspace for palette */
- hsize_t pal_size; /* size of the palette */
-
hsize_t datasize; /* size of the image */
hsize_t maxdims; /* dummy */
-
int pal_exist = 0; /* do we have a palette? */
/* check stuff */
@@ -85,7 +81,7 @@ int ReadHDF(BYTE** data ,
datasize = image_size[0] * image_size[1];
/* allocate memory to store the image */
- if ((*data = (BYTE*) malloc(datasize)) == NULL) {
+ if ((*data = (BYTE*) malloc((size_t)datasize)) == NULL) {
fprintf(stderr , "Out of memory, exiting");
return -1;
}
@@ -98,11 +94,8 @@ int ReadHDF(BYTE** data ,
}
if (pal_exist) {
- hsize_t pal_size[2];
- hsize_t max_pal_dims[2];
+ hsize_t loc_pal_size[2];
hsize_t pal_datasize;
- CHAR *pal_path;
-
BYTE *temp_buf;
hsize_t temp_size;
@@ -121,19 +114,19 @@ int ReadHDF(BYTE** data ,
}
/* get the dimension size of the palette. */
- if (H5Sget_simple_extent_dims(pal_space , pal_size , &max_pal_dims) !=2 ) {
+ if (H5Sget_simple_extent_dims(pal_space , loc_pal_size , NULL) !=2 ) {
fprintf(stderr , "Unable to get dimension info\n");
pal_exist = 0;
return -1;
}
/* size needed to store the image */
- pal_datasize = pal_size[0] * pal_size[1];
+ pal_datasize = loc_pal_size[0] * loc_pal_size[1];
/* copy stuff into a temp buffer and then copy 256*3 elements to palette */
temp_size = H5Dget_storage_size(pal_set);
- temp_buf = (BYTE*) malloc (temp_size * sizeof(BYTE));
+ temp_buf = (BYTE*) malloc ((size_t)temp_size * sizeof(BYTE));
/* make sure that the palette is actually 256 X 3 so that we don't create overflows */
if (pal_datasize > 256 * 3)
@@ -152,7 +145,7 @@ int ReadHDF(BYTE** data ,
}
/* copy stuff into the actual palette */
- memcpy(palette , temp_buf , pal_datasize);
+ memcpy(palette , temp_buf , (size_t)pal_datasize);
/* get rid of the temp memory */
cleanup(temp_buf);
diff --git a/tools/gifconv/writehdf.c b/tools/gifconv/writehdf.c
index 7afccdf..5426c27 100644
--- a/tools/gifconv/writehdf.c
+++ b/tools/gifconv/writehdf.c
@@ -7,7 +7,8 @@
** Function: write_text_attribute
** Use: Just a small wrapper to write text attributes easily
********************************************************************/
-int write_text_attribute(hid_t dataset_id , char *attr_name , char *attr_value) {
+static int write_text_attribute(hid_t dataset_id , const char *attr_name , const char *attr_value)
+{
/* variables for the attributes */
hsize_t attr_dims_size; /* dimensions for the attribute */
@@ -26,7 +27,7 @@ int write_text_attribute(hid_t dataset_id , char *attr_name , char *attr_value)
/* set the type to string */
attr_type_id = H5Tcopy(H5T_C_S1);
- H5Tset_size(attr_type_id , attr_dims_size);
+ H5Tset_size(attr_type_id , (size_t)attr_dims_size);
/* create the dataspace for the attribute */
attr_dataspace_id = H5Screate_simple(1 , &attr_dims_size , NULL);
@@ -59,18 +60,14 @@ char *HDFName;
char *GIFFileName;
{
GIFHEAD gifHead; /* GIF Header structure */
- GIFIMAGEDESC* gifImageDesc; /* Logical Image Descriptor struct */
+ GIFIMAGEDESC* gifImageDesc; /* Logical Image Descriptor struct */
long ImageCount , /* number of images */
CommentCount, /* number of comments */
ApplicationCount , /* number of application extensions */
PlainTextCount; /* number of plain text extensions */
- char ImageName[256], /* Image name for the GR Image */
- CommentName[256],
- ApplicationName[256],
- PlainTextName[256];
-
+ char ImageName[256]; /* Image name for the GR Image */
char GroupName[VSNAMELENMAX]; /* so that we can name the subgroups appropriately */
/* H5 variables */
@@ -82,11 +79,6 @@ char *GIFFileName;
/* temp counter */
int i;
-
-
-
-
-
/* get the GIFMem stuff */
gifHead = *(GifMemoryStruct.GifHeader);
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index 5eb2a7f..3e8b396 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -1745,7 +1745,7 @@ dump_subsetting_header(struct subset_t *sset, int dims)
indentation(indent);
printf("%s %s ", dump_header_format->startbegin,
dump_header_format->startblockbegin);
- dump_dims(sset->start, dims);
+ dump_dims((hsize_t *)sset->start, dims);
printf("%s %s\n", dump_header_format->startend,
dump_header_format->startblockend);
@@ -2040,7 +2040,7 @@ parse_subset_params(char *dset)
*brace++ = '\0';
s = calloc(1, sizeof(struct subset_t));
- s->start = parse_hsize_list(brace);
+ s->start = (hssize_t *)parse_hsize_list(brace);
while (*brace && *brace != ';')
brace++;
@@ -2531,7 +2531,7 @@ parse_start:
*/
do {
switch ((char)opt) {
- case 's': free(s->start); s->start = parse_hsize_list(opt_arg); break;
+ case 's': free(s->start); s->start = (hssize_t *)parse_hsize_list(opt_arg); break;
case 'S': free(s->stride); s->stride = parse_hsize_list(opt_arg); break;
case 'c': free(s->count); s->count = parse_hsize_list(opt_arg); break;
case 'k': free(s->block); s->block = parse_hsize_list(opt_arg); break;
@@ -2902,10 +2902,10 @@ print_enum(hid_t type)
for (j = 0; j < dst_size; j++)
printf("%02x", value[i * dst_size + j]);
} else if (H5T_SGN_NONE == H5Tget_sign(native)) {
- printf("%" PRINTF_LL_WIDTH "u", *((unsigned long_long *)
+ HDfprintf(stdout,"%" PRINTF_LL_WIDTH "u", *((unsigned long_long *)
((void *) (value + i * dst_size))));
} else {
- printf("%" PRINTF_LL_WIDTH "d",
+ HDfprintf(stdout,"%" PRINTF_LL_WIDTH "d",
*((long_long *) ((void *) (value + i * dst_size))));
}
@@ -4867,10 +4867,10 @@ xml_print_enum(hid_t type)
for (j = 0; j < dst_size; j++)
printf("%02x", value[i * dst_size + j]);
} else if (H5T_SGN_NONE == H5Tget_sign(native)) {
- printf("%" PRINTF_LL_WIDTH "u", *((unsigned long_long *)
+ HDfprintf(stdout,"%" PRINTF_LL_WIDTH "u", *((unsigned long_long *)
((void *) (value + i * dst_size))));
} else {
- printf("%" PRINTF_LL_WIDTH "d",
+ HDfprintf(stdout,"%" PRINTF_LL_WIDTH "d",
*((long_long *) ((void *) (value + i * dst_size))));
}
printf("\n");
diff --git a/tools/h5dump/h5dumptst.c b/tools/h5dump/h5dumptst.c
index bdb394b..b4ab79e 100644
--- a/tools/h5dump/h5dumptst.c
+++ b/tools/h5dump/h5dumptst.c
@@ -1667,15 +1667,15 @@ static void test_nestcomp(void)
float b;
double c;
cmp_t d;
- } s1_t;
+ } s2_t;
hid_t cmp_tid; /* Handle for the compound datatype */
hid_t char_id; /* Handle for the string datatype */
hid_t array_dt;
hsize_t array_dims[] = {2}; /* Dataspace dimensions */
int ndims = 1; /* Number of dimensions in the array field */
- s1_t s1[10];
- hid_t s1_tid; /* File datatype identifier */
+ s2_t s1[10];
+ hid_t s2_tid; /* File datatype identifier */
int i;
hid_t file, dataset, space; /* Handles */
@@ -1724,30 +1724,30 @@ static void test_nestcomp(void)
H5Tinsert(cmp_tid, "array_name", HOFFSET(cmp_t, b), array_dt);
H5Tclose(array_dt);
- s1_tid = H5Tcreate (H5T_COMPOUND, sizeof(s1_t));
- H5Tinsert(s1_tid, "a_name", HOFFSET(s1_t, a), H5T_NATIVE_INT);
- H5Tinsert(s1_tid, "c_name", HOFFSET(s1_t, c), H5T_NATIVE_DOUBLE);
- H5Tinsert(s1_tid, "b_name", HOFFSET(s1_t, b), H5T_NATIVE_FLOAT);
+ s2_tid = H5Tcreate (H5T_COMPOUND, sizeof(s2_t));
+ H5Tinsert(s2_tid, "a_name", HOFFSET(s2_t, a), H5T_NATIVE_INT);
+ H5Tinsert(s2_tid, "c_name", HOFFSET(s2_t, c), H5T_NATIVE_DOUBLE);
+ H5Tinsert(s2_tid, "b_name", HOFFSET(s2_t, b), H5T_NATIVE_FLOAT);
/* Insert compound memeber created above */
- H5Tinsert(s1_tid, "d_name", HOFFSET(s1_t, d), cmp_tid);
+ H5Tinsert(s2_tid, "d_name", HOFFSET(s2_t, d), cmp_tid);
/*
* Create the dataset.
*/
- dataset = H5Dcreate(file, datasetname, s1_tid, space, H5P_DEFAULT);
+ dataset = H5Dcreate(file, datasetname, s2_tid, space, H5P_DEFAULT);
/*
* Wtite data to the dataset;
*/
- status = H5Dwrite(dataset, s1_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, s1);
+ status = H5Dwrite(dataset, s2_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, s1);
if (status < 0)
fprintf(stderr, "test_nestcomp H5Dwrite failed\n");
/*
* Release resources
*/
- H5Tclose(s1_tid);
+ H5Tclose(s2_tid);
H5Tclose(cmp_tid);
H5Tclose(char_id);
H5Sclose(space);
@@ -2241,8 +2241,8 @@ static void test_array4(void)
typedef struct { /* Typedef for compound datatype */
int i;
float f;
- } s1_t;
- s1_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
+ } s2_t;
+ s2_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
hid_t fid1; /* HDF5 File IDs */
hid_t dataset; /* Dataset ID */
hid_t sid1; /* Dataspace ID */
@@ -2267,13 +2267,13 @@ static void test_array4(void)
sid1 = H5Screate_simple(SPACE1_RANK, sdims1, NULL);
/* Create a compound datatype to refer to */
- tid2 = H5Tcreate(H5T_COMPOUND, sizeof(s1_t));
+ tid2 = H5Tcreate(H5T_COMPOUND, sizeof(s2_t));
/* Insert integer field */
- ret = H5Tinsert (tid2, "i", HOFFSET(s1_t,i), H5T_NATIVE_INT);
+ ret = H5Tinsert (tid2, "i", HOFFSET(s2_t,i), H5T_NATIVE_INT);
/* Insert float field */
- ret = H5Tinsert (tid2, "f", HOFFSET(s1_t,f), H5T_NATIVE_FLOAT);
+ ret = H5Tinsert (tid2, "f", HOFFSET(s2_t,f), H5T_NATIVE_FLOAT);
/* Create an array datatype to refer to */
tid1 = H5Tarray_create (tid2,ARRAY1_RANK,tdims1,NULL);
@@ -2299,8 +2299,8 @@ static void test_array5(void)
typedef struct { /* Typedef for compound datatype */
int i;
float f[ARRAY1_DIM1];
- } s1_t;
- s1_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
+ } s2_t;
+ s2_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
hid_t fid1; /* HDF5 File IDs */
hid_t dataset; /* Dataset ID */
hid_t sid1; /* Dataspace ID */
@@ -2327,16 +2327,16 @@ static void test_array5(void)
sid1 = H5Screate_simple(SPACE1_RANK, sdims1, NULL);
/* Create a compound datatype to refer to */
- tid2 = H5Tcreate(H5T_COMPOUND, sizeof(s1_t));
+ tid2 = H5Tcreate(H5T_COMPOUND, sizeof(s2_t));
/* Insert integer field */
- ret = H5Tinsert (tid2, "i", HOFFSET(s1_t,i), H5T_NATIVE_INT);
+ ret = H5Tinsert (tid2, "i", HOFFSET(s2_t,i), H5T_NATIVE_INT);
/* Create an array of floats datatype */
tid3 = H5Tarray_create (H5T_NATIVE_FLOAT,ARRAY1_RANK,tdims1,NULL);
/* Insert float array field */
- ret = H5Tinsert (tid2, "f", HOFFSET(s1_t,f), tid3);
+ ret = H5Tinsert (tid2, "f", HOFFSET(s2_t,f), tid3);
/* Close array of floats field datatype */
ret=H5Tclose(tid3);
diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c
index 5a2b0a1..5cd92cd 100644
--- a/tools/h5ls/h5ls.c
+++ b/tools/h5ls/h5ls.c
@@ -847,10 +847,10 @@ display_enum_type(hid_t type, int ind)
printf("%02x", value[i*dst_size+j]);
}
} else if (H5T_SGN_NONE==H5Tget_sign(native)) {
- printf("%"PRINTF_LL_WIDTH"u",
+ HDfprintf(stdout,"%"PRINTF_LL_WIDTH"u",
*((unsigned long_long*)((void*)(value+i*dst_size))));
} else {
- printf("%"PRINTF_LL_WIDTH"d",
+ HDfprintf(stdout,"%"PRINTF_LL_WIDTH"d",
*((long_long*)((void*)(value+i*dst_size))));
}
}
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c
index 2341c7f..fc2d034 100644
--- a/tools/lib/h5tools.c
+++ b/tools/lib/h5tools.c
@@ -90,8 +90,8 @@ h5tools_close(void)
{
if (h5tools_init_g) {
if (rawdatastream && rawdatastream != stdout) {
- if (fclose(rawdatastream))
- perror("closing rawdatastream");
+ if (HDfclose(rawdatastream))
+ HDperror("closing rawdatastream");
else
rawdatastream = NULL;
}
@@ -204,7 +204,7 @@ h5tools_fopen(const char *fname, char *drivername, size_t drivername_size)
/* Save the driver name */
if (drivername && drivername_size) {
if (fid >= 0) {
- strncpy(drivername, driver[drivernum].name, drivername_size);
+ HDstrncpy(drivername, driver[drivernum].name, drivername_size);
drivername[drivername_size - 1] = '\0';
} else {
/*no file opened*/
@@ -271,13 +271,13 @@ h5tools_simple_prefix(FILE *stream, const h5dump_t *info,
if (!ctx->need_prefix)
return;
- memset(&prefix, 0, sizeof(h5tools_str_t));
+ HDmemset(&prefix, 0, sizeof(h5tools_str_t));
/* Terminate previous line, if any */
if (ctx->cur_column) {
- fputs(OPT(info->line_suf, ""), stream);
- putc('\n', stream);
- fputs(OPT(info->line_sep, ""), stream);
+ HDfputs(OPT(info->line_suf, ""), stream);
+ HDputc('\n', stream);
+ HDfputs(OPT(info->line_sep, ""), stream);
}
/* Calculate new prefix */
@@ -298,16 +298,16 @@ h5tools_simple_prefix(FILE *stream, const h5dump_t *info,
}
if (elmtno == 0 && secnum == 0 && info->line_1st)
- fputs(h5tools_str_fmt(&prefix, 0, info->line_1st), stream);
+ HDfputs(h5tools_str_fmt(&prefix, 0, info->line_1st), stream);
else if (secnum && info->line_cont)
- fputs(h5tools_str_fmt(&prefix, 0, info->line_cont), stream);
+ HDfputs(h5tools_str_fmt(&prefix, 0, info->line_cont), stream);
else
- fputs(h5tools_str_fmt(&prefix, 0, info->line_pre), stream);
+ HDfputs(h5tools_str_fmt(&prefix, 0, info->line_pre), stream);
templength = h5tools_str_len(&prefix);
for (i = 0; i < indentlevel; i++){
- fputs(h5tools_str_fmt(&prefix, 0, info->line_indent), stream);
+ HDfputs(h5tools_str_fmt(&prefix, 0, info->line_indent), stream);
templength += h5tools_str_len(&prefix);
}
@@ -366,7 +366,7 @@ h5tools_dump_simple_data(FILE *stream, const h5dump_t *info, hid_t container,
*to the ctx->size_last_dim. */
/* Setup */
- memset(&buffer, 0, sizeof(h5tools_str_t));
+ HDmemset(&buffer, 0, sizeof(h5tools_str_t));
size = H5Tget_size(type);
if (info->line_ncols > 0)
@@ -390,8 +390,8 @@ h5tools_dump_simple_data(FILE *stream, const h5dump_t *info, hid_t container,
*/
if (info->line_multi_new == 1 &&
(ctx->cur_column + h5tools_ncols(s) +
- strlen(OPT(info->elmt_suf2, " ")) +
- strlen(OPT(info->line_suf, ""))) > ncols) {
+ HDstrlen(OPT(info->elmt_suf2, " ")) +
+ HDstrlen(OPT(info->line_suf, ""))) > ncols) {
if (ctx->prev_multiline) {
/*
* ... and the previous element also occupied more than one
@@ -399,8 +399,8 @@ h5tools_dump_simple_data(FILE *stream, const h5dump_t *info, hid_t container,
*/
ctx->need_prefix = TRUE;
} else if ((ctx->prev_prefix_len + h5tools_ncols(s) +
- strlen(OPT(info->elmt_suf2, " ")) +
- strlen(OPT(info->line_suf, ""))) <= ncols) {
+ HDstrlen(OPT(info->elmt_suf2, " ")) +
+ HDstrlen(OPT(info->line_suf, ""))) <= ncols) {
/*
* ...but *could* fit on one line otherwise, then we
* should end the current line and start this element on its
@@ -432,8 +432,8 @@ h5tools_dump_simple_data(FILE *stream, const h5dump_t *info, hid_t container,
*/
if (info->line_multi_new == 1 && ctx->prev_multiline &&
(ctx->cur_column + h5tools_ncols(s) +
- strlen(OPT(info->elmt_suf2, " ")) +
- strlen(OPT(info->line_suf, ""))) > ncols)
+ HDstrlen(OPT(info->elmt_suf2, " ")) +
+ HDstrlen(OPT(info->line_suf, ""))) > ncols)
ctx->need_prefix = TRUE;
/*
@@ -463,8 +463,8 @@ h5tools_dump_simple_data(FILE *stream, const h5dump_t *info, hid_t container,
*/
if ((!info->skip_first || i) &&
(ctx->cur_column + strlen(section) +
- strlen(OPT(info->elmt_suf2, " ")) +
- strlen(OPT(info->line_suf, ""))) > ncols)
+ HDstrlen(OPT(info->elmt_suf2, " ")) +
+ HDstrlen(OPT(info->line_suf, ""))) > ncols)
ctx->need_prefix = 1;
/*
@@ -477,13 +477,13 @@ h5tools_dump_simple_data(FILE *stream, const h5dump_t *info, hid_t container,
h5tools_simple_prefix(stream, info, ctx, i, secnum);
} else if ((i || ctx->continuation) && secnum == 0) {
- fputs(OPT(info->elmt_suf2, " "), stream);
- ctx->cur_column += strlen(OPT(info->elmt_suf2, " "));
+ HDfputs(OPT(info->elmt_suf2, " "), stream);
+ ctx->cur_column += HDstrlen(OPT(info->elmt_suf2, " "));
}
/* Print the section */
- fputs(section, stream);
- ctx->cur_column += strlen(section);
+ HDfputs(section, stream);
+ ctx->cur_column += HDstrlen(section);
}
ctx->prev_multiline = multiline;
@@ -513,7 +513,7 @@ h5tools_dump_simple_subset(FILE *stream, const h5dump_t *info, hid_t dset,
{
herr_t ret; /*the value to return */
hid_t f_space; /*file data space */
- hsize_t elmtno, i; /*counters */
+ hsize_t i; /*counters */
hssize_t zero = 0; /*vector of zeros */
unsigned int flags; /*buffer extent flags */
hsize_t total_size[H5S_MAX_RANK];/*total size of dataset*/
@@ -542,7 +542,7 @@ h5tools_dump_simple_subset(FILE *stream, const h5dump_t *info, hid_t dset,
* great and the dimensionality of the items selected for printing must
* match the dimensionality of the dataset.
*/
- memset(&ctx, 0, sizeof(ctx));
+ HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = indentlevel;
ctx.need_prefix = 1;
ctx.ndims = H5Sget_simple_extent_ndims(f_space);
@@ -604,7 +604,7 @@ h5tools_dump_simple_subset(FILE *stream, const h5dump_t *info, hid_t dset,
}
assert(sm_nbytes == (hsize_t)((size_t)sm_nbytes)); /*check for overflow*/
- sm_buf = malloc((size_t)sm_nelmts * p_type_nbytes);
+ sm_buf = HDmalloc((size_t)sm_nelmts * p_type_nbytes);
sm_space = H5Screate_simple(1, &sm_nelmts, NULL);
H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, &zero, NULL, &sm_nelmts, NULL);
@@ -613,7 +613,7 @@ h5tools_dump_simple_subset(FILE *stream, const h5dump_t *info, hid_t dset,
if (H5Dread(dset, p_type, sm_space, f_space, H5P_DEFAULT, sm_buf) < 0) {
H5Sclose(f_space);
H5Sclose(sm_space);
- free(sm_buf);
+ HDfree(sm_buf);
return FAIL;
}
@@ -629,15 +629,15 @@ h5tools_dump_simple_subset(FILE *stream, const h5dump_t *info, hid_t dset,
h5tools_dump_simple_data(stream, info, dset, &ctx, flags, sm_nelmts,
p_type, sm_buf);
- free(sm_buf);
+ HDfree(sm_buf);
ctx.continuation++;
}
/* Terminate the output */
if (ctx.cur_column) {
- fputs(OPT(info->line_suf, ""), stream);
- putc('\n', stream);
- fputs(OPT(info->line_sep, ""), stream);
+ HDfputs(OPT(info->line_suf, ""), stream);
+ HDputc('\n', stream);
+ HDfputs(OPT(info->line_sep, ""), stream);
}
ret = SUCCEED;
@@ -707,7 +707,7 @@ h5tools_dump_simple_dset(FILE *stream, const h5dump_t *info, hid_t dset,
* great and the dimensionality of the items selected for printing must
* match the dimensionality of the dataset.
*/
- memset(&ctx, 0, sizeof(ctx));
+ HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = indentlevel;
ctx.need_prefix = 1;
ctx.ndims = H5Sget_simple_extent_ndims(f_space);
@@ -757,13 +757,13 @@ h5tools_dump_simple_dset(FILE *stream, const h5dump_t *info, hid_t dset,
}
assert(sm_nbytes == (hsize_t)((size_t)sm_nbytes)); /*check for overflow*/
- sm_buf = malloc((size_t)sm_nbytes);
+ sm_buf = HDmalloc((size_t)sm_nbytes);
sm_nelmts = sm_nbytes / p_type_nbytes;
sm_space = H5Screate_simple(1, &sm_nelmts, NULL);
/* The stripmine loop */
- memset(hs_offset, 0, sizeof hs_offset);
- memset(zero, 0, sizeof zero);
+ HDmemset(hs_offset, 0, sizeof hs_offset);
+ HDmemset(zero, 0, sizeof zero);
for (elmtno = 0; elmtno < p_nelmts; elmtno += hs_nelmts) {
/* Calculate the hyperslab size */
@@ -788,7 +788,7 @@ h5tools_dump_simple_dset(FILE *stream, const h5dump_t *info, hid_t dset,
if (H5Dread(dset, p_type, sm_space, f_space, H5P_DEFAULT, sm_buf) < 0) {
H5Sclose(f_space);
H5Sclose(sm_space);
- free(sm_buf);
+ HDfree(sm_buf);
return FAIL;
}
@@ -818,14 +818,14 @@ h5tools_dump_simple_dset(FILE *stream, const h5dump_t *info, hid_t dset,
/* Terminate the output */
if (ctx.cur_column) {
- fputs(OPT(info->line_suf, ""), stream);
- putc('\n', stream);
- fputs(OPT(info->line_sep, ""), stream);
+ HDfputs(OPT(info->line_suf, ""), stream);
+ HDputc('\n', stream);
+ HDfputs(OPT(info->line_sep, ""), stream);
}
H5Sclose(sm_space);
H5Sclose(f_space);
- free(sm_buf);
+ HDfree(sm_buf);
return SUCCEED;
}
@@ -859,7 +859,7 @@ h5tools_dump_simple_mem(FILE *stream, const h5dump_t *info, hid_t obj_id,
* great and the dimensionality of the items selected for printing must
* match the dimensionality of the dataset.
*/
- memset(&ctx, 0, sizeof(ctx));
+ HDmemset(&ctx, 0, sizeof(ctx));
ctx.ndims = H5Sget_simple_extent_ndims(space);
if ((size_t)ctx.ndims > NELMTS(ctx.p_min_idx))
@@ -888,9 +888,9 @@ h5tools_dump_simple_mem(FILE *stream, const h5dump_t *info, hid_t obj_id,
/* Terminate the output */
if (ctx.cur_column) {
- fputs(OPT(info->line_suf, ""), stream);
- putc('\n', stream);
- fputs(OPT(info->line_sep, ""), stream);
+ HDfputs(OPT(info->line_suf, ""), stream);
+ HDputc('\n', stream);
+ HDfputs(OPT(info->line_sep, ""), stream);
}
return SUCCEED;
@@ -989,8 +989,8 @@ h5tools_fixtype(hid_t f_type)
*/
nmembs = H5Tget_nmembers(f_type);
assert(nmembs > 0);
- memb = calloc((size_t)nmembs, sizeof(hid_t));
- name = calloc((size_t)nmembs, sizeof(char *));
+ memb = HDcalloc((size_t)nmembs, sizeof(hid_t));
+ name = HDcalloc((size_t)nmembs, sizeof(char *));
for (i = 0, size = 0; i < nmembs; i++) {
/* Get the member type and fix it */
@@ -1087,18 +1087,18 @@ h5tools_fixtype(hid_t f_type)
done:
/* Clean up temp buffers */
if (memb && name) {
- register int j;
+ int j;
for (j = 0; j < nmembs; j++) {
if (memb[j] >= 0)
H5Tclose(memb[j]);
if (name[j])
- free(name[j]);
+ HDfree(name[j]);
}
- free(memb);
- free(name);
+ HDfree(memb);
+ HDfree(name);
}
return m_type;
@@ -1151,7 +1151,7 @@ h5tools_dump_dset(FILE *stream, const h5dump_t *info, hid_t dset, hid_t _p_type,
stream = stdout;
if (!info) {
- memset(&info_dflt, 0, sizeof info_dflt);
+ HDmemset(&info_dflt, 0, sizeof info_dflt);
info = &info_dflt;
}
@@ -1221,7 +1221,7 @@ h5tools_dump_mem(FILE *stream, const h5dump_t *info, hid_t obj_id, hid_t type,
stream = stdout;
if (!info) {
- memset(&info_dflt, 0, sizeof(info_dflt));
+ HDmemset(&info_dflt, 0, sizeof(info_dflt));
info = &info_dflt;
}
diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h
index 6a6f859..b4e23d6 100644
--- a/tools/lib/h5tools.h
+++ b/tools/lib/h5tools.h
@@ -404,7 +404,7 @@ typedef struct h5tools_context_t {
/* a structure to hold the subsetting particulars for a dataset */
struct subset_t {
- hsize_t *start;
+ hssize_t *start;
hsize_t *stride;
hsize_t *count;
hsize_t *block;
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c
index e594ebd..3922640 100644
--- a/tools/lib/h5tools_str.c
+++ b/tools/lib/h5tools_str.c
@@ -54,8 +54,8 @@ void
h5tools_str_close(h5tools_str_t *str)
{
if (str && str->nalloc) {
- free(str->s);
- memset(str, 0, sizeof(h5tools_str_t));
+ HDfree(str->s);
+ HDmemset(str, 0, sizeof(h5tools_str_t));
}
}
@@ -109,7 +109,7 @@ h5tools_str_append(h5tools_str_t *str/*in,out*/, const char *fmt, ...)
/* Make sure we have some memory into which to print */
if (!str->s || str->nalloc <= 0) {
str->nalloc = STR_INIT_LEN;
- str->s = malloc(str->nalloc);
+ str->s = HDmalloc(str->nalloc);
assert(str->s);
str->s[0] = '\0';
str->len = 0;
@@ -127,7 +127,7 @@ h5tools_str_append(h5tools_str_t *str/*in,out*/, const char *fmt, ...)
/* Try again with twice as much space */
str->nalloc *= 2;
- str->s = realloc(str->s, str->nalloc);
+ str->s = HDrealloc(str->s, str->nalloc);
assert(str->s);
}
@@ -158,7 +158,7 @@ h5tools_str_reset(h5tools_str_t *str/*in,out*/)
{
if (!str->s || str->nalloc <= 0) {
str->nalloc = STR_INIT_LEN;
- str->s = malloc(str->nalloc);
+ str->s = HDmalloc(str->nalloc);
assert(str->s);
}
@@ -220,20 +220,20 @@ h5tools_str_fmt(h5tools_str_t *str/*in,out*/, size_t start, const char *fmt)
char _temp[1024], *temp = _temp;
/* If the format string is simply "%s" then don't bother doing anything */
- if (!strcmp(fmt, "%s"))
+ if (!HDstrcmp(fmt, "%s"))
return str->s;
/*
* Save the input value if there is a `%' anywhere in FMT. Otherwise
* don't bother because we don't need a temporary copy.
*/
- if (strchr(fmt, '%')) {
+ if (HDstrchr(fmt, '%')) {
if (str->len - start + 1 > sizeof(_temp)) {
- temp = malloc(str->len-start + 1);
+ temp = HDmalloc(str->len-start + 1);
assert(temp);
}
- strcpy(temp, str->s + start);
+ HDstrcpy(temp, str->s + start);
}
/* Reset the output string and append a formatted version */
@@ -242,7 +242,7 @@ h5tools_str_fmt(h5tools_str_t *str/*in,out*/, size_t start, const char *fmt)
/* Free the temp buffer if we allocated one */
if (temp != _temp)
- free(temp);
+ HDfree(temp);
return str->s;
}
@@ -347,7 +347,7 @@ h5tools_str_dump_region(h5tools_str_t *str, hid_t region, const h5dump_t *info)
alloc_size = nblocks * ndims * 2 * sizeof(ptdata[0]);
assert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/
- ptdata = malloc((size_t)alloc_size);
+ ptdata = HDmalloc((size_t)alloc_size);
H5_CHECK_OVERFLOW(nblocks, hssize_t, hsize_t);
H5Sget_select_hyper_blocklist(region, (hsize_t)0, (hsize_t)nblocks, ptdata);
@@ -370,7 +370,7 @@ h5tools_str_dump_region(h5tools_str_t *str, hid_t region, const h5dump_t *info)
h5tools_str_append(str, ")");
}
- free(ptdata);
+ HDfree(ptdata);
}
/* Print point information */
@@ -379,7 +379,7 @@ h5tools_str_dump_region(h5tools_str_t *str, hid_t region, const h5dump_t *info)
alloc_size = npoints * ndims * sizeof(ptdata[0]);
assert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/
- ptdata = malloc((size_t)alloc_size);
+ ptdata = HDmalloc((size_t)alloc_size);
H5_CHECK_OVERFLOW(npoints,hssize_t,hsize_t);
H5Sget_select_elem_pointlist(region, (hsize_t)0, (hsize_t)npoints, ptdata);
@@ -397,7 +397,7 @@ h5tools_str_dump_region(h5tools_str_t *str, hid_t region, const h5dump_t *info)
h5tools_str_append(str, ")");
}
- free(ptdata);
+ HDfree(ptdata);
}
h5tools_str_append(str, "}");
@@ -450,7 +450,7 @@ h5tools_print_char(h5tools_str_t *str, const h5dump_t *info, unsigned char ch)
h5tools_str_append(str, "\\t");
break;
default:
- if (isprint(ch))
+ if (HDisprint(ch))
h5tools_str_append(str, "%c", (char)ch);
else
h5tools_str_append(str, "\\%03o", ch);
@@ -533,14 +533,14 @@ h5tools_str_sprint(h5tools_str_t *str, const h5dump_t *info, hid_t container,
for (i = 0; i < n; i++)
h5tools_str_append(str, OPT(info->fmt_raw, "%02x"), ucp_vp[i]);
} else if (H5Tequal(type, H5T_NATIVE_FLOAT)) {
- memcpy(&tempfloat, vp, sizeof(float));
+ HDmemcpy(&tempfloat, vp, sizeof(float));
h5tools_str_append(str, OPT(info->fmt_float, "%g"), tempfloat);
} else if (H5Tequal(type, H5T_NATIVE_DOUBLE)) {
- memcpy(&tempdouble, vp, sizeof(double));
+ HDmemcpy(&tempdouble, vp, sizeof(double));
h5tools_str_append(str, OPT(info->fmt_double, "%g"), tempdouble);
} else if (info->ascii && (H5Tequal(type, H5T_NATIVE_SCHAR) ||
H5Tequal(type, H5T_NATIVE_UCHAR))) {
- h5tools_print_char(str, info, *ucp_vp);
+ h5tools_print_char(str, info, (unsigned char)*ucp_vp);
} else if (H5T_STRING == H5Tget_class(type)) {
unsigned int i;
@@ -578,7 +578,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5dump_t *info, hid_t container,
}
/* Print the character */
- h5tools_print_char(str, info, ucp_vp[i]);
+ h5tools_print_char(str, info, (unsigned char)ucp_vp[i]);
/* Print the repeat count */
if (info->str_repeat && j > info->str_repeat) {
@@ -600,53 +600,53 @@ h5tools_str_sprint(h5tools_str_t *str, const h5dump_t *info, hid_t container,
/*empty string*/
h5tools_str_append(str, "\"\"");
} else if (H5Tequal(type, H5T_NATIVE_INT)) {
- memcpy(&tempint, vp, sizeof(int));
+ HDmemcpy(&tempint, vp, sizeof(int));
h5tools_str_append(str, OPT(info->fmt_int, "%d"), tempint);
} else if (H5Tequal(type, H5T_NATIVE_UINT)) {
- memcpy(&tempuint, vp, sizeof(unsigned int));
+ HDmemcpy(&tempuint, vp, sizeof(unsigned int));
h5tools_str_append(str, OPT(info->fmt_uint, "%u"), tempuint);
} else if (H5Tequal(type, H5T_NATIVE_SCHAR)) {
h5tools_str_append(str, OPT(info->fmt_schar, "%d"), *cp_vp);
} else if (H5Tequal(type, H5T_NATIVE_UCHAR)) {
h5tools_str_append(str, OPT(info->fmt_uchar, "%u"), *ucp_vp);
} else if (H5Tequal(type, H5T_NATIVE_SHORT)) {
- memcpy(&tempshort, vp, sizeof(short));
+ HDmemcpy(&tempshort, vp, sizeof(short));
h5tools_str_append(str, OPT(info->fmt_short, "%d"), tempshort);
} else if (H5Tequal(type, H5T_NATIVE_USHORT)) {
- memcpy(&tempushort, vp, sizeof(unsigned short));
+ HDmemcpy(&tempushort, vp, sizeof(unsigned short));
h5tools_str_append(str, OPT(info->fmt_ushort, "%u"), tempushort);
} else if (H5Tequal(type, H5T_NATIVE_LONG)) {
- memcpy(&templong, vp, sizeof(long));
+ HDmemcpy(&templong, vp, sizeof(long));
h5tools_str_append(str, OPT(info->fmt_long, "%ld"), templong);
} else if (H5Tequal(type, H5T_NATIVE_ULONG)) {
- memcpy(&tempulong, vp, sizeof(unsigned long));
+ HDmemcpy(&tempulong, vp, sizeof(unsigned long));
h5tools_str_append(str, OPT(info->fmt_ulong, "%lu"), tempulong);
} else if (H5Tequal(type, H5T_NATIVE_LLONG)) {
- memcpy(&templlong, vp, sizeof(long_long));
+ HDmemcpy(&templlong, vp, sizeof(long_long));
h5tools_str_append(str, OPT(info->fmt_llong, fmt_llong), templlong);
} else if (H5Tequal(type, H5T_NATIVE_ULLONG)) {
- memcpy(&tempullong, vp, sizeof(unsigned long_long));
+ HDmemcpy(&tempullong, vp, sizeof(unsigned long_long));
h5tools_str_append(str, OPT(info->fmt_ullong, fmt_ullong), tempullong);
} else if (H5Tequal(type, H5T_NATIVE_HSSIZE)) {
if (sizeof(hssize_t) == sizeof(int)) {
- memcpy(&tempint, vp, sizeof(int));
+ HDmemcpy(&tempint, vp, sizeof(int));
h5tools_str_append(str, OPT(info->fmt_int, "%d"), tempint);
} else if (sizeof(hssize_t) == sizeof(long)) {
- memcpy(&templong, vp, sizeof(long));
+ HDmemcpy(&templong, vp, sizeof(long));
h5tools_str_append(str, OPT(info->fmt_long, "%ld"), templong);
} else {
- memcpy(&templlong, vp, sizeof(long_long));
+ HDmemcpy(&templlong, vp, sizeof(long_long));
h5tools_str_append(str, OPT(info->fmt_llong, fmt_llong), templlong);
}
} else if (H5Tequal(type, H5T_NATIVE_HSIZE)) {
if (sizeof(hsize_t) == sizeof(int)) {
- memcpy(&tempuint, vp, sizeof(unsigned int));
+ HDmemcpy(&tempuint, vp, sizeof(unsigned int));
h5tools_str_append(str, OPT(info->fmt_uint, "%u"), tempuint);
} else if (sizeof(hsize_t) == sizeof(long)) {
- memcpy(&tempulong, vp, sizeof(long));
+ HDmemcpy(&tempulong, vp, sizeof(long));
h5tools_str_append(str, OPT(info->fmt_ulong, "%lu"), tempulong);
} else {
- memcpy(&tempullong, vp, sizeof(unsigned long_long));
+ HDmemcpy(&tempullong, vp, sizeof(unsigned long_long));
h5tools_str_append(str, OPT(info->fmt_ullong, fmt_ullong), tempullong);
}
} else if (H5Tget_class(type) == H5T_COMPOUND) {
@@ -677,7 +677,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5dump_t *info, hid_t container,
/* The name */
name = H5Tget_member_name(type, j);
h5tools_str_append(str, OPT(info->cmpd_name, ""), name);
- free(name);
+ HDfree(name);
/* The value */
offset = H5Tget_member_offset(type, j);
@@ -920,50 +920,50 @@ h5tools_escape(char *s/*in,out*/, size_t size, int escape_spaces)
for (i = 0; i < n; i++) {
switch (s[i]) {
- case '"':
- escape = "\\\"";
- break;
- case '\\':
- escape = "\\\\";
- break;
- case '\b':
- escape = "\\b";
- break;
- case '\f':
- escape = "\\f";
- break;
- case '\n':
- escape = "\\n";
- break;
- case '\r':
- escape = "\\r";
- break;
- case '\t':
- escape = "\\t";
- break;
- case ' ':
- escape = escape_spaces ? "\\ " : NULL;
- break;
- default:
- if (!isprint((int)*s)) {
- sprintf(octal, "\\%03o", (unsigned char)s[i]);
- escape = octal;
- } else {
- escape = NULL;
- }
-
- break;
+ case '"':
+ escape = "\\\"";
+ break;
+ case '\\':
+ escape = "\\\\";
+ break;
+ case '\b':
+ escape = "\\b";
+ break;
+ case '\f':
+ escape = "\\f";
+ break;
+ case '\n':
+ escape = "\\n";
+ break;
+ case '\r':
+ escape = "\\r";
+ break;
+ case '\t':
+ escape = "\\t";
+ break;
+ case ' ':
+ escape = escape_spaces ? "\\ " : NULL;
+ break;
+ default:
+ if (!isprint((int)*s)) {
+ sprintf(octal, "\\%03o", (unsigned char)s[i]);
+ escape = octal;
+ } else {
+ escape = NULL;
+ }
+
+ break;
}
if (escape) {
- size_t esc_size = strlen(escape);
+ size_t esc_size = HDstrlen(escape);
if (n + esc_size + 1 > size)
/*would overflow*/
return NULL;
- memmove(s + i + esc_size, s + i, (n - i) + 1); /*make room*/
- memcpy(s + i, escape, esc_size); /*insert*/
+ HDmemmove(s + i + esc_size, s + i, (n - i) + 1); /*make room*/
+ HDmemcpy(s + i, escape, esc_size); /*insert*/
n += esc_size;
i += esc_size - 1;
}
diff --git a/tools/lib/h5tools_str.h b/tools/lib/h5tools_str.h
index 58b5ba9..b9aba72 100644
--- a/tools/lib/h5tools_str.h
+++ b/tools/lib/h5tools_str.h
@@ -24,7 +24,7 @@ extern char *h5tools_str_prefix(h5tools_str_t *str, const h5dump_t *info,
hsize_t elmtno, int ndims, hsize_t min_idx[],
hsize_t max_idx[]);
extern int h5tools_str_dump_region(h5tools_str_t *, hid_t, const h5dump_t *);
-extern void h5tools_print_char(h5tools_str_t *, const h5dump_t *, unsigned char);
+extern void h5tools_print_char(h5tools_str_t *str, const h5dump_t *info, unsigned char ch);
extern char *h5tools_str_sprint(h5tools_str_t *str, const h5dump_t *info,
hid_t container, hid_t type, void *vp,
h5tools_context_t *ctx);
diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c
index a6050ca..9f5fa0a 100644
--- a/tools/lib/h5tools_utils.c
+++ b/tools/lib/h5tools_utils.c
@@ -52,13 +52,13 @@ error_msg(const char *progname, const char *fmt, ...)
va_list ap;
va_start(ap, fmt);
- fflush(stdout);
+ HDfflush(stdout);
#ifdef WIN32
- fprintf(stdout, "%s error: ", progname);
- vfprintf(stdout, fmt, ap);
+ HDfprintf(stdout, "%s error: ", progname);
+ HDvfprintf(stdout, fmt, ap);
#else
- fprintf(stderr, "%s error: ", progname);
- vfprintf(stderr, fmt, ap);
+ HDfprintf(stderr, "%s error: ", progname);
+ HDvfprintf(stderr, fmt, ap);
#endif
va_end(ap);
@@ -86,9 +86,14 @@ warn_msg(const char *progname, const char *fmt, ...)
va_list ap;
va_start(ap, fmt);
- fflush(stdout);
- fprintf(stderr, "%s warning: ", progname);
- vfprintf(stderr, fmt, ap);
+ HDfflush(stdout);
+#ifdef WIN32
+ HDfprintf(stdout, "%s warning: ", progname);
+ HDvfprintf(stdout, fmt, ap);
+#else /* WIN32 */
+ HDfprintf(stderr, "%s warning: ", progname);
+ HDvfprintf(stderr, fmt, ap);
+#endif /* WIN32 */
va_end(ap);
}
@@ -122,7 +127,7 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti
/* check for more flag-like tokens */
if (opt_ind >= argc || argv[opt_ind][0] != '-' || argv[opt_ind][1] == '\0') {
return EOF;
- } else if (strcmp(argv[opt_ind], "--") == 0) {
+ } else if (HDstrcmp(argv[opt_ind], "--") == 0) {
opt_ind++;
return EOF;
}
@@ -131,12 +136,12 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti
if (sp == 1 && argv[opt_ind][0] == '-' && argv[opt_ind][1] == '-') {
/* long command line option */
const char *arg = &argv[opt_ind][2];
- register int i;
+ int i;
for (i = 0; l_opts && l_opts[i].name; i++) {
- size_t len = strlen(l_opts[i].name);
+ size_t len = HDstrlen(l_opts[i].name);
- if (strncmp(arg, l_opts[i].name, len) == 0) {
+ if (HDstrncmp(arg, l_opts[i].name, len) == 0) {
/* we've found a matching long command line flag */
opt_opt = l_opts[i].shortval;
@@ -147,7 +152,7 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti
opt_arg = argv[++opt_ind];
} else if (l_opts[i].has_arg == require_arg) {
if (opt_err)
- fprintf(stderr,
+ HDfprintf(stderr,
"%s: option required for \"--%s\" flag\n",
argv[0], arg);
@@ -156,7 +161,7 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti
} else {
if (arg[len] == '=') {
if (opt_err)
- fprintf(stderr,
+ HDfprintf(stderr,
"%s: no option required for \"%s\" flag\n",
argv[0], arg);
@@ -173,7 +178,7 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti
if (l_opts[i].name == NULL) {
/* exhausted all of the l_opts we have and still didn't match */
if (opt_err)
- fprintf(stderr, "%s: unknown option \"%s\"\n", argv[0], arg);
+ HDfprintf(stderr, "%s: unknown option \"%s\"\n", argv[0], arg);
opt_opt = '?';
}
@@ -188,7 +193,7 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti
if (opt_opt == ':' || (cp = strchr(opts, opt_opt)) == 0) {
if (opt_err)
- fprintf(stderr, "%s: unknown option \"%c\"\n",
+ HDfprintf(stderr, "%s: unknown option \"%c\"\n",
argv[0], opt_opt);
/* if no chars left in this token, move to next token */
@@ -207,7 +212,7 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti
opt_arg = &argv[opt_ind++][sp + 1];
} else if (++opt_ind >= argc) {
if (opt_err)
- fprintf(stderr,
+ HDfprintf(stderr,
"%s: value expected for option \"%c\"\n",
argv[0], opt_opt);
@@ -255,7 +260,7 @@ indentation(int x)
while (x-- > 0)
printf(" ");
} else {
- fprintf(stderr, "error: the indentation exceeds the number of cols.\n");
+ HDfprintf(stderr, "error: the indentation exceeds the number of cols.\n");
exit(1);
}
}
@@ -302,11 +307,11 @@ void
init_table(table_t **tbl)
{
int i;
- table_t *table = malloc(sizeof(table_t));
+ table_t *table = HDmalloc(sizeof(table_t));
table->size = 20;
table->nobjs = 0;
- table->objs = malloc(table->size * sizeof(obj_t));
+ table->objs = HDmalloc(table->size * sizeof(obj_t));
for (i = 0; i < table->size; i++) {
table->objs[i].objno[0] = table->objs[i].objno[1] = 0;
@@ -334,7 +339,7 @@ void
init_prefix(char **prefix, int prefix_len)
{
assert(prefix_len > 0);
- *prefix = calloc((size_t)prefix_len, 1);
+ *prefix = HDcalloc((size_t)prefix_len, 1);
}
@@ -377,7 +382,7 @@ free_table(table_t **table)
int
search_obj(table_t *table, unsigned long *objno)
{
- register int i;
+ int i;
for (i = 0; i < table->nobjs; i++)
if (table->objs[i].objno[0] == *objno && table->objs[i].objno[1] == *(objno + 1))
@@ -409,7 +414,7 @@ find_objs(hid_t group, const char *name, void *op_data)
H5G_stat_t statbuf;
char *tmp;
find_objs_t *info = (find_objs_t*)op_data;
- register int i;
+ int i;
if (info->threshold > 1)
/*will get an infinite loop if greater than 1*/
@@ -417,93 +422,93 @@ find_objs(hid_t group, const char *name, void *op_data)
H5Gget_objinfo(group, name, TRUE, &statbuf);
- tmp = malloc(strlen(info->prefix) + strlen(name) + 2);
- strcpy(tmp, info->prefix);
+ tmp = HDmalloc(HDstrlen(info->prefix) + HDstrlen(name) + 2);
+ HDstrcpy(tmp, info->prefix);
switch (statbuf.type) {
- case H5G_GROUP:
- if ((obj = H5Gopen(group, name)) >= 0) {
- if (info->prefix_len < (int)(strlen(info->prefix) + strlen(name) + 2)) {
- info->prefix_len *= 2;
- info->prefix = realloc(info->prefix,
- info->prefix_len * sizeof(char));
- }
+ case H5G_GROUP:
+ if ((obj = H5Gopen(group, name)) >= 0) {
+ if (info->prefix_len < (int)(HDstrlen(info->prefix) + HDstrlen(name) + 2)) {
+ info->prefix_len *= 2;
+ info->prefix = HDrealloc(info->prefix,
+ info->prefix_len * sizeof(char));
+ }
- strcat(strcat(info->prefix,"/"), name);
+ HDstrcat(HDstrcat(info->prefix,"/"), name);
- if (statbuf.nlink > info->threshold) {
- if (search_obj(info->group_table, statbuf.objno) == FAIL) {
- add_obj(info->group_table, statbuf.objno, info->prefix);
- H5Giterate(obj, ".", NULL, find_objs, (void *)info);
+ if (statbuf.nlink > info->threshold) {
+ if (search_obj(info->group_table, statbuf.objno) == FAIL) {
+ add_obj(info->group_table, statbuf.objno, info->prefix);
+ H5Giterate(obj, ".", NULL, find_objs, (void *)info);
+ }
+ } else {
+ H5Giterate (obj, ".", NULL, find_objs, (void *)info);
}
- } else {
- H5Giterate (obj, ".", NULL, find_objs, (void *)info);
- }
- strcpy(info->prefix, tmp);
- H5Gclose (obj);
- } else {
- info->status = 1;
- }
+ HDstrcpy(info->prefix, tmp);
+ H5Gclose (obj);
+ } else {
+ info->status = 1;
+ }
- break;
+ break;
- case H5G_DATASET:
- strcat(tmp,"/");
- strcat(tmp,name); /* absolute name of the data set */
+ case H5G_DATASET:
+ HDstrcat(tmp,"/");
+ HDstrcat(tmp,name); /* absolute name of the data set */
- if (statbuf.nlink > info->threshold &&
- search_obj(info->dset_table, statbuf.objno) == FAIL)
- add_obj(info->dset_table, statbuf.objno, tmp);
+ if (statbuf.nlink > info->threshold &&
+ search_obj(info->dset_table, statbuf.objno) == FAIL)
+ add_obj(info->dset_table, statbuf.objno, tmp);
- if ((obj = H5Dopen (group, name)) >= 0) {
- type = H5Dget_type(obj);
+ if ((obj = H5Dopen (group, name)) >= 0) {
+ type = H5Dget_type(obj);
- if (H5Tcommitted(type) > 0) {
- H5Gget_objinfo(type, ".", TRUE, &statbuf);
+ if (H5Tcommitted(type) > 0) {
+ H5Gget_objinfo(type, ".", TRUE, &statbuf);
- if (search_obj(info->type_table, statbuf.objno) == FAIL) {
- add_obj(info->type_table, statbuf.objno, tmp);
- info->type_table->objs[info->type_table->nobjs - 1].objflag = 0;
+ if (search_obj(info->type_table, statbuf.objno) == FAIL) {
+ add_obj(info->type_table, statbuf.objno, tmp);
+ info->type_table->objs[info->type_table->nobjs - 1].objflag = 0;
+ }
}
- }
- H5Tclose(type);
- H5Dclose (obj);
- } else {
- info->status = 1;
- }
-
- break;
+ H5Tclose(type);
+ H5Dclose (obj);
+ } else {
+ info->status = 1;
+ }
+
+ break;
- case H5G_TYPE:
- strcat(tmp,"/");
- strcat(tmp,name); /* absolute name of the type */
- i = search_obj(info->type_table, statbuf.objno);
+ case H5G_TYPE:
+ HDstrcat(tmp,"/");
+ HDstrcat(tmp,name); /* absolute name of the type */
+ i = search_obj(info->type_table, statbuf.objno);
- if (i == FAIL) {
- add_obj(info->type_table, statbuf.objno, tmp) ;
+ if (i == FAIL) {
+ add_obj(info->type_table, statbuf.objno, tmp) ;
- /* named data type */
- info->type_table->objs[info->type_table->nobjs-1].recorded = 1;
+ /* named data type */
+ info->type_table->objs[info->type_table->nobjs-1].recorded = 1;
- /* named data type */
- info->type_table->objs[info->type_table->nobjs-1].objflag = 1;
- } else {
- strcpy (info->type_table->objs[i].objname, tmp);
- info->type_table->objs[i].recorded = 1;
+ /* named data type */
+ info->type_table->objs[info->type_table->nobjs-1].objflag = 1;
+ } else {
+ strcpy (info->type_table->objs[i].objname, tmp);
+ info->type_table->objs[i].recorded = 1;
- /* named data type */
- info->type_table->objs[info->type_table->nobjs-1].objflag = 1;
- }
+ /* named data type */
+ info->type_table->objs[info->type_table->nobjs-1].objflag = 1;
+ }
- break;
+ break;
- default:
- break;
+ default:
+ break;
}
- free(tmp);
+ HDfree(tmp);
return SUCCEED;
}
@@ -524,7 +529,7 @@ find_objs(hid_t group, const char *name, void *op_data)
void
dump_table(char* tablename, table_t *table)
{
- register int i;
+ int i;
printf("%s: # of entries = %d\n", tablename,table->nobjs);
@@ -612,7 +617,7 @@ set_tableflag(table_t *table, int idx)
char *
get_objectname(table_t *table, int idx)
{
- return strdup(table->objs[idx].objname);
+ return HDstrdup(table->objs[idx].objname);
}
@@ -633,11 +638,11 @@ get_objectname(table_t *table, int idx)
static void
add_obj(table_t *table, unsigned long *objno, char *objname)
{
- register int i;
+ int i;
if (table->nobjs == table->size) {
table->size *= 2;
- table->objs = realloc(table->objs, table->size * sizeof(obj_t));
+ table->objs = HDrealloc(table->objs, table->size * sizeof(obj_t));
for (i = table->nobjs; i < table->size; i++) {
table->objs[i].objno[0] = table->objs[i].objno[1] = 0;
@@ -650,5 +655,5 @@ add_obj(table_t *table, unsigned long *objno, char *objname)
i = table->nobjs++;
table->objs[i].objno[0] = objno[0];
table->objs[i].objno[1] = objno[1];
- strcpy(table->objs[i].objname, objname);
+ HDstrcpy(table->objs[i].objname, objname);
}