summaryrefslogtreecommitdiffstats
path: root/hl/tools/gif2h5/gif2hdf.c
diff options
context:
space:
mode:
Diffstat (limited to 'hl/tools/gif2h5/gif2hdf.c')
-rw-r--r--hl/tools/gif2h5/gif2hdf.c46
1 files changed, 18 insertions, 28 deletions
diff --git a/hl/tools/gif2h5/gif2hdf.c b/hl/tools/gif2h5/gif2hdf.c
index 051ff56..939844c 100644
--- a/hl/tools/gif2h5/gif2hdf.c
+++ b/hl/tools/gif2h5/gif2hdf.c
@@ -18,11 +18,10 @@
#include "h5tools.h"
#include "h5tools_utils.h"
-
int
-main(int argv , char *argc[])
+main(int argv, char *argc[])
{
- GIFTOMEM GifMemoryStruct;
+ GIFTOMEM GifMemoryStruct;
GIFIMAGEDESC gifImageDesc;
FILE *fpGif;
@@ -51,11 +50,9 @@ main(int argv , char *argc[])
/* Initialize h5tools lib */
h5tools_init();
- if ( argc[1] && (strcmp("-V",argc[1])==0) )
- {
+ if (argc[1] && (strcmp("-V", argc[1]) == 0)) {
print_version("gif2h5");
exit(EXIT_SUCCESS);
-
}
if (argv < 3) {
@@ -68,15 +65,15 @@ main(int argv , char *argc[])
GIFFileName = argc[1];
HDFFileName = argc[2];
- if (!(fpGif = fopen(GIFFileName,"rb"))) {
+ if (!(fpGif = fopen(GIFFileName, "rb"))) {
printf("Unable to open GIF file for reading.\n");
exit(EXIT_FAILURE);
}
/* Get the whole file into memory. Mem's much faster than I/O */
- fseek(fpGif, 0L , 2);
+ fseek(fpGif, 0L, 2);
filesize = ftell(fpGif);
- fseek(fpGif, 0L , 0);
+ fseek(fpGif, 0L, 0);
if (filesize == 0)
printf("File Size Zero");
@@ -86,12 +83,12 @@ main(int argv , char *argc[])
exit(EXIT_FAILURE);
}
- if (fread(MemGif,(size_t)filesize,1,fpGif) != 1) {
+ if (fread(MemGif, (size_t)filesize, 1, fpGif) != 1) {
printf("Corrupted Input File");
exit(EXIT_FAILURE);
}
- fseek(fpGif,0L,0);
+ fseek(fpGif, 0L, 0);
/*
* Call Gif2Mem and break the whole file into parts. Gif2Mem also calls
@@ -100,8 +97,8 @@ main(int argv , char *argc[])
Gif2Mem(MemGif, &GifMemoryStruct);
if (ferror(fpGif)) {
- printf("File Stream Error\n\n");
- exit(EXIT_FAILURE);
+ printf("File Stream Error\n\n");
+ exit(EXIT_FAILURE);
}
fclose(fpGif);
@@ -110,54 +107,47 @@ main(int argv , char *argc[])
* Call WriteHDF from here. Go ahead and change WriteHDF to write whatever
* format you want
*/
- if (WriteHDF(GifMemoryStruct , HDFFileName))
+ if (WriteHDF(GifMemoryStruct, HDFFileName))
printf("HDF Write Error\n\n");
/* Free all buffers */
/* replacing int32 with long */
ImageCount = (long)((GifMemoryStruct.GifHeader)->ImageCount);
- for(i = 0; i < ImageCount ; i++) {
+ for (i = 0; i < ImageCount; i++) {
gifImageDesc = *(GifMemoryStruct.GifImageDesc[i]);
if (gifImageDesc.Image != NULL)
free(gifImageDesc.Image);
- if (GifMemoryStruct.GifImageDesc[i] != NULL)
- {
+ if (GifMemoryStruct.GifImageDesc[i] != NULL) {
free(GifMemoryStruct.GifImageDesc[i]);
GifMemoryStruct.GifImageDesc[i] = NULL;
}
- if (GifMemoryStruct.GifGraphicControlExtension[i] != NULL)
- {
+ if (GifMemoryStruct.GifGraphicControlExtension[i] != NULL) {
free(GifMemoryStruct.GifGraphicControlExtension[i]);
GifMemoryStruct.GifGraphicControlExtension[i] = NULL;
}
}
free(StartPos);
- if (GifMemoryStruct.GifHeader != NULL)
- {
+ if (GifMemoryStruct.GifHeader != NULL) {
free(GifMemoryStruct.GifHeader);
GifMemoryStruct.GifHeader = NULL;
}
- if (GifMemoryStruct.GifApplicationExtension != NULL)
- {
+ if (GifMemoryStruct.GifApplicationExtension != NULL) {
free(GifMemoryStruct.GifApplicationExtension);
GifMemoryStruct.GifApplicationExtension = NULL;
}
- if (GifMemoryStruct.GifImageDesc != NULL)
- {
+ if (GifMemoryStruct.GifImageDesc != NULL) {
free(GifMemoryStruct.GifImageDesc);
GifMemoryStruct.GifImageDesc = NULL;
}
- if (GifMemoryStruct.GifGraphicControlExtension != NULL)
- {
+ if (GifMemoryStruct.GifGraphicControlExtension != NULL) {
free(GifMemoryStruct.GifGraphicControlExtension);
GifMemoryStruct.GifGraphicControlExtension = NULL;
}
-
return EXIT_SUCCESS;
}