diff options
author | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2007-04-02 20:47:29 (GMT) |
---|---|---|
committer | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2007-04-02 20:47:29 (GMT) |
commit | 5b02211e762bad3ab6037aef314000ddc0bd81a5 (patch) | |
tree | 197d2860eacc257cf97cdd0bae73a9503571014c /hl/tools/gif2h5/writehdf.c | |
parent | 104e1cd848e26eda1c774937c3beb38ff5861fd8 (diff) | |
download | hdf5-5b02211e762bad3ab6037aef314000ddc0bd81a5.zip hdf5-5b02211e762bad3ab6037aef314000ddc0bd81a5.tar.gz hdf5-5b02211e762bad3ab6037aef314000ddc0bd81a5.tar.bz2 |
[svn-r13574]
bug fix
check if a palette is to be linked and correct wrong calls in some functions with missing arguments
Diffstat (limited to 'hl/tools/gif2h5/writehdf.c')
-rw-r--r-- | hl/tools/gif2h5/writehdf.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/hl/tools/gif2h5/writehdf.c b/hl/tools/gif2h5/writehdf.c index c0c4742..7c2b063 100644 --- a/hl/tools/gif2h5/writehdf.c +++ b/hl/tools/gif2h5/writehdf.c @@ -19,6 +19,8 @@ #include "gif.h" #include "H5IMpublic.h" +#define PAL_NAME "global" + /*------------------------------------------------------------------------- * Function: WriteHDF * @@ -35,12 +37,18 @@ */ int -WriteHDF(GIFTOMEM GifMemoryStruct, char *HDFName) +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 + long CommentCount, /* number of comments */ + ApplicationCount, /* number of application extensions */ + PlainTextCount; /* number of plain text extensions */ +#endif /* UNUSED */ char ImageName[256]; /* Image name for the Image */ @@ -55,6 +63,11 @@ WriteHDF(GIFTOMEM GifMemoryStruct, char *HDFName) /* get some data from gifHead */ ImageCount = gifHead.ImageCount; +#ifdef UNUSED + CommentCount = (WORD)gifHead.CommentCount; + ApplicationCount = (WORD)gifHead.ApplicationCount; + PlainTextCount = (WORD)gifHead.PlainTextCount; +#endif /* UNUSED */ if ((file_id = H5Fcreate(HDFName , H5F_ACC_TRUNC , H5P_DEFAULT , H5P_DEFAULT)) < 0) { /* error occured opening the HDF File for write */ @@ -72,8 +85,10 @@ WriteHDF(GIFTOMEM GifMemoryStruct, char *HDFName) 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++) { @@ -93,8 +108,11 @@ WriteHDF(GIFTOMEM GifMemoryStruct, char *HDFName) 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 */ |