mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-02-17 16:10:24 +08:00
[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)
This commit is contained in:
parent
48842d60fa
commit
d24ae52673
@ -1128,7 +1128,7 @@ nh5pset_cache_c(hid_t_f *prp_id, int_f* mdc_nelmts, int_f* rdcc_nelmts, size_t_
|
||||
* Modifications: Changed type of the rdcc_w0 parameter to be real_f instead of double
|
||||
*---------------------------------------------------------------------------*/
|
||||
int_f
|
||||
nh5pget_cache_c(hid_t_f *prp_id, int_f* mdc_nelmts, int_f* rdcc_nelmts, size_t_f* rdcc_nbytes , real_f* rdcc_w0)
|
||||
nh5pget_cache_c(hid_t_f *prp_id, int_f* mdc_nelmts, size_t_f* rdcc_nelmts, size_t_f* rdcc_nbytes , real_f* rdcc_w0)
|
||||
{
|
||||
int ret_value = -1;
|
||||
hid_t c_prp_id;
|
||||
|
@ -2107,7 +2107,7 @@
|
||||
INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier
|
||||
INTEGER, INTENT(OUT) :: mdc_nelmts !Number of elements (objects)
|
||||
! in the meta data cache
|
||||
INTEGER, INTENT(OUT) :: rdcc_nelmts !Number of elements (objects)
|
||||
INTEGER(SIZE_T), INTENT(OUT) :: rdcc_nelmts !Number of elements (objects)
|
||||
! in the meta data cache
|
||||
INTEGER(SIZE_T), INTENT(OUT) :: rdcc_nbytes !Total size of the raw data
|
||||
!chunk cache, in bytes
|
||||
@ -2126,7 +2126,7 @@
|
||||
!DEC$ ENDIF
|
||||
INTEGER(HID_T), INTENT(IN) :: prp_id
|
||||
INTEGER, INTENT(OUT) :: mdc_nelmts
|
||||
INTEGER, INTENT(OUT) :: rdcc_nelmts
|
||||
INTEGER(SIZE_T), INTENT(OUT) :: rdcc_nelmts
|
||||
INTEGER(SIZE_T), INTENT(OUT) :: rdcc_nbytes
|
||||
REAL, INTENT(OUT) :: rdcc_w0
|
||||
END FUNCTION h5pget_cache_c
|
||||
|
@ -120,19 +120,19 @@ nh5close_types_c( hid_t_f * types, int_f *lentypes,
|
||||
|
||||
int ret_value = -1;
|
||||
hid_t c_type_id;
|
||||
herr_t err;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < *lentypes; i++) {
|
||||
c_type_id = types[i];
|
||||
if ( (err = H5Tclose(c_type_id)) < 0) return ret_value;
|
||||
if ( H5Tclose(c_type_id) < 0) return ret_value;
|
||||
}
|
||||
for (i = 0; i < *floatinglen; i++) {
|
||||
c_type_id = floatingtypes[i];
|
||||
if ( (err = H5Tclose(c_type_id)) < 0) return ret_value;
|
||||
if ( H5Tclose(c_type_id) < 0) return ret_value;
|
||||
}
|
||||
for (i = 0; i < *integerlen; i++) {
|
||||
c_type_id = integertypes[i];
|
||||
if ( (err = H5Tclose(c_type_id)) < 0) return ret_value;
|
||||
if ( H5Tclose(c_type_id) < 0) return ret_value;
|
||||
}
|
||||
ret_value = 0;
|
||||
return ret_value;
|
||||
|
@ -764,7 +764,7 @@ nh5pget_fapl_family_c (hid_t_f *prp_id, hsize_t_f* memb_size, hid_t_f* memb_plis
|
||||
__DLL__ int_f
|
||||
nh5pset_cache_c(hid_t_f *prp_id, int_f* mdc_nelmts, int_f* rdcc_nelmts, size_t_f* rdcc_nbytes, real_f* rdcc_w0);
|
||||
__DLL__ int_f
|
||||
nh5pget_cache_c(hid_t_f *prp_id, int_f* mdc_nelmts, int_f* rdcc_nelmts, size_t_f* rdcc_nbytes, real_f* rdcc_w0);
|
||||
nh5pget_cache_c(hid_t_f *prp_id, int_f* mdc_nelmts, size_t_f* rdcc_nelmts, size_t_f* rdcc_nbytes, real_f* rdcc_w0);
|
||||
__DLL__ int_f
|
||||
nh5pget_fapl_split_c(hid_t_f *prp_id, size_t_f* meta_ext_size , _fcd meta_ext, hid_t_f* meta_plist, size_t_f* raw_ext_size, _fcd raw_ext, hid_t_f * raw_plist);
|
||||
__DLL__ int_f
|
||||
|
@ -77,13 +77,16 @@ int main(int argc , char **argv)
|
||||
BYTE Blue[256];
|
||||
|
||||
int RWidth, RHeight;
|
||||
#ifdef UNUSED
|
||||
int LeftOfs, TopOfs;
|
||||
int ColorMapSize, InitCodeSize, Background, BitsPerPixel;
|
||||
int j,nc;
|
||||
int w,h,i;
|
||||
int numcols = 256;
|
||||
int CountDown;
|
||||
int curx , cury;
|
||||
int w,h;
|
||||
#endif /* UNUSED */
|
||||
int ColorMapSize, InitCodeSize, Background, BitsPerPixel;
|
||||
int j,nc;
|
||||
int i;
|
||||
int numcols = 256;
|
||||
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" );
|
||||
|
@ -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,29 +82,40 @@ 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;
|
||||
@ -110,13 +123,16 @@ int hdfWriteGIF(FILE *fp, byte *pic, int ptype, int w, int h, byte *rmap,
|
||||
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" );
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -184,13 +184,13 @@ H5F_seq_readv(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout,
|
||||
|
||||
/* Get the driver ID */
|
||||
if(H5P_get(dxpl_id, H5D_XFER_VFL_ID_NAME, &driver_id)<0)
|
||||
HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver ID");
|
||||
HRETURN_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver ID");
|
||||
|
||||
/* Check if we are using the MPIO driver */
|
||||
if(H5FD_MPIO==driver_id) {
|
||||
/* Get the driver information */
|
||||
if(H5P_get(dxpl_id, H5D_XFER_VFL_INFO_NAME, &dx)<0)
|
||||
HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver info");
|
||||
HRETURN_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver info");
|
||||
|
||||
/* Check if we are not using independent I/O */
|
||||
if(H5FD_MPIO_INDEPENDENT!=dx->xfer_mode)
|
||||
@ -558,13 +558,13 @@ H5F_seq_writev(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout,
|
||||
|
||||
/* Get the driver ID */
|
||||
if(H5P_get(dxpl_id, H5D_XFER_VFL_ID_NAME, &driver_id)<0)
|
||||
HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver ID");
|
||||
HRETURN_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver ID");
|
||||
|
||||
/* Check if we are using the MPIO driver */
|
||||
if(H5FD_MPIO==driver_id) {
|
||||
/* Get the driver information */
|
||||
if(H5P_get(dxpl_id, H5D_XFER_VFL_INFO_NAME, &dx)<0)
|
||||
HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver info");
|
||||
HRETURN_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver info");
|
||||
|
||||
/* Check if we are not using independent I/O */
|
||||
if(H5FD_MPIO_INDEPENDENT!=dx->xfer_mode)
|
||||
|
@ -180,13 +180,13 @@ H5F_arr_read(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout,
|
||||
|
||||
/* Get the driver ID */
|
||||
if(H5P_get(dxpl_id, H5D_XFER_VFL_ID_NAME, &driver_id)<0)
|
||||
HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver ID");
|
||||
HRETURN_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver ID");
|
||||
|
||||
/* Check if we are using the MPIO driver */
|
||||
if(H5FD_MPIO==driver_id) {
|
||||
/* Get the driver information */
|
||||
if(H5P_get(dxpl_id, H5D_XFER_VFL_INFO_NAME, &dx)<0)
|
||||
HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver info");
|
||||
HRETURN_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver info");
|
||||
|
||||
/* Check if we are not using independent I/O */
|
||||
if(H5FD_MPIO_INDEPENDENT!=dx->xfer_mode)
|
||||
@ -309,7 +309,7 @@ H5F_arr_read(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout,
|
||||
|
||||
/* Track the number of reads to gather */
|
||||
if(H5P_set(dxpl_id, H5D_XFER_GATHER_READS_NAME, &gather_reads)<0)
|
||||
HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve gather reads");
|
||||
HRETURN_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve gather reads");
|
||||
|
||||
#else
|
||||
for (z=0; z<nelmts; z++) {
|
||||
@ -467,13 +467,13 @@ H5F_arr_write(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout,
|
||||
|
||||
/* Get the driver ID */
|
||||
if(H5P_get(dxpl_id, H5D_XFER_VFL_ID_NAME, &driver_id)<0)
|
||||
HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver ID");
|
||||
HRETURN_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver ID");
|
||||
|
||||
/* Check if we are using the MPIO driver */
|
||||
if(H5FD_MPIO==driver_id) {
|
||||
/* Get the driver information */
|
||||
if(H5P_get(dxpl_id, H5D_XFER_VFL_INFO_NAME, &dx)<0)
|
||||
HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver info");
|
||||
HRETURN_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver info");
|
||||
|
||||
/* Check if we are not using independent I/O */
|
||||
if(H5FD_MPIO_INDEPENDENT!=dx->xfer_mode)
|
||||
|
@ -184,13 +184,13 @@ H5F_seq_readv(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout,
|
||||
|
||||
/* Get the driver ID */
|
||||
if(H5P_get(dxpl_id, H5D_XFER_VFL_ID_NAME, &driver_id)<0)
|
||||
HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver ID");
|
||||
HRETURN_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver ID");
|
||||
|
||||
/* Check if we are using the MPIO driver */
|
||||
if(H5FD_MPIO==driver_id) {
|
||||
/* Get the driver information */
|
||||
if(H5P_get(dxpl_id, H5D_XFER_VFL_INFO_NAME, &dx)<0)
|
||||
HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver info");
|
||||
HRETURN_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver info");
|
||||
|
||||
/* Check if we are not using independent I/O */
|
||||
if(H5FD_MPIO_INDEPENDENT!=dx->xfer_mode)
|
||||
@ -558,13 +558,13 @@ H5F_seq_writev(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout,
|
||||
|
||||
/* Get the driver ID */
|
||||
if(H5P_get(dxpl_id, H5D_XFER_VFL_ID_NAME, &driver_id)<0)
|
||||
HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver ID");
|
||||
HRETURN_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver ID");
|
||||
|
||||
/* Check if we are using the MPIO driver */
|
||||
if(H5FD_MPIO==driver_id) {
|
||||
/* Get the driver information */
|
||||
if(H5P_get(dxpl_id, H5D_XFER_VFL_INFO_NAME, &dx)<0)
|
||||
HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver info");
|
||||
HRETURN_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver info");
|
||||
|
||||
/* Check if we are not using independent I/O */
|
||||
if(H5FD_MPIO_INDEPENDENT!=dx->xfer_mode)
|
||||
|
@ -984,9 +984,9 @@ H5HG_debug(H5F_t *f, haddr_t addr, FILE *stream, intn indent,
|
||||
if (u>maxobj) maxobj = u;
|
||||
}
|
||||
}
|
||||
fprintf (stream, "%*s%-*s %u/%u/", indent, "", fwidth,
|
||||
fprintf (stream, "%*s%-*s %u/%lu/", indent, "", fwidth,
|
||||
"Objects defined/allocated/max:",
|
||||
nused, h->nalloc);
|
||||
nused, (unsigned long)h->nalloc);
|
||||
fprintf (stream, nused ? "%u\n": "NA\n", maxobj);
|
||||
|
||||
fprintf (stream, "%*s%-*s %lu\n", indent, "", fwidth,
|
||||
|
10
src/H5O.c
10
src/H5O.c
@ -417,7 +417,7 @@ H5O_load(H5F_t *f, haddr_t addr, const void UNUSED *_udata1,
|
||||
|
||||
/* increase chunk array size */
|
||||
if (oh->nchunks >= oh->alloc_nchunks) {
|
||||
size_t na = oh->alloc_nchunks + H5O_NCHUNKS;
|
||||
uintn na = oh->alloc_nchunks + H5O_NCHUNKS;
|
||||
H5O_chunk_t *x = H5FL_ARR_REALLOC (H5O_chunk_t, oh->chunk, na);
|
||||
|
||||
if (!x) {
|
||||
@ -1722,7 +1722,7 @@ H5O_alloc_extend_chunk(H5O_t *oh, uintn chunkno, size_t size)
|
||||
|
||||
/* create a new null message */
|
||||
if (oh->nmesgs >= oh->alloc_nmesgs) {
|
||||
size_t na = oh->alloc_nmesgs + H5O_NMESGS;
|
||||
uintn na = oh->alloc_nmesgs + H5O_NMESGS;
|
||||
H5O_mesg_t *x = H5FL_ARR_REALLOC (H5O_mesg_t, oh->mesg, na);
|
||||
|
||||
if (NULL==x) {
|
||||
@ -1863,7 +1863,7 @@ H5O_alloc_new_chunk(H5F_t *f, H5O_t *oh, size_t size)
|
||||
* Create the new chunk without giving it a file address.
|
||||
*/
|
||||
if (oh->nchunks >= oh->alloc_nchunks) {
|
||||
size_t na = oh->alloc_nchunks + H5O_NCHUNKS;
|
||||
uintn na = oh->alloc_nchunks + H5O_NCHUNKS;
|
||||
H5O_chunk_t *x = H5FL_ARR_REALLOC (H5O_chunk_t, oh->chunk, na);
|
||||
|
||||
if (!x) {
|
||||
@ -1888,7 +1888,7 @@ H5O_alloc_new_chunk(H5F_t *f, H5O_t *oh, size_t size)
|
||||
*/
|
||||
if (oh->nmesgs + 3 > oh->alloc_nmesgs) {
|
||||
int old_alloc=oh->alloc_nmesgs;
|
||||
size_t na = oh->alloc_nmesgs + MAX (H5O_NMESGS, 3);
|
||||
uintn na = oh->alloc_nmesgs + MAX (H5O_NMESGS, 3);
|
||||
H5O_mesg_t *x = H5FL_ARR_REALLOC (H5O_mesg_t, oh->mesg, na);
|
||||
|
||||
if (!x) {
|
||||
@ -2046,7 +2046,7 @@ H5O_alloc(H5F_t *f, H5O_t *oh, const H5O_class_t *type, size_t size)
|
||||
|
||||
if (oh->nmesgs >= oh->alloc_nmesgs) {
|
||||
int old_alloc=oh->alloc_nmesgs;
|
||||
size_t na = oh->alloc_nmesgs + H5O_NMESGS;
|
||||
uintn na = oh->alloc_nmesgs + H5O_NMESGS;
|
||||
H5O_mesg_t *x = H5FL_ARR_REALLOC (H5O_mesg_t, oh->mesg, na);
|
||||
|
||||
if (!x) {
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "H5Eprivate.h"
|
||||
#include "H5Fpkg.h" /* Ugly, but necessary for the MPIO I/O accesses */
|
||||
#include "H5FDprivate.h" /* Necessary for the H5FD_write & H5FD_read prototypes.. */
|
||||
#include "H5Pprivate.h" /* Property Lists */
|
||||
#include "H5Spkg.h"
|
||||
|
||||
#include "H5FDmpio.h" /*the MPIO file driver */
|
||||
|
@ -3161,7 +3161,7 @@ test_select(void)
|
||||
hid_t plist_id; /* Property list for reading random hyperslabs */
|
||||
hid_t fapl; /* Property list accessing the file */
|
||||
int mdc_nelmts; /* Metadata number of elements */
|
||||
unsigned rdcc_nelmts; /* Raw data number of elements */
|
||||
size_t rdcc_nelmts; /* Raw data number of elements */
|
||||
size_t rdcc_nbytes; /* Raw data number of bytes */
|
||||
double rdcc_w0; /* Raw data write percentage */
|
||||
herr_t ret; /* Generic return value */
|
||||
|
@ -77,13 +77,16 @@ int main(int argc , char **argv)
|
||||
BYTE Blue[256];
|
||||
|
||||
int RWidth, RHeight;
|
||||
#ifdef UNUSED
|
||||
int LeftOfs, TopOfs;
|
||||
int ColorMapSize, InitCodeSize, Background, BitsPerPixel;
|
||||
int j,nc;
|
||||
int w,h,i;
|
||||
int numcols = 256;
|
||||
int CountDown;
|
||||
int curx , cury;
|
||||
int w,h;
|
||||
#endif /* UNUSED */
|
||||
int ColorMapSize, InitCodeSize, Background, BitsPerPixel;
|
||||
int j,nc;
|
||||
int i;
|
||||
int numcols = 256;
|
||||
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" );
|
||||
|
@ -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,29 +82,40 @@ 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;
|
||||
@ -110,13 +123,16 @@ int hdfWriteGIF(FILE *fp, byte *pic, int ptype, int w, int h, byte *rmap,
|
||||
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" );
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -3237,9 +3237,9 @@ static const char *apos = "'";
|
||||
static char *
|
||||
xml_escape_the_name(const char *str)
|
||||
{
|
||||
int extra;
|
||||
int len;
|
||||
int i;
|
||||
size_t extra;
|
||||
size_t len;
|
||||
size_t i;
|
||||
const char *cp;
|
||||
char *ncp;
|
||||
char *rcp;
|
||||
@ -3323,9 +3323,9 @@ xml_escape_the_name(const char *str)
|
||||
static char *
|
||||
xml_escape_the_string(const char *str, int slen)
|
||||
{
|
||||
int extra;
|
||||
int len;
|
||||
int i;
|
||||
size_t extra;
|
||||
size_t len;
|
||||
size_t i;
|
||||
const char *cp;
|
||||
char *ncp;
|
||||
char *rcp;
|
||||
@ -3360,7 +3360,7 @@ xml_escape_the_string(const char *str, int slen)
|
||||
}
|
||||
|
||||
cp = str;
|
||||
rcp = ncp = calloc((size_t)(len + extra + 1), sizeof(char));
|
||||
rcp = ncp = calloc((len + extra + 1), sizeof(char));
|
||||
|
||||
if (ncp == NULL)
|
||||
return NULL; /* ?? */
|
||||
@ -3472,7 +3472,7 @@ xml_print_datatype(hid_t type)
|
||||
}
|
||||
printf("\" Size=\"");
|
||||
sz = H5Tget_size(type);
|
||||
printf("%d", sz);
|
||||
printf("%lu", (unsigned long)sz);
|
||||
printf("\" />\n");
|
||||
indent -= COL;
|
||||
indentation(indent);
|
||||
@ -3503,12 +3503,12 @@ xml_print_datatype(hid_t type)
|
||||
}
|
||||
printf("\" Size=\"");
|
||||
sz = H5Tget_size(type);
|
||||
printf("%d", sz);
|
||||
printf("%lu", (unsigned long)sz);
|
||||
H5Tget_fields(type, &spos, &epos, &esize, &mpos, &msize);
|
||||
printf("\" SignBitLocation=\"%d\" ", spos);
|
||||
printf("ExponentBits=\"%d\" ExponentLocation=\"%d\" ", esize, epos);
|
||||
printf("MantissaBits=\"%d\" MantissaLocation=\"%d\" />\n",
|
||||
msize, mpos);
|
||||
printf("\" SignBitLocation=\"%lu\" ", (unsigned long)spos);
|
||||
printf("ExponentBits=\"%lu\" ExponentLocation=\"%lu\" ", (unsigned long)esize, (unsigned long)epos);
|
||||
printf("MantissaBits=\"%lu\" MantissaLocation=\"%lu\" />\n",
|
||||
(unsigned long)msize, (unsigned long)mpos);
|
||||
indent -= COL;
|
||||
indentation(indent);
|
||||
printf("</AtomicType>\n");
|
||||
@ -3577,7 +3577,7 @@ xml_print_datatype(hid_t type)
|
||||
printf("ERROR_UNKNOWN");
|
||||
}
|
||||
size = H5Tget_size(type);
|
||||
printf("\" Size=\"%d\"/>\n", size);
|
||||
printf("\" Size=\"%lu\"/>\n", (unsigned long)size);
|
||||
indent -= COL;
|
||||
indentation(indent);
|
||||
printf("</AtomicType>\n");
|
||||
@ -3592,7 +3592,7 @@ xml_print_datatype(hid_t type)
|
||||
indentation(indent);
|
||||
printf("<OpaqueType Tag=\"%s\" ", H5Tget_tag(type));
|
||||
size = H5Tget_size(type);
|
||||
printf("Size=\"%d\"/>\n", size);
|
||||
printf("Size=\"%lu\"/>\n", (unsigned long)size);
|
||||
indent -= COL;
|
||||
indentation(indent);
|
||||
printf("</AtomicType>\n");
|
||||
|
@ -1856,7 +1856,6 @@ static void test_vldatatypes(void)
|
||||
int i;
|
||||
herr_t ret=0;
|
||||
|
||||
ret = ret; /* so that compiler won't complain "is set but never used" */
|
||||
file = H5Fcreate(FILE21, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
|
||||
|
||||
/* Allocate and initialize VL dataset to write */
|
||||
@ -1875,11 +1874,16 @@ static void test_vldatatypes(void)
|
||||
type = H5Tvlen_create(H5T_NATIVE_INT);
|
||||
dset = H5Dcreate(file, "Dataset1.0", type, space, H5P_DEFAULT);
|
||||
ret = H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
|
||||
assert(ret>=0);
|
||||
ret = H5Dvlen_reclaim(type, space, H5P_DEFAULT, wdata);
|
||||
assert(ret>=0);
|
||||
|
||||
ret = H5Dclose(dset);
|
||||
assert(ret>=0);
|
||||
ret = H5Tclose(type);
|
||||
assert(ret>=0);
|
||||
ret = H5Sclose(space);
|
||||
assert(ret>=0);
|
||||
|
||||
/* Allocate and initialize VL dataset to write */
|
||||
for(i = 0; i < SPACE1_DIM1; i++) {
|
||||
@ -1897,11 +1901,16 @@ static void test_vldatatypes(void)
|
||||
type = H5Tvlen_create(H5T_NATIVE_FLOAT);
|
||||
dset = H5Dcreate(file, "Dataset2.0", type, space, H5P_DEFAULT);
|
||||
ret = H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
|
||||
assert(ret>=0);
|
||||
ret = H5Dvlen_reclaim(type, space, H5P_DEFAULT, wdata);
|
||||
assert(ret>=0);
|
||||
|
||||
ret = H5Dclose(dset);
|
||||
assert(ret>=0);
|
||||
ret = H5Tclose(type);
|
||||
assert(ret>=0);
|
||||
ret = H5Sclose(space);
|
||||
assert(ret>=0);
|
||||
|
||||
/* Allocate and initialize a scalar VL dataset to write */
|
||||
adata.p = malloc(37 * sizeof(int));
|
||||
@ -1915,12 +1924,18 @@ static void test_vldatatypes(void)
|
||||
type = H5Tvlen_create(H5T_NATIVE_INT);
|
||||
dset = H5Dcreate(file, "Dataset3.0", type, space, H5P_DEFAULT);
|
||||
ret = H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, &adata);
|
||||
assert(ret>=0);
|
||||
ret = H5Dvlen_reclaim(type, space, H5P_DEFAULT, &adata);
|
||||
assert(ret>=0);
|
||||
|
||||
ret = H5Dclose(dset);
|
||||
assert(ret>=0);
|
||||
ret = H5Tclose(type);
|
||||
assert(ret>=0);
|
||||
ret = H5Sclose(space);
|
||||
assert(ret>=0);
|
||||
ret = H5Fclose(file);
|
||||
assert(ret>=0);
|
||||
}
|
||||
|
||||
static void test_vldatatypes2(void)
|
||||
@ -1935,8 +1950,6 @@ static void test_vldatatypes2(void)
|
||||
uintn i,j,k; /* counting variables */
|
||||
herr_t ret; /* Generic return value */
|
||||
|
||||
ret = ret; /* so that compiler won't complain "is set but never used" */
|
||||
|
||||
/* Allocate and initialize VL data to write */
|
||||
for(i=0; i<SPACE1_DIM1; i++) {
|
||||
wdata[i].p=malloc((i+1)*sizeof(hvl_t));
|
||||
@ -1974,16 +1987,23 @@ static void test_vldatatypes2(void)
|
||||
|
||||
/* Write dataset to disk */
|
||||
ret=H5Dwrite(dataset,tid2,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata);
|
||||
assert(ret>=0);
|
||||
|
||||
/* Reclaim the write VL data */
|
||||
ret=H5Dvlen_reclaim(tid2,sid1,H5P_DEFAULT,wdata);
|
||||
assert(ret>=0);
|
||||
|
||||
/* Close Dataset */
|
||||
ret = H5Dclose(dataset);
|
||||
assert(ret>=0);
|
||||
ret = H5Tclose(tid2);
|
||||
assert(ret>=0);
|
||||
ret = H5Tclose(tid1);
|
||||
assert(ret>=0);
|
||||
ret = H5Sclose(sid1);
|
||||
assert(ret>=0);
|
||||
ret = H5Fclose(fid1);
|
||||
assert(ret>=0);
|
||||
|
||||
}
|
||||
|
||||
@ -2003,8 +2023,6 @@ static void test_vldatatypes3(void)
|
||||
uintn i,j; /* counting variables */
|
||||
herr_t ret; /* Generic return value */
|
||||
|
||||
ret = ret; /* so that compiler won't complain "is set but never used" */
|
||||
|
||||
/* Allocate and initialize VL data to write */
|
||||
for(i=0; i<SPACE1_DIM1; i++) {
|
||||
wdata[i].i=i*10;
|
||||
@ -2029,24 +2047,34 @@ static void test_vldatatypes3(void)
|
||||
|
||||
/* Insert fields */
|
||||
ret=H5Tinsert(tid2, "i", HOFFSET(s1, i), H5T_NATIVE_INT);
|
||||
assert(ret>=0);
|
||||
ret=H5Tinsert(tid2, "f", HOFFSET(s1, f), H5T_NATIVE_FLOAT);
|
||||
assert(ret>=0);
|
||||
ret=H5Tinsert(tid2, "v", HOFFSET(s1, v), tid1);
|
||||
assert(ret>=0);
|
||||
|
||||
/* Create a dataset */
|
||||
dataset=H5Dcreate(fid1,"Dataset1",tid2,sid1,H5P_DEFAULT);
|
||||
|
||||
/* Write dataset to disk */
|
||||
ret=H5Dwrite(dataset,tid2,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata);
|
||||
assert(ret>=0);
|
||||
|
||||
/* Reclaim the write VL data */
|
||||
ret=H5Dvlen_reclaim(tid2,sid1,H5P_DEFAULT,wdata);
|
||||
assert(ret>=0);
|
||||
|
||||
/* Close Dataset */
|
||||
ret = H5Dclose(dataset);
|
||||
assert(ret>=0);
|
||||
ret = H5Tclose(tid2);
|
||||
assert(ret>=0);
|
||||
ret = H5Tclose(tid1);
|
||||
assert(ret>=0);
|
||||
ret = H5Sclose(sid1);
|
||||
assert(ret>=0);
|
||||
ret = H5Fclose(fid1);
|
||||
assert(ret>=0);
|
||||
}
|
||||
|
||||
static void test_vldatatypes4(void)
|
||||
@ -2064,8 +2092,6 @@ static void test_vldatatypes4(void)
|
||||
uintn i,j; /* counting variables */
|
||||
herr_t ret; /* Generic return value */
|
||||
|
||||
ret = ret; /* so that compiler won't complain "is set but never used" */
|
||||
|
||||
/* Allocate and initialize VL data to write */
|
||||
for(i=0; i<SPACE1_DIM1; i++) {
|
||||
wdata[i].p=malloc((i+1)*sizeof(s1));
|
||||
@ -2087,7 +2113,9 @@ static void test_vldatatypes4(void)
|
||||
|
||||
/* Insert fields */
|
||||
ret=H5Tinsert(tid2, "i", HOFFSET(s1, i), H5T_NATIVE_INT);
|
||||
assert(ret>=0);
|
||||
ret=H5Tinsert(tid2, "f", HOFFSET(s1, f), H5T_NATIVE_FLOAT);
|
||||
assert(ret>=0);
|
||||
|
||||
/* Create a datatype to refer to */
|
||||
tid1 = H5Tvlen_create (tid2);
|
||||
@ -2097,16 +2125,23 @@ static void test_vldatatypes4(void)
|
||||
|
||||
/* Write dataset to disk */
|
||||
ret=H5Dwrite(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata);
|
||||
assert(ret>=0);
|
||||
|
||||
/* Reclaim the write VL data */
|
||||
ret=H5Dvlen_reclaim(tid1,sid1,H5P_DEFAULT,wdata);
|
||||
assert(ret>=0);
|
||||
|
||||
/* Close Dataset */
|
||||
ret = H5Dclose(dataset);
|
||||
assert(ret>=0);
|
||||
ret = H5Tclose(tid1);
|
||||
assert(ret>=0);
|
||||
ret = H5Tclose(tid2);
|
||||
assert(ret>=0);
|
||||
ret = H5Sclose(sid1);
|
||||
assert(ret>=0);
|
||||
ret = H5Fclose(fid1);
|
||||
assert(ret>=0);
|
||||
}
|
||||
|
||||
static void test_array1(void)
|
||||
@ -2140,12 +2175,17 @@ static void test_array1(void)
|
||||
|
||||
/* Write dataset to disk */
|
||||
ret=H5Dwrite(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata);
|
||||
assert(ret>=0);
|
||||
|
||||
/* Close Dataset */
|
||||
ret = H5Dclose(dataset);
|
||||
assert(ret>=0);
|
||||
ret = H5Tclose(tid1);
|
||||
assert(ret>=0);
|
||||
ret = H5Sclose(sid1);
|
||||
assert(ret>=0);
|
||||
ret = H5Fclose(fid1);
|
||||
assert(ret>=0);
|
||||
}
|
||||
|
||||
static void test_array2(void)
|
||||
@ -2181,12 +2221,17 @@ static void test_array2(void)
|
||||
|
||||
/* Write dataset to disk */
|
||||
ret=H5Dwrite(dataset,tid,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata);
|
||||
assert(ret>=0);
|
||||
|
||||
/* Close Dataset */
|
||||
ret = H5Dclose(dataset);
|
||||
assert(ret>=0);
|
||||
ret = H5Tclose(tid);
|
||||
assert(ret>=0);
|
||||
ret = H5Sclose(sid);
|
||||
assert(ret>=0);
|
||||
ret = H5Fclose(fid);
|
||||
assert(ret>=0);
|
||||
}
|
||||
|
||||
static void test_array3(void)
|
||||
@ -2227,13 +2272,19 @@ static void test_array3(void)
|
||||
|
||||
/* Write dataset to disk */
|
||||
ret=H5Dwrite(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata);
|
||||
assert(ret>=0);
|
||||
|
||||
/* Close Dataset */
|
||||
ret = H5Dclose(dataset);
|
||||
assert(ret>=0);
|
||||
ret = H5Tclose(tid1);
|
||||
assert(ret>=0);
|
||||
ret = H5Tclose(tid2);
|
||||
assert(ret>=0);
|
||||
ret = H5Sclose(sid);
|
||||
assert(ret>=0);
|
||||
ret = H5Fclose(fid);
|
||||
assert(ret>=0);
|
||||
}
|
||||
|
||||
static void test_array4(void)
|
||||
@ -2271,27 +2322,35 @@ static void test_array4(void)
|
||||
|
||||
/* Insert integer field */
|
||||
ret = H5Tinsert (tid2, "i", HOFFSET(s2_t,i), H5T_NATIVE_INT);
|
||||
assert(ret>=0);
|
||||
|
||||
/* Insert float field */
|
||||
ret = H5Tinsert (tid2, "f", HOFFSET(s2_t,f), H5T_NATIVE_FLOAT);
|
||||
assert(ret>=0);
|
||||
|
||||
/* Create an array datatype to refer to */
|
||||
tid1 = H5Tarray_create (tid2,ARRAY1_RANK,tdims1,NULL);
|
||||
|
||||
/* Close compound datatype */
|
||||
ret=H5Tclose(tid2);
|
||||
assert(ret>=0);
|
||||
|
||||
/* Create a dataset */
|
||||
dataset=H5Dcreate(fid1,"Dataset1",tid1,sid1,H5P_DEFAULT);
|
||||
|
||||
/* Write dataset to disk */
|
||||
ret=H5Dwrite(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata);
|
||||
assert(ret>=0);
|
||||
|
||||
/* Close Dataset */
|
||||
ret = H5Dclose(dataset);
|
||||
assert(ret>=0);
|
||||
ret = H5Tclose(tid1);
|
||||
assert(ret>=0);
|
||||
ret = H5Sclose(sid1);
|
||||
assert(ret>=0);
|
||||
ret = H5Fclose(fid1);
|
||||
assert(ret>=0);
|
||||
}
|
||||
|
||||
static void test_array5(void)
|
||||
@ -2331,33 +2390,42 @@ static void test_array5(void)
|
||||
|
||||
/* Insert integer field */
|
||||
ret = H5Tinsert (tid2, "i", HOFFSET(s2_t,i), H5T_NATIVE_INT);
|
||||
assert(ret>=0);
|
||||
|
||||
/* Create an array of floats datatype */
|
||||
tid3 = H5Tarray_create (H5T_NATIVE_FLOAT,ARRAY1_RANK,tdims1,NULL);
|
||||
|
||||
/* Insert float array field */
|
||||
ret = H5Tinsert (tid2, "f", HOFFSET(s2_t,f), tid3);
|
||||
assert(ret>=0);
|
||||
|
||||
/* Close array of floats field datatype */
|
||||
ret=H5Tclose(tid3);
|
||||
assert(ret>=0);
|
||||
|
||||
/* Create an array datatype to refer to */
|
||||
tid1 = H5Tarray_create (tid2,ARRAY1_RANK,tdims1,NULL);
|
||||
|
||||
/* Close compound datatype */
|
||||
ret=H5Tclose(tid2);
|
||||
assert(ret>=0);
|
||||
|
||||
/* Create a dataset */
|
||||
dataset=H5Dcreate(fid1,"Dataset1",tid1,sid1,H5P_DEFAULT);
|
||||
|
||||
/* Write dataset to disk */
|
||||
ret=H5Dwrite(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata);
|
||||
assert(ret>=0);
|
||||
|
||||
/* Close Dataset */
|
||||
ret = H5Dclose(dataset);
|
||||
assert(ret>=0);
|
||||
ret = H5Tclose(tid1);
|
||||
assert(ret>=0);
|
||||
ret = H5Sclose(sid1);
|
||||
assert(ret>=0);
|
||||
ret = H5Fclose(fid1);
|
||||
assert(ret>=0);
|
||||
}
|
||||
|
||||
static void test_array6(void)
|
||||
@ -2396,21 +2464,28 @@ static void test_array6(void)
|
||||
|
||||
/* Close VL datatype */
|
||||
ret=H5Tclose(tid2);
|
||||
assert(ret>=0);
|
||||
|
||||
/* Create a dataset */
|
||||
dataset=H5Dcreate(fid1,"Dataset1",tid1,sid1,H5P_DEFAULT);
|
||||
|
||||
/* Write dataset to disk */
|
||||
ret=H5Dwrite(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata);
|
||||
assert(ret>=0);
|
||||
|
||||
/* Reclaim the write VL data */
|
||||
ret=H5Dvlen_reclaim(tid1,sid1,H5P_DEFAULT,wdata);
|
||||
assert(ret>=0);
|
||||
|
||||
/* Close Dataset */
|
||||
ret = H5Dclose(dataset);
|
||||
assert(ret>=0);
|
||||
ret = H5Tclose(tid1);
|
||||
assert(ret>=0);
|
||||
ret = H5Sclose(sid1);
|
||||
assert(ret>=0);
|
||||
ret = H5Fclose(fid1);
|
||||
assert(ret>=0);
|
||||
}
|
||||
|
||||
static void test_array7(void)
|
||||
@ -2451,27 +2526,35 @@ static void test_array7(void)
|
||||
|
||||
/* Close nested array datatype */
|
||||
ret=H5Tclose(tid3);
|
||||
assert(ret>=0);
|
||||
|
||||
/* Create an array datatype to refer to */
|
||||
tid1 = H5Tarray_create (tid2,ARRAY1_RANK,tdims1,NULL);
|
||||
|
||||
/* Close VL datatype */
|
||||
ret=H5Tclose(tid2);
|
||||
assert(ret>=0);
|
||||
|
||||
/* Create a dataset */
|
||||
dataset=H5Dcreate(fid1,"Dataset1",tid1,sid1,H5P_DEFAULT);
|
||||
|
||||
/* Write dataset to disk */
|
||||
ret=H5Dwrite(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata);
|
||||
assert(ret>=0);
|
||||
|
||||
/* Reclaim the write VL data */
|
||||
ret=H5Dvlen_reclaim(tid1,sid1,H5P_DEFAULT,wdata);
|
||||
assert(ret>=0);
|
||||
|
||||
/* Close Dataset */
|
||||
ret = H5Dclose(dataset);
|
||||
assert(ret>=0);
|
||||
ret = H5Tclose(tid1);
|
||||
assert(ret>=0);
|
||||
ret = H5Sclose(sid1);
|
||||
assert(ret>=0);
|
||||
ret = H5Fclose(fid1);
|
||||
assert(ret>=0);
|
||||
}
|
||||
|
||||
static void test_empty(void)
|
||||
@ -2485,7 +2568,6 @@ static void test_empty(void)
|
||||
hsize_t dims[] = { SPACE1_DIM1 };
|
||||
herr_t ret=0;
|
||||
|
||||
ret = ret; /* so that compiler won't complain "is set but never used" */
|
||||
file = H5Fcreate(FILE32, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
|
||||
|
||||
space = H5Screate_simple(SPACE1_RANK, dims, NULL);
|
||||
@ -2495,24 +2577,30 @@ static void test_empty(void)
|
||||
dset = H5Dcreate(file, "Dataset1.0", type, space, H5P_DEFAULT);
|
||||
/* Don't write any data */
|
||||
ret = H5Dclose(dset);
|
||||
assert(ret>=0);
|
||||
ret = H5Tclose(type);
|
||||
assert(ret>=0);
|
||||
|
||||
/* write out an empty native integer dataset dataset */
|
||||
dset = H5Dcreate(file, "Dataset2.0", H5T_NATIVE_INT, space, H5P_DEFAULT);
|
||||
/* Don't write any data */
|
||||
ret = H5Dclose(dset);
|
||||
assert(ret>=0);
|
||||
|
||||
/* write out an empty native floating-point dataset dataset */
|
||||
dset = H5Dcreate(file, "Dataset3.0", H5T_NATIVE_FLOAT, space, H5P_DEFAULT);
|
||||
/* Don't write any data */
|
||||
ret = H5Dclose(dset);
|
||||
assert(ret>=0);
|
||||
|
||||
/* write out an empty array dataset */
|
||||
type = H5Tarray_create(H5T_NATIVE_INT,SPACE1_RANK,dims,NULL);
|
||||
dset = H5Dcreate(file, "Dataset4.0", type, space, H5P_DEFAULT);
|
||||
/* Don't write any data */
|
||||
ret = H5Dclose(dset);
|
||||
assert(ret>=0);
|
||||
ret = H5Tclose(type);
|
||||
assert(ret>=0);
|
||||
|
||||
/* write out an empty compound dataset */
|
||||
type = H5Tcreate(H5T_COMPOUND,sizeof(empty_struct));
|
||||
@ -2522,11 +2610,15 @@ static void test_empty(void)
|
||||
dset = H5Dcreate(file, "Dataset5.0", type, space, H5P_DEFAULT);
|
||||
/* Don't write any data */
|
||||
ret = H5Dclose(dset);
|
||||
assert(ret>=0);
|
||||
ret = H5Tclose(type);
|
||||
assert(ret>=0);
|
||||
|
||||
ret = H5Sclose(space);
|
||||
assert(ret>=0);
|
||||
|
||||
ret = H5Fclose(file);
|
||||
assert(ret>=0);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
|
@ -180,7 +180,7 @@ h5tools_fopen(const char *fname, const char *driver, char *drivername,
|
||||
SPLIT_IDX,
|
||||
MULTI_IDX,
|
||||
#ifdef H5_HAVE_STREAM
|
||||
STREAM_IDX,
|
||||
STREAM_IDX
|
||||
#endif /* H5_HAVE_STREAM */
|
||||
};
|
||||
#define NUM_DRIVERS (sizeof(drivers_list) / sizeof(struct d_list))
|
||||
|
Loading…
Reference in New Issue
Block a user