summaryrefslogtreecommitdiffstats
path: root/hl
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2001-08-10 22:30:01 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2001-08-10 22:30:01 (GMT)
commitd24ae52673e96864f4e406dd7b277f91d42fbb38 (patch)
treee9bb3c48c58f43899616fe8d6cda8daec8d4cc8a /hl
parent48842d60fa84fb69fb0a3dc527132eb93a6be7f2 (diff)
downloadhdf5-d24ae52673e96864f4e406dd7b277f91d42fbb38.zip
hdf5-d24ae52673e96864f4e406dd7b277f91d42fbb38.tar.gz
hdf5-d24ae52673e96864f4e406dd7b277f91d42fbb38.tar.bz2
[svn-r4326] Purpose:
Code cleanups, mostly.. Description: Work on pacifying the SGI compiler to get the generic properties working correctly with --enable-parallel and --enable-fortran. It's not quite fixed yet, but I need to head home and these patches help... :-/ Platforms tested: IRIX64 6.5 (modi4)
Diffstat (limited to 'hl')
-rw-r--r--hl/tools/gif2h5/hdf2gif.c23
-rw-r--r--hl/tools/gif2h5/hdfgifwr.c22
-rw-r--r--hl/tools/gif2h5/readhdf.c11
-rw-r--r--hl/tools/gif2h5/writehdf.c54
4 files changed, 68 insertions, 42 deletions
diff --git a/hl/tools/gif2h5/hdf2gif.c b/hl/tools/gif2h5/hdf2gif.c
index 2d6b339..9b5eebc 100644
--- a/hl/tools/gif2h5/hdf2gif.c
+++ b/hl/tools/gif2h5/hdf2gif.c
@@ -77,13 +77,16 @@ int main(int argc , char **argv)
BYTE Blue[256];
int RWidth, RHeight;
+#ifdef UNUSED
int LeftOfs, TopOfs;
+ int CountDown;
+ int curx , cury;
+ int w,h;
+#endif /* UNUSED */
int ColorMapSize, InitCodeSize, Background, BitsPerPixel;
int j,nc;
- int w,h,i;
+ int i;
int numcols = 256;
- int CountDown;
- int curx , cury;
int time_out = 0; /* time between two images in the animation */
int n_images , idx;
@@ -175,8 +178,8 @@ int main(int argc , char **argv)
has_local_palette = true;
/* Do Endian Order testing and set Endian Order */
- w = 0x0001;
- b = (BYTE *) &w;
+ idx = 0x0001;
+ b = (BYTE *) &idx;
EndianOrder = (b[0] ? 1:0);
if (!(fpGif = fopen(GIFName , "wb"))) {
@@ -205,12 +208,14 @@ int main(int argc , char **argv)
return -1;
}
+ RWidth = dim_sizes[1];
+ RHeight = dim_sizes[0];
+#ifdef UNUSED
w = dim_sizes[1];
h = dim_sizes[0];
- RWidth = dim_sizes[1];
- RHeight = dim_sizes[0];
LeftOfs = TopOfs = 0;
+#endif /* UNUSED */
/*
@@ -271,14 +276,18 @@ int main(int argc , char **argv)
BitsPerPixel = i;
ColorMapSize = 1 << BitsPerPixel;
+#ifdef UNUSED
CountDown = w * h; /* # of pixels we'll be doing */
+#endif /* UNUSED */
if (BitsPerPixel <= 1)
InitCodeSize = 2;
else
InitCodeSize = BitsPerPixel;
+#ifdef UNUSED
curx = cury = 0;
+#endif /* UNUSED */
if (!fpGif) {
fprintf(stderr, "WriteGIF: file not open for writing\n" );
diff --git a/hl/tools/gif2h5/hdfgifwr.c b/hl/tools/gif2h5/hdfgifwr.c
index e5f79e2..b13b79a 100644
--- a/hl/tools/gif2h5/hdfgifwr.c
+++ b/hl/tools/gif2h5/hdfgifwr.c
@@ -62,10 +62,12 @@ typedef long int count_int;
/* MONO returns total intensity of r,g,b components */
#define MONO(rd,gn,bl) (((rd)*11 + (gn)*16 + (bl)*5) >> 5) /*.33R+ .5G+ .17B*/
+#ifdef UNUSED
static int Width, Height;
static int curx, cury;
static long CountDown;
static int Interlace;
+#endif /* UNUSED */
#ifdef __STDC__
static void compress(int, FILE *, byte *, int);
@@ -80,43 +82,57 @@ static void compress(), output(), cl_block(), cl_hash();
static void char_init(), char_out(), flush_char();
#endif /* __STDC__ */
-static byte pc2nc[256],r1[256],g1[256],b1[256];
+static byte pc2nc[256];
+#ifdef UNUSED
+static byte r1[256],g1[256],b1[256];
+#endif /* UNUSED */
/*************************************************************/
int hdfWriteGIF(FILE *fp, byte *pic, int ptype, int w, int h, byte *rmap,
byte *gmap, byte *bmap, byte *pc2ncmap, int numcols,
int colorstyle, int BitsPerPixel)
{
+#ifdef UNUSED
int RWidth, RHeight;
int LeftOfs, TopOfs;
- int ColorMapSize, InitCodeSize, Background;
+ int ColorMapSize, Background;
+#endif /* UNUSED */
+ int InitCodeSize;
int i;
byte *pic8 = pic;
+#ifdef UNUSED
Interlace = 0;
Background = 0;
+#endif /* UNUSED */
for (i = 0; i < 256; i++) {
pc2nc[i] = pc2ncmap[i];
+#ifdef UNUSED
r1[i] = rmap[i];
g1[i] = gmap[i];
b1[i] = bmap[i];
+#endif /* UNUSED */
}
+#ifdef UNUSED
ColorMapSize = 1 << BitsPerPixel;
- RWidth = Width = w;
+ RWidth = Width = w;
RHeight = Height = h;
LeftOfs = TopOfs = 0;
CountDown = w * h; /* # of pixels we'll be doing */
+#endif /* UNUSED */
if (BitsPerPixel <= 1)
InitCodeSize = 2;
else
InitCodeSize = BitsPerPixel;
+#ifdef UNUSED
curx = cury = 0;
+#endif /* UNUSED */
if (!fp) {
fprintf(stderr, "WriteGIF: file not open for writing\n" );
diff --git a/hl/tools/gif2h5/readhdf.c b/hl/tools/gif2h5/readhdf.c
index 912c2c6..08258de 100644
--- a/hl/tools/gif2h5/readhdf.c
+++ b/hl/tools/gif2h5/readhdf.c
@@ -34,7 +34,6 @@ int ReadHDF(BYTE** data, BYTE palette[256][3], hsize_t *image_size,
CHAR *h5_file, CHAR *dset_name, CHAR *pal_name)
{
hid_t fHfile; /* H5 file to open */
- herr_t status; /* status variable */
hid_t dspace; /* dataspace identifier for the the dataset */
hid_t dset; /* dataset identifier */
hid_t pal_set; /* dataset for palette */
@@ -88,7 +87,7 @@ int ReadHDF(BYTE** data, BYTE palette[256][3], hsize_t *image_size,
}
/* get the actual image */
- if ((status = H5Dread(dset , H5Dget_type(dset) , H5S_ALL , H5S_ALL , H5P_DEFAULT , *data)) < 0) {
+ if (H5Dread(dset , H5Dget_type(dset) , H5S_ALL , H5S_ALL , H5P_DEFAULT , *data) < 0) {
fprintf(stderr , "Unable to read data \n");
cleanup(*data);
return -1;
@@ -139,7 +138,7 @@ int ReadHDF(BYTE** data, BYTE palette[256][3], hsize_t *image_size,
}
/* get the actual palette */
- if ((status = H5Dread(pal_set , H5Dget_type(pal_set) , H5S_ALL , H5S_ALL , H5P_DEFAULT , temp_buf)) < 0) {
+ if (H5Dread(pal_set , H5Dget_type(pal_set) , H5S_ALL , H5S_ALL , H5P_DEFAULT , temp_buf) < 0) {
fprintf(stderr , "Unable to read data \n");
cleanup(*data);
cleanup(temp_buf);
@@ -166,8 +165,8 @@ int ReadHDF(BYTE** data, BYTE palette[256][3], hsize_t *image_size,
}
/* close everything */
- status = H5Dclose(dset);
- status = H5Sclose(dspace);
- status = H5Fclose(fHfile);
+ H5Dclose(dset);
+ H5Sclose(dspace);
+ H5Fclose(fHfile);
return 0;
}
diff --git a/hl/tools/gif2h5/writehdf.c b/hl/tools/gif2h5/writehdf.c
index 4d69d01..3a6831a 100644
--- a/hl/tools/gif2h5/writehdf.c
+++ b/hl/tools/gif2h5/writehdf.c
@@ -19,7 +19,6 @@ static int write_text_attribute(hid_t dataset_id , const char *attr_name,
hsize_t attr_dims_size; /* dimensions for the attribute */
hid_t attr_dataspace_id; /* dataspaces needed for the various attributes */
hid_t attr_attr_id; /* attribute id */
- herr_t status; /* check return status */
hid_t attr_type_id;
/* check strings */
@@ -41,15 +40,15 @@ static int write_text_attribute(hid_t dataset_id , const char *attr_name,
attr_dataspace_id , H5P_DEFAULT);
/* write out the attribute data */
- if ((status = H5Awrite(attr_attr_id , attr_type_id , attr_value)) < 0)
+ if (H5Awrite(attr_attr_id , attr_type_id , attr_value) < 0)
return -1;
/* close the attribute */
- if ((status = H5Aclose(attr_attr_id)) < 0)
+ if (H5Aclose(attr_attr_id) < 0)
return -1;
/* close the dataspace */
- if ((status = H5Sclose(attr_dataspace_id)) < 0) {
+ if (H5Sclose(attr_dataspace_id) < 0) {
fprintf(stderr , "Unable to close attribute dataspace. Aborting \n");
return -1;
}
@@ -63,10 +62,12 @@ WriteHDF(GIFTOMEM GifMemoryStruct, char *HDFName , char *GIFFileName)
GIFHEAD gifHead; /* GIF Header structure */
GIFIMAGEDESC *gifImageDesc; /* Logical Image Descriptor struct */
- long ImageCount, /* number of images */
- CommentCount, /* number of comments */
+ 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 GR Image */
char GroupName[VSNAMELENMAX]; /* so that we can name the subgroups appropriately */
@@ -75,7 +76,6 @@ WriteHDF(GIFTOMEM GifMemoryStruct, char *HDFName , char *GIFFileName)
hid_t file_id; /* H5 file id */
hid_t image_id; /* H5 id for the whole image */
hid_t pal_id; /* H5 id for the palette */
- herr_t status; /* status variable */
hobj_ref_t pal_ref; /* Create a reference for the palette */
/* temp counter */
@@ -85,10 +85,12 @@ WriteHDF(GIFTOMEM GifMemoryStruct, char *HDFName , char *GIFFileName)
gifHead = *(GifMemoryStruct.GifHeader);
/* get some data from gifHead */
- ImageCount = (WORD)gifHead.ImageCount;
+ ImageCount = gifHead.ImageCount;
+#ifdef UNUSED
CommentCount = (WORD)gifHead.CommentCount;
ApplicationCount = (WORD)gifHead.ApplicationCount;
PlainTextCount = (WORD)gifHead.PlainTextCount;
+#endif /* UNUSED */
/* get the main group name from GIFFileName */
GroupName[0]= '/';
@@ -138,7 +140,7 @@ WriteHDF(GIFTOMEM GifMemoryStruct, char *HDFName , char *GIFFileName)
/* write the palette data out */
/****** Ask Elena about VOIDP ******/
- if ((status = H5Dwrite(pal_id , H5T_NATIVE_UINT8 , H5S_ALL , H5S_ALL , H5P_DEFAULT , (void *)gifHead.HDFPalette)) < 0) {
+ if (H5Dwrite(pal_id , H5T_NATIVE_UINT8 , H5S_ALL , H5S_ALL , H5P_DEFAULT , (void *)gifHead.HDFPalette) < 0) {
fprintf(stderr , "Error writing dataset. Aborting...\n");
return -1;
}
@@ -176,36 +178,36 @@ WriteHDF(GIFTOMEM GifMemoryStruct, char *HDFName , char *GIFFileName)
ref_dataset_id = H5Dcreate(image_id , "Palette Reference" , H5T_STD_REF_OBJ , ref_dataspace_id , H5P_DEFAULT);
/* create a reference to the palette */
- if ((status = H5Rcreate(&pal_ref , image_id , "Global Palette" , H5R_OBJECT , -1)) < 0) {
+ if (H5Rcreate(&pal_ref , image_id , "Global Palette" , H5R_OBJECT , -1) < 0) {
fprintf(stderr , "Unable to create palette reference\n");
return -1;
}
/* write the reference out */
- if ((status = H5Dwrite(ref_dataset_id , H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL , H5P_DEFAULT, &pal_ref)) < 0) {
+ if (H5Dwrite(ref_dataset_id , H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL , H5P_DEFAULT, &pal_ref) < 0) {
fprintf(stderr , "Unable to write Palette Reference");
return -1;
}
/* close dataset */
- if ((status = H5Dclose(ref_dataset_id)) < 0) {
+ if (H5Dclose(ref_dataset_id) < 0) {
fprintf(stderr , "Unable to close palette dataset.\n");
return -1;
}
/* close dataspace */
- if ((status = H5Sclose(ref_dataspace_id)) < 0) {
+ if (H5Sclose(ref_dataspace_id) < 0) {
fprintf(stderr , "Unable to close palette dataspace.\n");
return -1;
}
/* close everything */
- if ((status = H5Dclose(pal_id)) < 0) {
+ if (H5Dclose(pal_id) < 0) {
fprintf(stderr , "Unable to close palette dataset. Aborting.\n");
return -1;
}
- if ((status = H5Sclose(dataspace_id)) < 0) {
+ if (H5Sclose(dataspace_id) < 0) {
fprintf(stderr , "Unable to close palette dataspace. Aborting.\n");
return -1;
}
@@ -251,7 +253,7 @@ WriteHDF(GIFTOMEM GifMemoryStruct, char *HDFName , char *GIFFileName)
/* write out the image */
/****** Ask Elena about VOIDP ******/
- if ((status = H5Dwrite(sub_image_id , H5T_NATIVE_UINT8 , H5S_ALL , H5S_ALL , H5P_DEFAULT , (void *)(gifImageDesc->Image))) < 0) {
+ if (H5Dwrite(sub_image_id , H5T_NATIVE_UINT8 , H5S_ALL , H5S_ALL , H5P_DEFAULT , (void *)(gifImageDesc->Image)) < 0) {
fprintf(stderr , "Error writing image. Aborting... \n");
return -1;
}
@@ -325,19 +327,19 @@ WriteHDF(GIFTOMEM GifMemoryStruct, char *HDFName , char *GIFFileName)
/* create the attribute */
attr_attr_id = H5Acreate(sub_image_id , "PALETTE" , H5T_STD_REF_OBJ , attr_dataspace_id , H5P_DEFAULT);
- if ((status = H5Awrite(attr_attr_id , H5T_STD_REF_OBJ , &pal_ref)) < 0) {
+ if (H5Awrite(attr_attr_id , H5T_STD_REF_OBJ , &pal_ref) < 0) {
fprintf(stderr , "Unable to write attribute. Aborting \n");
return -1;
}
/* close the attribute */
- if ((status = H5Aclose(attr_attr_id)) < 0) {
+ if (H5Aclose(attr_attr_id) < 0) {
fprintf(stderr , "Unable to close CLASS IMAGE attribute. Aborting.\n");
return -1;
}
/* close the dataspace */
- if ((status = H5Sclose(attr_dataspace_id)) < 0) {
+ if (H5Sclose(attr_dataspace_id) < 0) {
fprintf(stderr , "Unable to close attribute dataspace. Aborting \n");
return -1;
}
@@ -356,43 +358,43 @@ WriteHDF(GIFTOMEM GifMemoryStruct, char *HDFName , char *GIFFileName)
/* create the attribute */
attr_attr_id = H5Acreate(sub_image_id , "IMAGE_MINMAXRANGE" , H5T_NATIVE_UINT8 , attr_dataspace_id , H5P_DEFAULT);
- if ((status = H5Awrite(attr_attr_id , H5T_NATIVE_UINT8 , minmax)) < 0) {
+ if (H5Awrite(attr_attr_id , H5T_NATIVE_UINT8 , minmax) < 0) {
fprintf(stderr , "Unable to write attribute. Aborting \n");
return -1;
}
/* close the attribute */
- if ((status = H5Aclose(attr_attr_id)) < 0) {
+ if (H5Aclose(attr_attr_id) < 0) {
fprintf(stderr , "Unable to close CLASS IMAGE attribute. Aborting.\n");
return -1;
}
/* close the dataspace */
- if ((status = H5Sclose(attr_dataspace_id)) < 0) {
+ if (H5Sclose(attr_dataspace_id) < 0) {
fprintf(stderr , "Unable to close attribute dataspace. Aborting \n");
return -1;
}
/* close everything */
- if ((status = H5Dclose(sub_image_id)) < 0) {
+ if (H5Dclose(sub_image_id) < 0) {
fprintf(stderr , "Unable to close image dataset. Aborting \n");
return -1;
}
- if ((status = H5Sclose(dataspace_id)) < 0) {
+ if (H5Sclose(dataspace_id) < 0) {
fprintf(stderr , "Unable to close image dataspace. Aborting \n");
return -1;
}
}
/* close the main image group */
- if ((status = H5Gclose(image_id)) < 0) {
+ if (H5Gclose(image_id) < 0) {
fprintf(stderr , "Could not close the image group. Aborting...\n");
return -1;
}
/* close the H5 file */
- if ((status = H5Fclose(file_id)) < 0) {
+ if (H5Fclose(file_id) < 0) {
fprintf(stderr , "Could not close HDF5 file. Aborting...\n");
return -1;
}