[svn-r5305]

Purpose:
    user reported a bug on h5 to gif tool
Description:
    h5 to gif did not read an HDF5 image correctly
Solution:
    updated the program so that it reads the updated HDF5 image format to the latest specification
    the debug version of MSVC was giving a failure on the write of the GIF file,
    regarding the GIF file pointer
    this write error is eliminated declaring that pointer a global variable
    there is still an applicattion error on the exit of the program, only on the debug version of MSVC



Platforms tested:
    w2000
This commit is contained in:
Pedro Vicente Nunes 2002-05-01 09:37:14 -05:00
parent 80de8bccb9
commit 49a7f1d032
4 changed files with 12 additions and 8 deletions

View File

@ -52,9 +52,11 @@ usage(void)
printf("(maximum of 50 images).\n");
}
FILE *fpGif = NULL;
int main(int argc , char **argv)
{
FILE *fpGif;
hsize_t dim_sizes[2];
BYTE *Image;
@ -299,9 +301,9 @@ int main(int argc , char **argv)
if (idx == 0) {
/* Write out the GIF header and logical screen descriptor */
if (n_images > 1) {
fwrite("GIF89a", 1, 6, fpGif); /* the GIF magic number */
fwrite("GIF89a", sizeof( char ), 6, fpGif); /* the GIF magic number */
} else {
fwrite("GIF87a", 1, 6, fpGif); /* the GIF magic number */
fwrite("GIF87a", sizeof( char ), 6, fpGif); /* the GIF magic number */
}
putword(RWidth, fpGif); /* screen descriptor */

View File

@ -72,7 +72,7 @@ int ReadHDF(BYTE** data, BYTE palette[256][3], hsize_t *image_size,
}
/* get the dimension size of the image */
if (H5Sget_simple_extent_dims(dspace , image_size , NULL) !=2 ) {
if (H5Sget_simple_extent_dims(dspace , image_size , NULL) <0 ) {
fprintf(stderr , "Unable to get dimension info\n");
return -1;
}

View File

@ -52,9 +52,11 @@ usage(void)
printf("(maximum of 50 images).\n");
}
FILE *fpGif = NULL;
int main(int argc , char **argv)
{
FILE *fpGif;
hsize_t dim_sizes[2];
BYTE *Image;
@ -299,9 +301,9 @@ int main(int argc , char **argv)
if (idx == 0) {
/* Write out the GIF header and logical screen descriptor */
if (n_images > 1) {
fwrite("GIF89a", 1, 6, fpGif); /* the GIF magic number */
fwrite("GIF89a", sizeof( char ), 6, fpGif); /* the GIF magic number */
} else {
fwrite("GIF87a", 1, 6, fpGif); /* the GIF magic number */
fwrite("GIF87a", sizeof( char ), 6, fpGif); /* the GIF magic number */
}
putword(RWidth, fpGif); /* screen descriptor */

View File

@ -72,7 +72,7 @@ int ReadHDF(BYTE** data, BYTE palette[256][3], hsize_t *image_size,
}
/* get the dimension size of the image */
if (H5Sget_simple_extent_dims(dspace , image_size , NULL) !=2 ) {
if (H5Sget_simple_extent_dims(dspace , image_size , NULL) <0 ) {
fprintf(stderr , "Unable to get dimension info\n");
return -1;
}