diff options
-rw-r--r-- | MANIFEST | 2 | ||||
-rw-r--r-- | hl/tools/gif2h5/h52giftest.sh | 24 | ||||
-rw-r--r-- | hl/tools/gif2h5/writehdf.c | 14 | ||||
-rw-r--r-- | hl/tools/testfiles/image1.gif | bin | 0 -> 9736 bytes |
4 files changed, 32 insertions, 8 deletions
@@ -1994,7 +1994,7 @@ ./hl/tools/gif2h5/h52gifgentst.c ./hl/tools/gif2h5/h52giftest.sh ./hl/tools/testfiles/h52giftst.h5 - +./hl/tools/testfiles/image1.gif # windows ./windows/COPYING diff --git a/hl/tools/gif2h5/h52giftest.sh b/hl/tools/gif2h5/h52giftest.sh index fa439aa..1300f03 100644 --- a/hl/tools/gif2h5/h52giftest.sh +++ b/hl/tools/gif2h5/h52giftest.sh @@ -15,7 +15,8 @@ # # HDF Utilities Test script -TESTFILE="$srcdir/../testfiles/h52giftst.h5" +TESTFILE1="$srcdir/../testfiles/h52giftst.h5" +TESTFILE2="$srcdir/../testfiles/image1.gif" # initialize errors variable errors=0 @@ -25,7 +26,7 @@ TESTING() { echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012' } -TOOLTEST() +TOOLTEST1() { err=0 $RUNSERIAL ./h52gif $* @@ -38,10 +39,25 @@ else fi } +TOOLTEST2() +{ +err=0 +$RUNSERIAL ./gif2h5 $* + +if [ $err -eq 1 ]; then +errors="` expr $errors + 1 `"; + echo "*FAILED*" +else + echo " PASSED" +fi +} + -TESTING "h52giftst.h5 image1.gif -i 12345678 -p palette" ; -TOOLTEST $TESTFILE image1.gif -i 12345678 -p palette +TESTING "./h52gif h52giftst.h5 image1.gif -i 12345678 -p palette" +TOOLTEST1 $TESTFILE1 image1.gif -i 12345678 -p palette +TESTING "./gif2h5 image1.gif image1.h5" +TOOLTEST2 $TESTFILE2 image1.h5 exit $errors diff --git a/hl/tools/gif2h5/writehdf.c b/hl/tools/gif2h5/writehdf.c index 6e77c8e..a55bf10 100644 --- a/hl/tools/gif2h5/writehdf.c +++ b/hl/tools/gif2h5/writehdf.c @@ -19,6 +19,8 @@ #include "gif.h" #include "H5IM.h" +#define PAL_NAME "global" + /*------------------------------------------------------------------------- * Function: WriteHDF * @@ -39,6 +41,7 @@ WriteHDF(GIFTOMEM GifMemoryStruct, char *HDFName , char *GIFFileName) { GIFHEAD gifHead; /* GIF Header structure */ GIFIMAGEDESC *gifImageDesc; /* Logical Image Descriptor struct */ + int has_pal=0; long ImageCount; /* number of images */ #ifdef UNUSED @@ -82,8 +85,10 @@ WriteHDF(GIFTOMEM GifMemoryStruct, char *HDFName , char *GIFFileName) dims[1] = 3; /* make a palette */ - if (H5IMmake_palette(file_id,"Global Palette",dims,(unsigned char *)gifHead.HDFPalette)<0) + if (H5IMmake_palette(file_id,PAL_NAME,dims,(unsigned char *)gifHead.HDFPalette)<0) return -1; + + has_pal=1; } for(i = 0; i < ImageCount; i++) { @@ -103,8 +108,11 @@ WriteHDF(GIFTOMEM GifMemoryStruct, char *HDFName , char *GIFFileName) return -1; /* attach the palette to the image dataset */ - if (H5IMlink_palette(file_id,ImageName,"Global Palette")<0) - return -1; + if (has_pal) + { + if (H5IMlink_palette(file_id,ImageName,PAL_NAME)<0) + return -1; + } } /* close the H5 file */ diff --git a/hl/tools/testfiles/image1.gif b/hl/tools/testfiles/image1.gif Binary files differnew file mode 100644 index 0000000..b90b23a --- /dev/null +++ b/hl/tools/testfiles/image1.gif |