diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2002-06-19 16:08:27 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2002-06-19 16:08:27 (GMT) |
commit | 8bb096b6977a90df82ca3d32287aa2a7abeb5510 (patch) | |
tree | c63e215da154603f99afff0b9d9b31149a9c2e5c /hl/tools/gif2h5 | |
parent | c0c4219b5084ebcbcfe56bb807ece294f2f4f4aa (diff) | |
download | hdf5-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 'hl/tools/gif2h5')
-rw-r--r-- | hl/tools/gif2h5/gif.h | 6 | ||||
-rw-r--r-- | hl/tools/gif2h5/gif2hdf.c | 4 | ||||
-rw-r--r-- | hl/tools/gif2h5/gif2mem.c | 1 | ||||
-rw-r--r-- | hl/tools/gif2h5/gifread.c | 12 | ||||
-rw-r--r-- | hl/tools/gif2h5/hdf2gif.c | 17 | ||||
-rw-r--r-- | hl/tools/gif2h5/hdfgifwr.c | 29 | ||||
-rw-r--r-- | hl/tools/gif2h5/writehdf.c | 3 |
7 files changed, 34 insertions, 38 deletions
diff --git a/hl/tools/gif2h5/gif.h b/hl/tools/gif2h5/gif.h index 9e4f9e8..a3e26b4 100644 --- a/hl/tools/gif2h5/gif.h +++ b/hl/tools/gif2h5/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/hl/tools/gif2h5/gif2hdf.c b/hl/tools/gif2h5/gif2hdf.c index e3942b7..d844903 100644 --- a/hl/tools/gif2h5/gif2hdf.c +++ b/hl/tools/gif2h5/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/hl/tools/gif2h5/gif2mem.c b/hl/tools/gif2h5/gif2mem.c index 70357e5..e2bdf6d 100644 --- a/hl/tools/gif2h5/gif2mem.c +++ b/hl/tools/gif2h5/gif2mem.c @@ -39,7 +39,6 @@ /* #include "hdf.h" */ #define VERSION "1.00" -extern int EndianOrder; GIFTOMEM Gif2Mem(BYTE *MemGif) diff --git a/hl/tools/gif2h5/gifread.c b/hl/tools/gif2h5/gifread.c index c7b7b96..aea7fc3 100644 --- a/hl/tools/gif2h5/gifread.c +++ b/hl/tools/gif2h5/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/hl/tools/gif2h5/hdf2gif.c b/hl/tools/gif2h5/hdf2gif.c index 6443627..56be138 100644 --- a/hl/tools/gif2h5/hdf2gif.c +++ b/hl/tools/gif2h5/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/hl/tools/gif2h5/hdfgifwr.c b/hl/tools/gif2h5/hdfgifwr.c index 3c15477..261487a 100644 --- a/hl/tools/gif2h5/hdfgifwr.c +++ b/hl/tools/gif2h5/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/hl/tools/gif2h5/writehdf.c b/hl/tools/gif2h5/writehdf.c index 1eb49fd..9590f79 100644 --- a/hl/tools/gif2h5/writehdf.c +++ b/hl/tools/gif2h5/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 */ |