mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-01-30 15:32:37 +08:00
[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.
This commit is contained in:
parent
06ce6af638
commit
840e04ab5f
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user