2
0
mirror of https://github.com/HDFGroup/hdf5.git synced 2025-04-24 17:51:25 +08:00

[svn-r14158] Description:

Add regression test for h5repack with userblock

Tested on:
        FreeBSD/32 6.2 (duty) in debug mode
        FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
        Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
                                in debug mode
        Linux/64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
                                in production mode
        Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
                                w/szip filter, in production mode
        AIX/32 5.3 (copper) w/FORTRAN, w/parallel, in production mode
        Mac OS X/32 10.4.10 (amazon) in debug mode
This commit is contained in:
Quincey Koziol 2007-09-27 10:18:21 -05:00
parent 8b5643ac36
commit 6dca2239bd
3 changed files with 420 additions and 221 deletions

@ -415,32 +415,22 @@ TOOLTEST $FILE4 -l COMPA
# layout conversions (file has no filters)
###############################################################
arg1="$FILE4 -l dset_compact:CONTI"
arg2="$FILE4 -l dset_compact:CHUNK=2x5"
arg3="$FILE4 -l dset_compact:COMPA"
arg4="$FILE4 -l dset_contiguous:COMPA"
arg5="$FILE4 -l dset_contiguous:CHUNK=3x6"
arg6="$FILE4 -l dset_contiguous:CONTI"
arg7="$FILE4 -l dset_chunk:COMPA"
arg8="$FILE4 -l dset_chunk:CONTI"
arg9="$FILE4 -l dset_chunk:CHUNK=18x13"
TOOLTEST $arg1
TOOLTEST $arg2
TOOLTEST $arg3
TOOLTEST $arg4
TOOLTEST $arg5
TOOLTEST $arg6
TOOLTEST $arg7
TOOLTEST $arg8
TOOLTEST $arg9
#native option
arg="$FILE1 -n"
TOOLTEST $arg
TOOLTEST $FILE4 -l dset_compact:CONTI
TOOLTEST $FILE4 -l dset_compact:CHUNK=2x5
TOOLTEST $FILE4 -l dset_compact:COMPA
TOOLTEST $FILE4 -l dset_contiguous:COMPA
TOOLTEST $FILE4 -l dset_contiguous:CHUNK=3x6
TOOLTEST $FILE4 -l dset_contiguous:CONTI
TOOLTEST $FILE4 -l dset_chunk:COMPA
TOOLTEST $FILE4 -l dset_chunk:CONTI
TOOLTEST $FILE4 -l dset_chunk:CHUNK=18x13
# Native option
TOOLTEST $FILE1 -n
if test $nerrors -eq 0 ; then
echo "All $H5REPACK tests passed."
fi
exit $nerrors

@ -33,6 +33,7 @@ extern char *progname;
if (A!=0) \
per = (double) fabs( (double)(B-A) / (double)A ); \
}
#define USERBLOCK_XFER_SIZE 512 /* Size of buffer/# of bytes to xfer at a time when copying userblock */
/*-------------------------------------------------------------------------
* local functions
@ -41,7 +42,7 @@ extern char *progname;
static void print_dataset_info(hid_t dcpl_id,char *objname,double per);
static int do_copy_objects(hid_t fidin,hid_t fidout,trav_table_t *travt,pack_opt_t *options);
static int copy_attr(hid_t loc_in,hid_t loc_out,pack_opt_t *options);
static int copy_user_block(char *infile, char *outfile, hsize_t size);
static int copy_user_block(const char *infile, const char *outfile, hsize_t size);
/*-------------------------------------------------------------------------
* Function: copy_objects
@ -69,167 +70,196 @@ int copy_objects(const char* fnamein,
const char* fnameout,
pack_opt_t *options)
{
hid_t fidin;
hid_t fidout=-1;
trav_table_t *travt=NULL;
hsize_t ub_size=0; /* Size of user block */
hid_t fapl=H5P_DEFAULT; /* File access property list ID */
hid_t fcpl=H5P_DEFAULT; /* File creation property list ID */
hid_t fidin;
hid_t fidout = -1;
trav_table_t *travt = NULL;
hsize_t ub_size = 0; /* Size of user block */
hid_t fapl = H5P_DEFAULT; /* File access property list ID */
hid_t fcpl = H5P_DEFAULT; /* File creation property list ID */
/*-------------------------------------------------------------------------
* open the files
*-------------------------------------------------------------------------
*/
if ((fidin=h5tools_fopen(fnamein, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, 0))<0 ){
error_msg(progname, "<%s>: %s\n", fnamein, H5FOPENERROR );
goto out;
}
/* get user block size */
{
hid_t fcpl_in = H5Fget_create_plist(fidin);
H5Pget_userblock(fcpl_in, &ub_size);
if (fcpl_in != H5P_DEFAULT)
H5Pclose(fcpl_in);
}
if (options->latest || ub_size>=512) {
/* Create file creation property list */
if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0){
error_msg(progname, "fail to create a file creation property list\n");
goto out;
}
}
if (ub_size>=512) {
H5Pset_userblock(fcpl, ub_size);
}
if (options->latest) {
unsigned i=0, nindex=0, mesg_type_flags[5], min_mesg_sizes[5];
/* Adjust group creation parameters for root group */
/* (So that it is created in "dense storage" form) */
if(H5Pset_link_phase_change(fcpl, (unsigned)options->grp_compact, (unsigned)options->grp_indexed) < 0) {
error_msg(progname, "fail to adjust group creation parameters for root group\n");
/*-------------------------------------------------------------------------
* open the files
*-------------------------------------------------------------------------
*/
if((fidin = h5tools_fopen(fnamein, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t)0)) < 0) {
error_msg(progname, "<%s>: %s\n", fnamein, H5FOPENERROR );
goto out;
}
for (i=0; i<5; i++) {
if (options->msg_size[i]>0) {
switch (i) {
case 0: mesg_type_flags[nindex]=H5O_MESG_SDSPACE_FLAG; break;
case 1: mesg_type_flags[nindex]=H5O_MESG_DTYPE_FLAG; break;
case 2: mesg_type_flags[nindex]=H5O_MESG_FILL_FLAG; break;
case 3: mesg_type_flags[nindex]=H5O_MESG_PLINE_FLAG; break;
case 4: mesg_type_flags[nindex]=H5O_MESG_ATTR_FLAG; break;
}
min_mesg_sizes[nindex] = (unsigned)options->msg_size[i];
/* get user block size */
{
hid_t fcpl_in; /* File creation property list ID for input file */
nindex++;
}
}
if((fcpl_in = H5Fget_create_plist(fidin)) < 0) {
error_msg(progname, "failed to retrieve file creation property list\n");
goto out;
} /* end if */
if (nindex>0) {
nindex++; /* add one for default size */
if (H5Pset_shared_mesg_nindexes(fcpl, nindex) < 0) {
error_msg(progname, "fail to set the number of shared object header message indexes\n");
goto out;
}
/* msg_size[0]=dataspace, 1=datatype, 2=file value, 3=filter pipleline, 4=attribute */
for (i=0; i<nindex-1; i++) {
if (H5Pset_shared_mesg_index(fcpl, i, mesg_type_flags[i], min_mesg_sizes[i])<0) {
error_msg(progname, "fail to configure the specified shared object header message index\n");
goto out;
}
}
} /* if (nindex>0) */
if(H5Pget_userblock(fcpl_in, &ub_size) < 0) {
error_msg(progname, "failed to retrieve userblock size\n");
goto out;
} /* end if */
/* Create file access property list */
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) {
error_msg(progname, "Could not create file access property list\n");
if(H5Pclose(fcpl_in) < 0) {
error_msg(progname, "failed to close property list\n");
goto out;
} /* end if */
} /* end block */
/* Check if we need to create a non-default file creation property list */
if(options->latest || ub_size > 0) {
/* Create file creation property list */
if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) {
error_msg(progname, "fail to create a file creation property list\n");
goto out;
} /* end if */
if(ub_size > 0)
if(H5Pset_userblock(fcpl, ub_size) < 0) {
error_msg(progname, "failed to set non-default userblock size\n");
goto out;
} /* end if */
if(options->latest) {
unsigned i = 0, nindex = 0, mesg_type_flags[5], min_mesg_sizes[5];
/* Adjust group creation parameters for root group */
/* (So that it is created in "dense storage" form) */
if(H5Pset_link_phase_change(fcpl, (unsigned)options->grp_compact, (unsigned)options->grp_indexed) < 0) {
error_msg(progname, "fail to adjust group creation parameters for root group\n");
goto out;
} /* end if */
for(i = 0; i < 5; i++) {
if(options->msg_size[i] > 0) {
switch(i) {
case 0:
mesg_type_flags[nindex] = H5O_MESG_SDSPACE_FLAG;
break;
case 1:
mesg_type_flags[nindex] = H5O_MESG_DTYPE_FLAG;
break;
case 2:
mesg_type_flags[nindex] = H5O_MESG_FILL_FLAG;
break;
case 3:
mesg_type_flags[nindex] = H5O_MESG_PLINE_FLAG;
break;
case 4:
mesg_type_flags[nindex] = H5O_MESG_ATTR_FLAG;
break;
} /* end switch */
min_mesg_sizes[nindex] = (unsigned)options->msg_size[i];
nindex++;
} /* end if */
} /* end for */
if(nindex > 0) {
if(H5Pset_shared_mesg_nindexes(fcpl, nindex) < 0) {
error_msg(progname, "fail to set the number of shared object header message indexes\n");
goto out;
} /* end if */
/* msg_size[0]=dataspace, 1=datatype, 2=file value, 3=filter pipleline, 4=attribute */
for(i = 0; i < (nindex - 1); i++) {
if(H5Pset_shared_mesg_index(fcpl, i, mesg_type_flags[i], min_mesg_sizes[i]) < 0) {
error_msg(progname, "fail to configure the specified shared object header message index\n");
goto out;
} /* end if */
} /* end for */
} /* if (nindex>0) */
/* Create file access property list */
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) {
error_msg(progname, "Could not create file access property list\n");
goto out;
} /* end if */
if(H5Pset_latest_format(fapl, TRUE) < 0) {
error_msg(progname, "Could not set property for using latest version of the format\n");
goto out;
} /* end if */
} /* end if */
} /* end if */
if((fidout = H5Fcreate(fnameout,H5F_ACC_TRUNC, fcpl, fapl)) < 0) {
error_msg(progname, "<%s>: Could not create file\n", fnameout );
goto out;
} /* end if */
if(H5Pset_latest_format(fapl, TRUE) < 0) {
error_msg(progname, "Could not set property for using latest version of the format\n");
if(options->verbose)
printf("Making file <%s>...\n",fnameout);
/* init table */
trav_table_init(&travt);
/* get the list of objects in the file */
if(h5trav_gettable(fidin, travt) < 0)
goto out;
/*-------------------------------------------------------------------------
* do the copy
*-------------------------------------------------------------------------
*/
if(do_copy_objects(fidin, fidout, travt, options) < 0) {
error_msg(progname, "<%s>: Could not copy data to: %s\n", fnamein, fnameout);
goto out;
} /* end if */
}
if ((fidout=H5Fcreate(fnameout,H5F_ACC_TRUNC, fcpl, fapl))<0 ){
error_msg(progname, "<%s>: Could not create file\n", fnameout );
goto out;
}
/*-------------------------------------------------------------------------
* do the copy of referenced objects
* and create hard links
*-------------------------------------------------------------------------
*/
if(do_copy_refobjs(fidin, fidout, travt, options) < 0) {
printf("h5repack: <%s>: Could not copy data to: %s\n", fnamein, fnameout);
goto out;
} /* end if */
if (options->verbose)
printf("Making file <%s>...\n",fnameout);
/* init table */
trav_table_init(&travt);
/* get the list of objects in the file */
if (h5trav_gettable(fidin,travt)<0)
goto out;
/*-------------------------------------------------------------------------
* do the copy
*-------------------------------------------------------------------------
*/
if(do_copy_objects(fidin,fidout,travt,options)<0) {
error_msg(progname, "<%s>: Could not copy data to: %s\n", fnamein, fnameout);
goto out;
}
/*-------------------------------------------------------------------------
* do the copy of referenced objects
* and create hard links
*-------------------------------------------------------------------------
*/
if(do_copy_refobjs(fidin,fidout,travt,options)<0) {
printf("h5repack: <%s>: Could not copy data to: %s\n", fnamein, fnameout);
goto out;
}
/* free table */
trav_table_free(travt);
/* free table */
trav_table_free(travt);
/*-------------------------------------------------------------------------
* close
*-------------------------------------------------------------------------
*/
/*-------------------------------------------------------------------------
* close
*-------------------------------------------------------------------------
*/
if (fapl>0)
H5Pclose(fapl);
if(fapl > 0)
H5Pclose(fapl);
if (fcpl>0)
H5Pclose(fcpl);
if(fcpl > 0)
H5Pclose(fcpl);
H5Fclose(fidin);
H5Fclose(fidout);
H5Fclose(fidin);
H5Fclose(fidout);
if (ub_size >= 512)
copy_user_block(fnamein, fnameout, ub_size);
if(ub_size > 0)
copy_user_block(fnamein, fnameout, ub_size);
return 0;
return 0;
/*-------------------------------------------------------------------------
* out
*-------------------------------------------------------------------------
*/
/*-------------------------------------------------------------------------
* out
*-------------------------------------------------------------------------
*/
out:
H5E_BEGIN_TRY {
H5Pclose(fapl);
H5Pclose(fcpl);
H5Fclose(fidin);
H5Fclose(fidout);
} H5E_END_TRY;
if (travt)
trav_table_free(travt);
H5E_BEGIN_TRY {
H5Pclose(fapl);
H5Pclose(fcpl);
H5Fclose(fidin);
H5Fclose(fidout);
} H5E_END_TRY;
if(travt)
trav_table_free(travt);
return -1;
return -1;
}
/*-------------------------------------------------------------------------
@ -892,7 +922,7 @@ int copy_attr(hid_t loc_in,
goto error;
/* get name */
if (H5Aget_name( attr_id, 255, name )<0)
if (H5Aget_name( attr_id, (size_t)255, name )<0)
goto error;
/* get the file datatype */
@ -938,7 +968,7 @@ int copy_attr(hid_t loc_in,
*-------------------------------------------------------------------------
*/
buf=(void *) HDmalloc((unsigned)(nelmts*msize));
buf=(void *) HDmalloc((size_t)(nelmts*msize));
if ( buf==NULL){
error_msg(progname, "cannot read into memory\n" );
goto error;
@ -1104,7 +1134,7 @@ static void print_dataset_info(hid_t dcpl_id,
} /* switch */
}/*i*/
if (strcmp(strfilter,"\0")==0)
if(*strfilter == '\0')
printf(FORMAT_OBJ,"dset",objname );
else
{
@ -1130,51 +1160,74 @@ static void print_dataset_info(hid_t dcpl_id,
*
*-------------------------------------------------------------------------
*/
static int copy_user_block(char *infile, char *outfile, hsize_t size)
static int
copy_user_block(const char *infile, const char *outfile, hsize_t size)
{
int infid=-1, outfid=-1, status=0;
off_t offset;
ssize_t how_much_left = (ssize_t)size;
ssize_t nchars;
char buf[512];
int infid = -1, outfid = -1; /* File descriptors */
int status = 0; /* Return value */
/* User block must be any power of 2 equal to 512 or greater (512, 1024, 2048, etc.) */
if (size<512)
return 0;
assert(size > 0);
if ((infid = HDopen(infile,O_RDONLY,0)) < 0) {
/* Open files */
if((infid = HDopen(infile, O_RDONLY, 0)) < 0) {
status = -1;
goto done;
}
if((outfid = HDopen(outfile, O_WRONLY, 0644)) < 0) {
status = -1;
goto done;
}
/* Copy the userblock from the input file to the output file */
while(size > 0) {
ssize_t nread, nbytes; /* # of bytes transfered, etc. */
char rbuf[USERBLOCK_XFER_SIZE]; /* Buffer for reading */
const char *wbuf; /* Pointer into buffer, for writing */
if ((outfid = HDopen(outfile,O_WRONLY,0644)) < 0) {
status = -1;
goto done;
}
offset = 0;
while (how_much_left > 0) {
HDlseek(infid,offset,SEEK_SET);
if (how_much_left > 512)
nchars = HDread(infid,buf,(unsigned)512);
/* Read buffer from source file */
if(size > USERBLOCK_XFER_SIZE)
nread = HDread(infid, rbuf, (size_t)USERBLOCK_XFER_SIZE);
else
nchars = HDread(infid,buf,(unsigned)how_much_left);
HDlseek(outfid, offset, SEEK_SET);
HDwrite(outfid, buf, (unsigned)nchars);
how_much_left -= nchars;
offset += nchars;
}
nread = HDread(infid, rbuf, (size_t)size);
if(nread < 0) {
status = -1;
goto done;
} /* end if */
/* Write buffer to destination file */
/* (compensating for interrupted writes & checking for errors, etc.) */
nbytes = nread;
wbuf = rbuf;
while(nbytes > 0) {
ssize_t nwritten; /* # of bytes written */
do {
nwritten = HDwrite(outfid, wbuf, (size_t)nbytes);
} while(-1 == nwritten && EINTR == errno);
if(-1 == nwritten) { /* error */
status = -1;
goto done;
} /* end if */
assert(nwritten > 0);
assert(nwritten <= nbytes);
/* Update # of bytes left & offset in buffer */
nbytes -= nwritten;
wbuf += nwritten;
assert(nbytes == 0 || wbuf < (rbuf + USERBLOCK_XFER_SIZE));
} /* end while */
/* Update size of userblock left to transfer */
size -= nread;
} /* end while */
done:
if (infid > 0)
close(infid);
if (outfid > 0)
close (outfid);
if(infid > 0)
HDclose(infid);
if(outfid > 0)
HDclose(outfid);
return status;
}

@ -67,6 +67,9 @@
/* external file */
#define FNAME15 "h5repack_ext.h5"
#define FNAME15OUT "h5repack_ext_out.h5"
/* File w/userblock */
#define FNAME16 "h5repack_ub.h5"
#define FNAME16OUT "h5repack_ub_out.h5"
const char *H5REPACK_FILENAMES[] = {
@ -88,6 +91,9 @@ int d_status = EXIT_SUCCESS;
#define RANK 2
#define GBLL ((unsigned long_long) 1024*1024*1024)
/* Size of userblock (for userblock test) */
#define USERBLOCK_SIZE 2048
/*-------------------------------------------------------------------------
* prototypes
*-------------------------------------------------------------------------
@ -116,6 +122,8 @@ int make_dset(hid_t loc_id,const char *name,hid_t sid,hid_t dcpl,void *buf);
int make_attr(hid_t loc_id,int rank,hsize_t *dims,const char *attr_name,hid_t type_id,void *buf);
void make_dset_reg_ref(hid_t loc_id);
int make_external(hid_t loc_id);
static int make_userblock(void);
static int verify_userblock(void);
/*-------------------------------------------------------------------------
@ -1301,6 +1309,25 @@ if (szip_can_encode) {
GOERROR;
PASSED();
/*-------------------------------------------------------------------------
* test file with userblock
*-------------------------------------------------------------------------
*/
TESTING(" file with userblock");
if(h5repack_init(&pack_options, 0) < 0)
GOERROR;
if(h5repack(FNAME16, FNAME16OUT, &pack_options) < 0)
GOERROR;
if(h5diff(FNAME16, FNAME16OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
if(h5repack_verify(FNAME16OUT, &pack_options) <= 0)
GOERROR;
if(verify_userblock() < 0)
GOERROR;
if(h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
/*-------------------------------------------------------------------------
* test --latest options
*-------------------------------------------------------------------------
@ -1526,6 +1553,13 @@ int make_testfiles(void)
if(H5Fclose(loc_id)<0)
return -1;
/*-------------------------------------------------------------------------
* create a file with userblock
*-------------------------------------------------------------------------
*/
if(make_userblock() < 0)
goto out;
return 0;
out:
@ -2747,6 +2781,137 @@ out:
}
/*-------------------------------------------------------------------------
* Function: make_userblock
*
* Purpose: create a file for the userblock copying test
*
*-------------------------------------------------------------------------
*/
static int
make_userblock(void)
{
hid_t fid = -1;
hid_t fcpl = -1;
int fd = -1; /* File descriptor for writing userblock */
char ub[USERBLOCK_SIZE]; /* User block data */
ssize_t nwritten; /* # of bytes written */
size_t u; /* Local index variable */
/* Create file creation property list with userblock set */
if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
goto out;
if(H5Pset_userblock(fcpl, (hsize_t)USERBLOCK_SIZE) < 0)
goto out;
/* Create file with userblock */
if((fid = H5Fcreate(FNAME16, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0)
goto out;
if(H5Fclose(fid) < 0)
goto out;
/* Close file creation property list */
if(H5Pclose(fcpl) < 0)
goto out;
/* Initialize userblock data */
for(u = 0; u < USERBLOCK_SIZE; u++)
ub[u] = 'a' + (u % 26);
/* Re-open HDF5 file, as "plain" file */
if((fd = HDopen(FNAME16, O_WRONLY, 0644)) < 0)
goto out;
/* Write userblock data */
nwritten = HDwrite(fd, ub, (size_t)USERBLOCK_SIZE);
assert(nwritten == USERBLOCK_SIZE);
/* Close file */
HDclose(fd);
return 0;
out:
H5E_BEGIN_TRY {
H5Pclose(fcpl);
H5Fclose(fid);
} H5E_END_TRY;
if(fd > 0)
HDclose(fd);
return -1;
} /* end make_userblock() */
/*-------------------------------------------------------------------------
* Function: verify_userblock
*
* Purpose: Verify that the userblock was copied correctly
*
*-------------------------------------------------------------------------
*/
static int
verify_userblock(void)
{
hid_t fid = -1;
hid_t fcpl = -1;
int fd = -1; /* File descriptor for writing userblock */
char ub[USERBLOCK_SIZE]; /* User block data */
hsize_t ub_size = 0; /* User block size */
ssize_t nread; /* # of bytes read */
size_t u; /* Local index variable */
/* Open file with userblock */
if((fid = H5Fopen(FNAME16OUT, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
goto out;
/* Retrieve file creation property list & userblock size */
if((fcpl = H5Fget_create_plist(fid)) < 0)
goto out;
if(H5Pget_userblock(fcpl, &ub_size) < 0)
goto out;
/* Verify userblock size is correct */
if(ub_size != USERBLOCK_SIZE)
goto out;
/* Close file creation property list */
if(H5Pclose(fcpl) < 0)
goto out;
if(H5Fclose(fid) < 0)
goto out;
/* Re-open HDF5 file, as "plain" file */
if((fd = HDopen(FNAME16, O_RDONLY, 0)) < 0)
goto out;
/* Read userblock data */
nread = HDread(fd, ub, (size_t)USERBLOCK_SIZE);
assert(nread == USERBLOCK_SIZE);
/* Verify userblock data */
for(u = 0; u < USERBLOCK_SIZE; u++)
if(ub[u] != (char)('a' + (u % 26)))
goto out;
/* Close file */
HDclose(fd);
return 0;
out:
H5E_BEGIN_TRY {
H5Pclose(fcpl);
H5Fclose(fid);
} H5E_END_TRY;
if(fd > 0)
HDclose(fd);
return -1;
} /* end verify_userblock() */
/*-------------------------------------------------------------------------
* Function: write_dset_in
@ -2850,7 +3015,7 @@ void write_dset_in(hid_t loc_id,
type_id = H5Tcopy(H5T_C_S1);
status = H5Tset_size(type_id, 2);
status = H5Tset_size(type_id, (size_t)2);
write_dset(loc_id,1,dims,"string",type_id,buf1);
status = H5Tclose(type_id);
@ -2886,7 +3051,7 @@ void write_dset_in(hid_t loc_id,
}
}
type_id = H5Tcreate(H5T_OPAQUE, 1);
type_id = H5Tcreate(H5T_OPAQUE, (size_t)1);
status = H5Tset_tag(type_id, "1-byte opaque type"); /* must set this */
write_dset(loc_id,1,dims,"opaque",type_id,buf2);
status = H5Tclose(type_id);
@ -3024,7 +3189,7 @@ void write_dset_in(hid_t loc_id,
type_id = H5Tcopy(H5T_C_S1);
status = H5Tset_size(type_id, 2);
status = H5Tset_size(type_id, (size_t)2);
write_dset(loc_id,2,dims2,"string2D",type_id,buf12);
status = H5Tclose(type_id);
@ -3047,7 +3212,7 @@ void write_dset_in(hid_t loc_id,
* H5T_OPAQUE
*-------------------------------------------------------------------------
*/
type_id = H5Tcreate(H5T_OPAQUE, 1);
type_id = H5Tcreate(H5T_OPAQUE, (size_t)1);
status = H5Tset_tag(type_id, "1-byte opaque type"); /* must set this */
write_dset(loc_id,2,dims2,"opaque2D",type_id,buf22);
status = H5Tclose(type_id);
@ -3075,12 +3240,8 @@ void write_dset_in(hid_t loc_id,
/* Create references to dataset */
if (dset_name)
{
for (i = 0; i < 1; i++) {
for (j = 0; j < 1; j++) {
status=H5Rcreate(&buf42[i][j],file_id,dset_name,H5R_OBJECT,-1);
}
}
write_dset(loc_id,2,dims2r,"refobj2D",H5T_STD_REF_OBJ,buf42);
status = H5Rcreate(&buf42[0][0], file_id, dset_name, H5R_OBJECT, -1);
write_dset(loc_id, 2, dims2r, "refobj2D", H5T_STD_REF_OBJ, buf42);
}
/*-------------------------------------------------------------------------
@ -3183,7 +3344,7 @@ void write_dset_in(hid_t loc_id,
}
type_id = H5Tcopy(H5T_C_S1);
status = H5Tset_size(type_id, 2);
status = H5Tset_size(type_id, (size_t)2);
write_dset(loc_id,3,dims3,"string3D",type_id,buf13);
status = H5Tclose(type_id);
@ -3212,7 +3373,7 @@ void write_dset_in(hid_t loc_id,
* H5T_OPAQUE
*-------------------------------------------------------------------------
*/
type_id = H5Tcreate(H5T_OPAQUE, 1);
type_id = H5Tcreate(H5T_OPAQUE, (size_t)1);
status = H5Tset_tag(type_id, "1-byte opaque type"); /* must set this */
write_dset(loc_id,3,dims3,"opaque3D",type_id,buf23);
status = H5Tclose(type_id);
@ -3252,13 +3413,8 @@ void write_dset_in(hid_t loc_id,
/* Create references to dataset */
if (dset_name)
{
for (i = 0; i < 1; i++) {
for (j = 0; j < 1; j++) {
for (k = 0; k < 1; k++)
status=H5Rcreate(&buf43[i][j][k],file_id,dset_name,H5R_OBJECT,-1);
}
}
write_dset(loc_id,3,dims3r,"refobj3D",H5T_STD_REF_OBJ,buf43);
status = H5Rcreate(&buf43[0][0][0], file_id, dset_name, H5R_OBJECT, -1);
write_dset(loc_id, 3, dims3r, "refobj3D", H5T_STD_REF_OBJ, buf43);
}
/*-------------------------------------------------------------------------
@ -3379,8 +3535,8 @@ void make_dset_reg_ref(hid_t loc_id)
herr_t ret; /* Generic return value */
/* Allocate write & read buffers */
wbuf=calloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1);
dwbuf=malloc(sizeof(int)*SPACE2_DIM1*SPACE2_DIM2);
wbuf=(hdset_reg_ref_t *)calloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1);
dwbuf=(int *)malloc(sizeof(int)*SPACE2_DIM1*SPACE2_DIM2);
/* Create dataspace for datasets */
sid2 = H5Screate_simple(SPACE2_RANK, dims2, NULL);
@ -3536,7 +3692,7 @@ void write_attr_in(hid_t loc_id,
[ 1 ] e z
*/
type_id = H5Tcopy(H5T_C_S1);
status = H5Tset_size(type_id, 2);
status = H5Tset_size(type_id, (size_t)2);
make_attr(loc_id,1,dims,"string",type_id,buf1);
status = H5Tclose(type_id);
@ -3583,7 +3739,7 @@ void write_attr_in(hid_t loc_id,
[ 1 ] 2 0 2
*/
type_id = H5Tcreate(H5T_OPAQUE, 1);
type_id = H5Tcreate(H5T_OPAQUE, (size_t)1);
status = H5Tset_tag(type_id, "1-byte opaque type"); /* must set this */
make_attr(loc_id,1,dims,"opaque",type_id,buf2);
status = H5Tclose(type_id);
@ -3799,7 +3955,7 @@ position array of </g1> array of </g1> difference
*/
type_id = H5Tcopy(H5T_C_S1);
status = H5Tset_size(type_id, 2);
status = H5Tset_size(type_id, (size_t)2);
make_attr(loc_id,2,dims2,"string2D",type_id,buf12);
status = H5Tclose(type_id);
@ -3850,7 +4006,7 @@ position array of </g1> array of </g1> difference
[ 2 0 ] 5 0 5
[ 2 1 ] 6 0 6
*/
type_id = H5Tcreate(H5T_OPAQUE, 1);
type_id = H5Tcreate(H5T_OPAQUE, (size_t)1);
status = H5Tset_tag(type_id, "1-byte opaque type"); /* must set this */
make_attr(loc_id,2,dims2,"opaque2D",type_id,buf22);
status = H5Tclose(type_id);
@ -4121,7 +4277,7 @@ position string3D of </g1> string3D of </g1> difference
*/
type_id = H5Tcopy(H5T_C_S1);
status = H5Tset_size(type_id, 2);
status = H5Tset_size(type_id, (size_t)2);
make_attr(loc_id,3,dims3,"string3D",type_id,buf13);
status = H5Tclose(type_id);
@ -4177,7 +4333,7 @@ position bitfield3D of </g1> bitfield3D of </g1> difference
* H5T_OPAQUE
*-------------------------------------------------------------------------
*/
type_id = H5Tcreate(H5T_OPAQUE, 1);
type_id = H5Tcreate(H5T_OPAQUE, (size_t)1);
status = H5Tset_tag(type_id, "1-byte opaque type"); /* must set this */
make_attr(loc_id,3,dims3,"opaque3D",type_id,buf23);
status = H5Tclose(type_id);