summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2002-06-19 16:08:27 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2002-06-19 16:08:27 (GMT)
commit8bb096b6977a90df82ca3d32287aa2a7abeb5510 (patch)
treec63e215da154603f99afff0b9d9b31149a9c2e5c /tools
parentc0c4219b5084ebcbcfe56bb807ece294f2f4f4aa (diff)
downloadhdf5-8bb096b6977a90df82ca3d32287aa2a7abeb5510.zip
hdf5-8bb096b6977a90df82ca3d32287aa2a7abeb5510.tar.gz
hdf5-8bb096b6977a90df82ca3d32287aa2a7abeb5510.tar.bz2
[svn-r5675] Purpose:
Code cleanup Description: Removed more compiler warnings, etc. Platforms tested: Linux 2.2.x (eirene) w/parallel
Diffstat (limited to 'tools')
-rw-r--r--tools/gifconv/gif.h6
-rw-r--r--tools/gifconv/gif2hdf.c4
-rw-r--r--tools/gifconv/gif2mem.c1
-rw-r--r--tools/gifconv/gifread.c12
-rw-r--r--tools/gifconv/hdf2gif.c17
-rw-r--r--tools/gifconv/hdfgifwr.c29
-rw-r--r--tools/gifconv/writehdf.c3
-rw-r--r--tools/h5dump/h5dumptst.c4
-rw-r--r--tools/lib/h5tools.c2
9 files changed, 37 insertions, 41 deletions
diff --git a/tools/gifconv/gif.h b/tools/gifconv/gif.h
index 9e4f9e8..a3e26b4 100644
--- a/tools/gifconv/gif.h
+++ b/tools/gifconv/gif.h
@@ -22,6 +22,7 @@
/* typedef H5T_NATIVE_UINT8 BYTE; */
typedef unsigned char BYTE;
+typedef BYTE byte;
/* typedef H5T_NATIVE_UINT16 WORD; */
typedef unsigned long WORD;
@@ -174,5 +175,10 @@ BYTE GetByte(BYTE *);
WORD GetWord(BYTE *);
void cleanup(BYTE*);
+
+/* HDFGIFWR.C */
+extern int
+hdfWriteGIF(FILE *fp, byte *pic, int w, int h, byte *pc2ncmap, int BitsPerPixel);
+
#endif /* GIF_H */
diff --git a/tools/gifconv/gif2hdf.c b/tools/gifconv/gif2hdf.c
index e3942b7..d844903 100644
--- a/tools/gifconv/gif2hdf.c
+++ b/tools/gifconv/gif2hdf.c
@@ -28,7 +28,7 @@ main(int argv , char *argc[])
/* replacing int32 with long */
long i,ImageCount;
- long filesize;
+ size_t filesize;
BYTE *MemGif;
BYTE *StartPos;
@@ -69,7 +69,7 @@ main(int argv , char *argc[])
/* Get the whole file into memory. Mem's much faster than I/O */
fseek(fpGif, 0L , 2);
- filesize = ftell(fpGif);
+ filesize = (size_t)ftell(fpGif);
fseek(fpGif, 0L , 0);
if (filesize == 0) printf("File Size Zero");
if (!(MemGif = StartPos = (BYTE *)malloc(filesize))) {
diff --git a/tools/gifconv/gif2mem.c b/tools/gifconv/gif2mem.c
index 70357e5..e2bdf6d 100644
--- a/tools/gifconv/gif2mem.c
+++ b/tools/gifconv/gif2mem.c
@@ -39,7 +39,6 @@
/* #include "hdf.h" */
#define VERSION "1.00"
-extern int EndianOrder;
GIFTOMEM
Gif2Mem(BYTE *MemGif)
diff --git a/tools/gifconv/gifread.c b/tools/gifconv/gifread.c
index c7b7b96..aea7fc3 100644
--- a/tools/gifconv/gifread.c
+++ b/tools/gifconv/gifread.c
@@ -6,8 +6,6 @@ static BYTE *
ReadDataSubBlocks(BYTE **MemGif2 , WORD *DSize);
int EndianOrder;
-int i;
-
WORD
GetWord (MemGif)
@@ -49,7 +47,7 @@ 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;
@@ -213,7 +211,7 @@ 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)++;
@@ -237,6 +235,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)++;
}
@@ -273,6 +273,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)++;
}
@@ -336,7 +338,7 @@ WORD *DSize;
{
BYTE *ptr1; /* Pointer used to "walk the heap" */
BYTE *ptr2; /* Pointer used to mark the top of the heap */
- BYTE dataSize; /* Size of the current data sub-block being read */
+ size_t dataSize; /* Size of the current data sub-block being read */
WORD bufSize; /* Total size of the Plain Text data buffer */
int tempcount = 0;
diff --git a/tools/gifconv/hdf2gif.c b/tools/gifconv/hdf2gif.c
index 6443627..56be138 100644
--- a/tools/gifconv/hdf2gif.c
+++ b/tools/gifconv/hdf2gif.c
@@ -29,12 +29,9 @@
#define MAX_FILE_LEN 256
#define MAX_NUMBER_IMAGES 50
-extern 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 EndianOrder;
-void PutByte(BYTE b , FILE *fpGif)
+static void PutByte(BYTE b , FILE *fpGif)
{
if (fputc(b , fpGif) == EOF) {
printf("File Writing Error, cannot continue");
@@ -43,7 +40,7 @@ void PutByte(BYTE b , FILE *fpGif)
}
-void putword(int w, FILE *fp)
+static void putword(int w, FILE *fp)
{
/* writes a 16-bit integer in GIF order (LSB first) */
@@ -86,7 +83,7 @@ int main(int argc , char **argv) {
int w,i;
int numcols = 256;
int time_out = 0; /* time between two images in the animation */
- int n_images , index;
+ int n_images , indx;
BYTE pc2nc[256] , r1[256] , g1[256] , b1[256];
@@ -182,7 +179,7 @@ int main(int argc , char **argv) {
n_images = number_of_images;
Background = 0;
- for (index = 0 ; index < n_images ; index++) {
+ for (indx = 0 ; indx < n_images ; indx++) {
/* try to read the image and the palette */
/* Lots of funky stuff to support multiple images has been taken off.
@@ -193,7 +190,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[indx] , pal_name_arr[indx]) < 0) {
fprintf(stderr , "Unable to read HDF file\n");
return -1;
}
@@ -260,7 +257,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 (indx == 0) {
/* Write out the GIF header and logical screen descriptor */
if (n_images > 1) {
fwrite("GIF89a", 1, 6, fpGif); /* the GIF magic number */
@@ -332,7 +329,7 @@ int main(int argc , char **argv) {
fputc (InitCodeSize , fpGif);
- hdfWriteGIF(fpGif , Image , 0 , dim_sizes[0] , dim_sizes[1] , r1, g1 , b1 , pc2nc , 256 , 8 , BitsPerPixel);
+ hdfWriteGIF(fpGif , Image , (int)dim_sizes[0] , (int)dim_sizes[1] , pc2nc , BitsPerPixel);
fputc(0x00 , fpGif);
free (Image);
}
diff --git a/tools/gifconv/hdfgifwr.c b/tools/gifconv/hdfgifwr.c
index 3c15477..261487a 100644
--- a/tools/gifconv/hdfgifwr.c
+++ b/tools/gifconv/hdfgifwr.c
@@ -47,12 +47,8 @@
*****************************************************************/
-#include <stdio.h>
#include "gif.h"
-#include <stdlib.h>
-#include <string.h>
-typedef BYTE byte;
typedef long int count_int;
/* indicies into conv24MB */
@@ -100,13 +96,8 @@ static void xvbzero(char *s, size_t len)
}
/*************************************************************/
-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 w, int h, byte *pc2ncmap, int BitsPerPixel)
{
int InitCodeSize;
int i;
@@ -368,7 +359,7 @@ int code;
cur_bits += n_bits;
while( cur_bits >= 8 ) {
- char_out( (unsigned int) (cur_accum & 0xff) );
+ char_out( (int) (cur_accum & 0xff) );
cur_accum >>= 8;
cur_bits -= 8;
}
@@ -396,7 +387,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)(cur_accum & 0xff) );
cur_accum >>= 8;
cur_bits -= 8;
}
@@ -427,14 +418,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 */
+register count_int hashsize;
{
- register count_int *htab_p = htab+hsize;
+ register count_int *htab_p = htab+hashsize;
register long i;
register 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;
@@ -469,7 +460,7 @@ register count_int hsize;
/*
* Number of characters so far in this 'packet'
*/
-static int a_count;
+static size_t a_count;
/*
* Set up the 'byte output' routine
@@ -502,7 +493,7 @@ int c;
static void flush_char()
{
if( a_count > 0 ) {
- fputc( a_count, g_outfile );
+ fputc( (int)a_count, g_outfile );
fwrite( accum, 1, a_count, g_outfile );
a_count = 0;
}
diff --git a/tools/gifconv/writehdf.c b/tools/gifconv/writehdf.c
index 1eb49fd..9590f79 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 */
diff --git a/tools/h5dump/h5dumptst.c b/tools/h5dump/h5dumptst.c
index 512c645..9687140 100644
--- a/tools/h5dump/h5dumptst.c
+++ b/tools/h5dump/h5dumptst.c
@@ -1036,7 +1036,7 @@ static void test_many(void) {
dset1[j].a[idx[3]][idx[2]][idx[1]][idx[0]] = i0+j;
dset1[j].b[idx[3]][idx[2]][idx[1]][idx[0]] = (double)(i0+j);
-#if WIN32
+#ifdef WIN32
dset1[j].c[idx[3]][idx[2]][idx[1]][idx[0]] = (double)(i0+j+(signed __int64)sdim);
#else
dset1[j].c[idx[3]][idx[2]][idx[1]][idx[0]] = (double)(i0+j+sdim);
@@ -2785,7 +2785,7 @@ void test_multi(void)
HDmemset(memb_map, 0, sizeof memb_map);
HDmemset(memb_fapl, 0, sizeof memb_fapl);
- HDmemset((void *)(&memb_name[0]), 0, sizeof memb_name);
+ HDmemset(memb_name, 0, sizeof memb_name);
HDmemset(memb_addr, 0, sizeof memb_addr);
assert(HDstrlen(multi_letters) == H5FD_MEM_NTYPES);
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c
index a0fc81c..2dc2f75 100644
--- a/tools/lib/h5tools.c
+++ b/tools/lib/h5tools.c
@@ -198,7 +198,7 @@ h5tools_fopen(const char *fname, const char *driver, char *drivername,
#define NUM_DRIVERS (sizeof(drivers_list) / sizeof(struct d_list))
static int initialized = 0;
- register int drivernum;
+ size_t drivernum;
hid_t fid = FAIL;
#ifndef VERSION12
hid_t fapl = H5P_DEFAULT;