summaryrefslogtreecommitdiffstats
path: root/hl
diff options
context:
space:
mode:
authorAlbert Cheng <acheng@hdfgroup.org>2009-12-25 12:37:55 (GMT)
committerAlbert Cheng <acheng@hdfgroup.org>2009-12-25 12:37:55 (GMT)
commit840e04ab5f5ce7fa5d07a3c9187944c27f9534e9 (patch)
treef7bcc6421a20d20e3a4ec5b029adf0097e8686ed /hl
parent06ce6af638e6eecd9a80c3e4757bb8361b68f889 (diff)
downloadhdf5-840e04ab5f5ce7fa5d07a3c9187944c27f9534e9.zip
hdf5-840e04ab5f5ce7fa5d07a3c9187944c27f9534e9.tar.gz
hdf5-840e04ab5f5ce7fa5d07a3c9187944c27f9534e9.tar.bz2
[svn-r18051] Bug fix: 1192
Description: Some exit code (sometimes return code in Main) to follow the HDF5 standards. Tested: H5committested plus serial test in Jam.
Diffstat (limited to 'hl')
-rw-r--r--hl/tools/gif2h5/decompress.c2
-rw-r--r--hl/tools/gif2h5/gif2hdf.c12
-rw-r--r--hl/tools/gif2h5/gif2mem.c28
-rw-r--r--hl/tools/gif2h5/gifread.c4
-rw-r--r--hl/tools/gif2h5/h52gifgentst.c12
-rw-r--r--hl/tools/gif2h5/h52giftest.sh8
-rw-r--r--hl/tools/gif2h5/hdf2gif.c6
7 files changed, 39 insertions, 33 deletions
diff --git a/hl/tools/gif2h5/decompress.c b/hl/tools/gif2h5/decompress.c
index 435e272..2e44f1c 100644
--- a/hl/tools/gif2h5/decompress.c
+++ b/hl/tools/gif2h5/decompress.c
@@ -222,7 +222,7 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead)
if (!(Image = (BYTE *)malloc((size_t)IWidth*(size_t)IHeight))) {
printf("Out of memory");
- exit(-1);
+ exit(EXIT_FAILURE);
}
BytesPerScanline = IWidth;
diff --git a/hl/tools/gif2h5/gif2hdf.c b/hl/tools/gif2h5/gif2hdf.c
index c7e4ab6..39c71cf 100644
--- a/hl/tools/gif2h5/gif2hdf.c
+++ b/hl/tools/gif2h5/gif2hdf.c
@@ -60,7 +60,7 @@ main(int argv , char *argc[])
printf("Usage: gif2h5 <GIFFILE> <HDFFILE>\n");
fprintf(stdout, " gif2h5 -V \n");
fprintf(stdout, " Print HDF5 library version and exit\n");
- return(-1);
+ exit(EXIT_FAILURE);
}
GIFFileName = argc[1];
@@ -68,7 +68,7 @@ main(int argv , char *argc[])
if (!(fpGif = fopen(GIFFileName,"rb"))) {
printf("Unable to open GIF file for reading.\n");
- exit(-1);
+ exit(EXIT_FAILURE);
}
/* Get the whole file into memory. Mem's much faster than I/O */
@@ -81,12 +81,12 @@ main(int argv , char *argc[])
if (!(MemGif = StartPos = (BYTE *)malloc((size_t)filesize))) {
printf("Out of memory");
- exit (-1);
+ exit(EXIT_FAILURE);
}
if (fread(MemGif,(size_t)filesize,1,fpGif) != 1) {
printf("Corrupted Input File");
- exit(-1);
+ exit(EXIT_FAILURE);
}
fseek(fpGif,0L,0);
@@ -99,7 +99,7 @@ main(int argv , char *argc[])
if (ferror(fpGif)) {
printf("File Stream Error\n\n");
- exit(-1);
+ exit(EXIT_FAILURE);
}
fclose(fpGif);
@@ -157,5 +157,5 @@ main(int argv , char *argc[])
}
- return 0;
+ return EXIT_SUCCESS;
}
diff --git a/hl/tools/gif2h5/gif2mem.c b/hl/tools/gif2h5/gif2mem.c
index 6274b9a..907fb80 100644
--- a/hl/tools/gif2h5/gif2mem.c
+++ b/hl/tools/gif2h5/gif2mem.c
@@ -77,7 +77,7 @@ Gif2Mem(BYTE *MemGif)
/****************************************************/
if (!(gifHead = (GIFHEAD *)malloc(sizeof(GIFHEAD)))) {
printf("Could not allocate memory for gifHead\n");
- exit(-1);
+ exit(EXIT_FAILURE);
}
/*
@@ -107,7 +107,7 @@ Gif2Mem(BYTE *MemGif)
if (ferror(fpGif))
{
fputs("GIFHEAD: Error reading header information!\n", stderr);
- exit(-3);
+ exit(EXIT_FAILURE);
}
#endif /* 0 */
@@ -161,14 +161,14 @@ Gif2Mem(BYTE *MemGif)
if (!(gifImageDesc = (GIFIMAGEDESC **)realloc(gifImageDesc,
sizeof(GIFIMAGEDESC *) * ImageArray))) {
printf("Out of memory!");
- exit(-1);
+ exit(EXIT_FAILURE);
}
if (!(gifGraphicControl = (GIFGRAPHICCONTROL **)realloc(
gifGraphicControl,
sizeof(GIFGRAPHICCONTROL *) * ImageArray))) {
printf("Out of memory!");
- exit(-1);
+ exit(EXIT_FAILURE);
}
for (j = aTemp ; j < ImageArray ; j++) {
@@ -179,7 +179,7 @@ Gif2Mem(BYTE *MemGif)
if(!(gifImageDesc[ImageCount-1] = (GIFIMAGEDESC*)malloc(sizeof(GIFIMAGEDESC)))) {
printf("Out of memory!");
- exit(-1);
+ exit(EXIT_FAILURE);
}
@@ -228,12 +228,12 @@ Gif2Mem(BYTE *MemGif)
if (!(gifPlainText = (GIFPLAINTEXT **)realloc(gifPlainText , sizeof(GIFPLAINTEXT *) * PlainTextArray))) {
printf("Out of memory!");
- exit(-1);
+ exit(EXIT_FAILURE);
}
if(!(gifPlainText[PlainTextCount - 1] = (GIFPLAINTEXT*)malloc(sizeof(GIFPLAINTEXT)))) {
printf("Out of memory!");
- exit(-1);
+ exit(EXIT_FAILURE);
}
if (ReadGifPlainText(gifPlainText[PlainTextCount - 1], &MemGif))
@@ -250,12 +250,12 @@ Gif2Mem(BYTE *MemGif)
if (!(gifComment = (GIFCOMMENT **)realloc(gifComment , sizeof(GIFCOMMENT *) * CommentArray))) {
printf("Out of memory!");
- exit(-1);
+ exit(EXIT_FAILURE);
}
if(!(gifComment[CommentCount - 1] = (GIFCOMMENT *)malloc(sizeof(GIFCOMMENT)))) {
printf("Out of memory!");
- exit(-1);
+ exit(EXIT_FAILURE);
}
@@ -277,12 +277,12 @@ Gif2Mem(BYTE *MemGif)
if (!(gifGraphicControl = (GIFGRAPHICCONTROL **)realloc(gifGraphicControl , sizeof(GIFGRAPHICCONTROL *) * ImageArray))) {
printf("Out of memory!");
- exit(-1);
+ exit(EXIT_FAILURE);
}
if (!(gifImageDesc = (GIFIMAGEDESC **)realloc(gifImageDesc , sizeof(GIFIMAGEDESC *) * ImageArray))) {
printf("Out of memory!");
- exit(-1);
+ exit(EXIT_FAILURE);
}
for (j = aTemp ; j < ImageArray ; j++) {
@@ -293,7 +293,7 @@ Gif2Mem(BYTE *MemGif)
if(!(gifGraphicControl[ImageCount-1] = (GIFGRAPHICCONTROL*)malloc(sizeof(GIFGRAPHICCONTROL)))) {
printf("Out of memory!");
- exit(-1);
+ exit(EXIT_FAILURE);
}
@@ -315,12 +315,12 @@ Gif2Mem(BYTE *MemGif)
if (!(gifApplication = (GIFAPPLICATION **)realloc(gifApplication , sizeof(GIFAPPLICATION *) * ApplicationArray))) {
printf("Out of memory!");
- exit(-1);
+ exit(EXIT_FAILURE);
}
if(!(gifApplication[ApplicationCount - 1] = (GIFAPPLICATION *)malloc(sizeof(GIFAPPLICATION)))) {
printf("Out of memory!");
- exit(-1);
+ exit(EXIT_FAILURE);
}
diff --git a/hl/tools/gif2h5/gifread.c b/hl/tools/gif2h5/gifread.c
index a08564a..2b4c129 100644
--- a/hl/tools/gif2h5/gifread.c
+++ b/hl/tools/gif2h5/gifread.c
@@ -68,7 +68,7 @@ ReadGifHeader(GIFHEAD *GifHead, /* Pointer to GIF header structure */
if (strncmp((const char *)GifHead->HeaderDump , "GIF" , (size_t)3)) {
printf("The file does not appear to be a valid GIF file.\n");
- exit(-1);
+ exit(EXIT_FAILURE);
}
for (i = 0 ; i < 7 ; i++) {
@@ -192,7 +192,7 @@ ReadGifImageDesc(
/*GifImageDesc->GIFImage = ReadDataSubBlocks(FpGif);*/
if (!(GifImageDesc->GIFImage = (BYTE *)malloc((GifImageDesc->ImageWidth) * (GifImageDesc->ImageHeight)))) {
printf("Out of memory");
- exit(-1);
+ exit(EXIT_FAILURE);
}
diff --git a/hl/tools/gif2h5/h52gifgentst.c b/hl/tools/gif2h5/h52gifgentst.c
index eb83335..ef38c3b 100644
--- a/hl/tools/gif2h5/h52gifgentst.c
+++ b/hl/tools/gif2h5/h52gifgentst.c
@@ -58,7 +58,7 @@ int main(void)
/* create a file */
if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT))<0)
- return 1;
+ return EXIT_FAILURE;
/* create an image */
space = WIDTH*HEIGHT / PAL_ENTRIES;
@@ -75,7 +75,7 @@ int main(void)
/* make the image */
if (H5IMmake_image_8bit( fid, IMAGE1_NAME, width, height, buf )<0)
- return 1;
+ return EXIT_FAILURE;
/*-------------------------------------------------------------------------
* define a palette, blue to red tones
@@ -90,15 +90,15 @@ int main(void)
/* make a palette */
if (H5IMmake_palette( fid, PAL_NAME, pal_dims, pal )<0)
- return 1;
+ return EXIT_FAILURE;
/* attach the palette to the image */
if (H5IMlink_palette( fid, IMAGE1_NAME, PAL_NAME )<0)
- return 1;
+ return EXIT_FAILURE;
if(H5Fclose(fid)<0)
- return 1;
+ return EXIT_FAILURE;
- return 0;
+ return EXIT_SUCCESS;
}
diff --git a/hl/tools/gif2h5/h52giftest.sh b/hl/tools/gif2h5/h52giftest.sh
index 7874bca..186b369 100644
--- a/hl/tools/gif2h5/h52giftest.sh
+++ b/hl/tools/gif2h5/h52giftest.sh
@@ -64,4 +64,10 @@ TESTING "./gif2h5 image1.gif image1.h5"
TOOLTEST2 $TESTFILE2 image1.h5
-exit $errors
+if test $errors -eq 0 ; then
+ echo "All h52gif tests passed."
+ exit 0
+else
+ echo "h52gif tests failed with $errors errors."
+ exit 1
+fi
diff --git a/hl/tools/gif2h5/hdf2gif.c b/hl/tools/gif2h5/hdf2gif.c
index 9c252e1..cc8e864 100644
--- a/hl/tools/gif2h5/hdf2gif.c
+++ b/hl/tools/gif2h5/hdf2gif.c
@@ -82,7 +82,7 @@ int main(int argc , char **argv)
{
/* they didn't supply at least one image -- bail */
usage();
- return 1;
+ return EXIT_FAILURE;
}
HDFName = argv[1];
@@ -313,7 +313,7 @@ int main(int argc , char **argv)
if (image_name != NULL)
free(image_name);
- return 0;
+ return EXIT_SUCCESS;
out:
@@ -323,5 +323,5 @@ out:
if (image_name != NULL)
free(image_name);
- return 1;
+ return EXIT_FAILURE;
}