mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-03-19 16:50:46 +08:00
[svn-r27806] Fix property list serialization for values encoded by H5Pset_chunk_cache to be
compatible between 32 and 64 bit systems. Expand cross platform property list encode/decode testing. Fix warning in H5P__fill_value_enc. Tested: jam, koala, ostrich (h5committest), ummon
This commit is contained in:
parent
52ac462e7c
commit
d23cc2da70
122
MANIFEST
122
MANIFEST
@ -855,7 +855,7 @@
|
||||
./test/earray.c
|
||||
./test/efc.c
|
||||
./test/enc_dec_plist.c
|
||||
./test/enc_dec_plist_with_endianess.c
|
||||
./test/enc_dec_plist_cross_platform.c
|
||||
./test/enum.c
|
||||
./test/extend.c
|
||||
./test/external.c
|
||||
@ -994,30 +994,102 @@
|
||||
./test/testfiles/error_test_1
|
||||
./test/testfiles/error_test_2
|
||||
./test/testfiles/links_env.out
|
||||
./test/testfiles/plist_files/acpl_be
|
||||
./test/testfiles/plist_files/acpl_le
|
||||
./test/testfiles/plist_files/dapl_be
|
||||
./test/testfiles/plist_files/dapl_le
|
||||
./test/testfiles/plist_files/dcpl_be
|
||||
./test/testfiles/plist_files/dcpl_le
|
||||
./test/testfiles/plist_files/dxpl_be
|
||||
./test/testfiles/plist_files/dxpl_le
|
||||
./test/testfiles/plist_files/fapl_be
|
||||
./test/testfiles/plist_files/fapl_le
|
||||
./test/testfiles/plist_files/fcpl_be
|
||||
./test/testfiles/plist_files/fcpl_le
|
||||
./test/testfiles/plist_files/gcpl_be
|
||||
./test/testfiles/plist_files/gcpl_le
|
||||
./test/testfiles/plist_files/lapl_be
|
||||
./test/testfiles/plist_files/lapl_le
|
||||
./test/testfiles/plist_files/lcpl_be
|
||||
./test/testfiles/plist_files/lcpl_le
|
||||
./test/testfiles/plist_files/ocpl_be
|
||||
./test/testfiles/plist_files/ocpl_le
|
||||
./test/testfiles/plist_files/ocpypl_be
|
||||
./test/testfiles/plist_files/ocpypl_le
|
||||
./test/testfiles/plist_files/strcpl_be
|
||||
./test/testfiles/plist_files/strcpl_le
|
||||
./test/testfiles/plist_files/acpl_32be
|
||||
./test/testfiles/plist_files/acpl_32le
|
||||
./test/testfiles/plist_files/acpl_64be
|
||||
./test/testfiles/plist_files/acpl_64le
|
||||
./test/testfiles/plist_files/dapl_32be
|
||||
./test/testfiles/plist_files/dapl_32le
|
||||
./test/testfiles/plist_files/dapl_64be
|
||||
./test/testfiles/plist_files/dapl_64le
|
||||
./test/testfiles/plist_files/dcpl_32be
|
||||
./test/testfiles/plist_files/dcpl_32le
|
||||
./test/testfiles/plist_files/dcpl_64be
|
||||
./test/testfiles/plist_files/dcpl_64le
|
||||
./test/testfiles/plist_files/def_acpl_32be
|
||||
./test/testfiles/plist_files/def_acpl_32le
|
||||
./test/testfiles/plist_files/def_acpl_64be
|
||||
./test/testfiles/plist_files/def_acpl_64le
|
||||
./test/testfiles/plist_files/def_dapl_32be
|
||||
./test/testfiles/plist_files/def_dapl_32le
|
||||
./test/testfiles/plist_files/def_dapl_64be
|
||||
./test/testfiles/plist_files/def_dapl_64le
|
||||
./test/testfiles/plist_files/def_dcpl_32be
|
||||
./test/testfiles/plist_files/def_dcpl_32le
|
||||
./test/testfiles/plist_files/def_dcpl_64be
|
||||
./test/testfiles/plist_files/def_dcpl_64le
|
||||
./test/testfiles/plist_files/def_dxpl_32be
|
||||
./test/testfiles/plist_files/def_dxpl_32le
|
||||
./test/testfiles/plist_files/def_dxpl_64be
|
||||
./test/testfiles/plist_files/def_dxpl_64le
|
||||
./test/testfiles/plist_files/def_fapl_32be
|
||||
./test/testfiles/plist_files/def_fapl_32le
|
||||
./test/testfiles/plist_files/def_fapl_64be
|
||||
./test/testfiles/plist_files/def_fapl_64le
|
||||
./test/testfiles/plist_files/def_fcpl_32be
|
||||
./test/testfiles/plist_files/def_fcpl_32le
|
||||
./test/testfiles/plist_files/def_fcpl_64be
|
||||
./test/testfiles/plist_files/def_fcpl_64le
|
||||
./test/testfiles/plist_files/def_gcpl_32be
|
||||
./test/testfiles/plist_files/def_gcpl_32le
|
||||
./test/testfiles/plist_files/def_gcpl_64be
|
||||
./test/testfiles/plist_files/def_gcpl_64le
|
||||
./test/testfiles/plist_files/def_lapl_32be
|
||||
./test/testfiles/plist_files/def_lapl_32le
|
||||
./test/testfiles/plist_files/def_lapl_64be
|
||||
./test/testfiles/plist_files/def_lapl_64le
|
||||
./test/testfiles/plist_files/def_lcpl_32be
|
||||
./test/testfiles/plist_files/def_lcpl_32le
|
||||
./test/testfiles/plist_files/def_lcpl_64be
|
||||
./test/testfiles/plist_files/def_lcpl_64le
|
||||
./test/testfiles/plist_files/def_ocpl_32be
|
||||
./test/testfiles/plist_files/def_ocpl_32le
|
||||
./test/testfiles/plist_files/def_ocpl_64be
|
||||
./test/testfiles/plist_files/def_ocpl_64le
|
||||
./test/testfiles/plist_files/def_ocpypl_32be
|
||||
./test/testfiles/plist_files/def_ocpypl_32le
|
||||
./test/testfiles/plist_files/def_ocpypl_64be
|
||||
./test/testfiles/plist_files/def_ocpypl_64le
|
||||
./test/testfiles/plist_files/def_strcpl_32be
|
||||
./test/testfiles/plist_files/def_strcpl_32le
|
||||
./test/testfiles/plist_files/def_strcpl_64be
|
||||
./test/testfiles/plist_files/def_strcpl_64le
|
||||
./test/testfiles/plist_files/dxpl_32be
|
||||
./test/testfiles/plist_files/dxpl_32le
|
||||
./test/testfiles/plist_files/dxpl_64be
|
||||
./test/testfiles/plist_files/dxpl_64le
|
||||
./test/testfiles/plist_files/fapl_32be
|
||||
./test/testfiles/plist_files/fapl_32le
|
||||
./test/testfiles/plist_files/fapl_64be
|
||||
./test/testfiles/plist_files/fapl_64le
|
||||
./test/testfiles/plist_files/fcpl_32be
|
||||
./test/testfiles/plist_files/fcpl_32le
|
||||
./test/testfiles/plist_files/fcpl_64be
|
||||
./test/testfiles/plist_files/fcpl_64le
|
||||
./test/testfiles/plist_files/gcpl_32be
|
||||
./test/testfiles/plist_files/gcpl_32le
|
||||
./test/testfiles/plist_files/gcpl_64be
|
||||
./test/testfiles/plist_files/gcpl_64le
|
||||
./test/testfiles/plist_files/lapl_32be
|
||||
./test/testfiles/plist_files/lapl_32le
|
||||
./test/testfiles/plist_files/lapl_64be
|
||||
./test/testfiles/plist_files/lapl_64le
|
||||
./test/testfiles/plist_files/lcpl_32be
|
||||
./test/testfiles/plist_files/lcpl_32le
|
||||
./test/testfiles/plist_files/lcpl_64be
|
||||
./test/testfiles/plist_files/lcpl_64le
|
||||
./test/testfiles/plist_files/ocpl_32be
|
||||
./test/testfiles/plist_files/ocpl_32le
|
||||
./test/testfiles/plist_files/ocpl_64be
|
||||
./test/testfiles/plist_files/ocpl_64le
|
||||
./test/testfiles/plist_files/ocpypl_32be
|
||||
./test/testfiles/plist_files/ocpypl_32le
|
||||
./test/testfiles/plist_files/ocpypl_64be
|
||||
./test/testfiles/plist_files/ocpypl_64le
|
||||
./test/testfiles/plist_files/strcpl_32be
|
||||
./test/testfiles/plist_files/strcpl_32le
|
||||
./test/testfiles/plist_files/strcpl_64be
|
||||
./test/testfiles/plist_files/strcpl_64le
|
||||
|
||||
./testpar/COPYING
|
||||
./testpar/Makefile.am
|
||||
|
234
src/H5Pdapl.c
234
src/H5Pdapl.c
@ -50,13 +50,13 @@
|
||||
/* Definitions for size of raw data chunk cache(slots) */
|
||||
#define H5D_ACS_DATA_CACHE_NUM_SLOTS_SIZE sizeof(size_t)
|
||||
#define H5D_ACS_DATA_CACHE_NUM_SLOTS_DEF H5D_CHUNK_CACHE_NSLOTS_DEFAULT
|
||||
#define H5D_ACS_DATA_CACHE_NUM_SLOTS_ENC H5P__encode_size_t
|
||||
#define H5D_ACS_DATA_CACHE_NUM_SLOTS_DEC H5P__decode_size_t
|
||||
#define H5D_ACS_DATA_CACHE_NUM_SLOTS_ENC H5P__encode_chunk_cache_nslots
|
||||
#define H5D_ACS_DATA_CACHE_NUM_SLOTS_DEC H5P__decode_chunk_cache_nslots
|
||||
/* Definition for size of raw data chunk cache(bytes) */
|
||||
#define H5D_ACS_DATA_CACHE_BYTE_SIZE_SIZE sizeof(size_t)
|
||||
#define H5D_ACS_DATA_CACHE_BYTE_SIZE_DEF H5D_CHUNK_CACHE_NBYTES_DEFAULT
|
||||
#define H5D_ACS_DATA_CACHE_BYTE_SIZE_ENC H5P__encode_size_t
|
||||
#define H5D_ACS_DATA_CACHE_BYTE_SIZE_DEC H5P__decode_size_t
|
||||
#define H5D_ACS_DATA_CACHE_BYTE_SIZE_ENC H5P__encode_chunk_cache_nbytes
|
||||
#define H5D_ACS_DATA_CACHE_BYTE_SIZE_DEC H5P__decode_chunk_cache_nbytes
|
||||
/* Definition for preemption read chunks first */
|
||||
#define H5D_ACS_PREEMPT_READ_CHUNKS_SIZE sizeof(double)
|
||||
#define H5D_ACS_PREEMPT_READ_CHUNKS_DEF H5D_CHUNK_CACHE_W0_DEFAULT
|
||||
@ -79,6 +79,12 @@
|
||||
|
||||
/* Property class callbacks */
|
||||
static herr_t H5P__dacc_reg_prop(H5P_genclass_t *pclass);
|
||||
static herr_t H5P__encode_chunk_cache_nslots(const void *value, void **_pp,
|
||||
size_t *size);
|
||||
static herr_t H5P__decode_chunk_cache_nslots(const void **_pp, void *_value);
|
||||
static herr_t H5P__encode_chunk_cache_nbytes(const void *value, void **_pp,
|
||||
size_t *size);
|
||||
static herr_t H5P__decode_chunk_cache_nbytes(const void **_pp, void *_value);
|
||||
|
||||
|
||||
/*********************/
|
||||
@ -285,3 +291,223 @@ done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* end H5Pget_chunk_cache */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5P__encode_chunk_cache_nslots
|
||||
*
|
||||
* Purpose: Encode the rdcc_nslots parameter to a serialized
|
||||
* property list. Similar to H5P__encode_size_t except
|
||||
* the value of 255 for the enc_size field is reserved to
|
||||
* indicate H5D_ACS_DATA_CACHE_NUM_SLOTS_DEF, in which
|
||||
* nothing further is encoded.
|
||||
*
|
||||
* Return: Success: Non-negative
|
||||
* Failure: Negative
|
||||
*
|
||||
* Programmer: Neil Fortner
|
||||
* Wednesday, January 23, 2013
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
H5P__encode_chunk_cache_nslots(const void *value, void **_pp, size_t *size)
|
||||
{
|
||||
uint64_t enc_value; /* Property value to encode */
|
||||
uint8_t **pp = (uint8_t **)_pp;
|
||||
unsigned enc_size; /* Size of encoded property */
|
||||
|
||||
FUNC_ENTER_PACKAGE_NOERR
|
||||
|
||||
/* Sanity checks */
|
||||
HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t));
|
||||
HDassert(size);
|
||||
|
||||
/* Determine if this is the default value, in which case only encode
|
||||
* enc_size (as 255). Also set size needed for encoding. */
|
||||
if(*(const size_t *)value == H5D_ACS_DATA_CACHE_NUM_SLOTS_DEF) {
|
||||
enc_size = 0;
|
||||
*size += 1;
|
||||
} /* end if */
|
||||
else {
|
||||
enc_value = (uint64_t)*(const size_t *)value;
|
||||
enc_size = H5VM_limit_enc_size(enc_value);
|
||||
HDassert(enc_size > 0);
|
||||
*size += (1 + enc_size);
|
||||
} /* end else */
|
||||
|
||||
HDassert(enc_size < 256);
|
||||
|
||||
if(NULL != *pp) {
|
||||
/* Encode the size */
|
||||
*(*pp)++ = (uint8_t)enc_size;
|
||||
|
||||
/* Encode the value if necessary */
|
||||
if(enc_size != 0) {
|
||||
UINT64ENCODE_VAR(*pp, enc_value, enc_size);
|
||||
} /* end if */
|
||||
} /* end if */
|
||||
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
} /* end H5P__encode_chunk_cache_nslots() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5P__decode_chunk_cache_nslots
|
||||
*
|
||||
* Purpose: Decode the rdcc_nslots parameter from a serialized
|
||||
* property list. Similar to H5P__decode_size_t except
|
||||
* the value of 255 for the enc_size field is reserved to
|
||||
* indicate H5D_ACS_DATA_CACHE_NUM_SLOTS_DEF, in which
|
||||
* nothing further needs to be decoded.
|
||||
*
|
||||
* Return: Success: Non-negative
|
||||
* Failure: Negative
|
||||
*
|
||||
* Programmer: Neil Fortner
|
||||
* Wednesday, January 23, 2013
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
H5P__decode_chunk_cache_nslots(const void **_pp, void *_value)
|
||||
{
|
||||
size_t *value = (size_t *)_value; /* Property value to return */
|
||||
const uint8_t **pp = (const uint8_t **)_pp;
|
||||
uint64_t enc_value; /* Decoded property value */
|
||||
unsigned enc_size; /* Size of encoded property */
|
||||
|
||||
FUNC_ENTER_PACKAGE_NOERR
|
||||
|
||||
/* Sanity check */
|
||||
HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t));
|
||||
HDassert(pp);
|
||||
HDassert(*pp);
|
||||
HDassert(value);
|
||||
|
||||
/* Decode the size */
|
||||
enc_size = *(*pp)++;
|
||||
HDassert(enc_size < 256);
|
||||
|
||||
/* Determine if enc_size indicates that this is the default value, in which
|
||||
* case set value to H5D_ACS_DATA_CACHE_NUM_SLOTS_DEF and return */
|
||||
if(enc_size == 0)
|
||||
*value = H5D_ACS_DATA_CACHE_NUM_SLOTS_DEF;
|
||||
else {
|
||||
/* Decode the value */
|
||||
UINT64DECODE_VAR(*pp, enc_value, enc_size);
|
||||
H5_CHECKED_ASSIGN(*value, uint64_t, enc_value, size_t);
|
||||
} /* end else */
|
||||
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
} /* end H5P__decode_chunk_cache_nslots() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5P__encode_chunk_cache_nbytes
|
||||
*
|
||||
* Purpose: Encode the rdcc_nbytes parameter to a serialized
|
||||
* property list. Similar to H5P__encode_size_t except
|
||||
* the value of 255 for the enc_size field is reserved to
|
||||
* indicate H5D_ACS_DATA_CACHE_BYTE_SIZE_DEF, in which
|
||||
* nothing further is encoded.
|
||||
*
|
||||
* Return: Success: Non-negative
|
||||
* Failure: Negative
|
||||
*
|
||||
* Programmer: Neil Fortner
|
||||
* Wednesday, January 23, 2013
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
H5P__encode_chunk_cache_nbytes(const void *value, void **_pp, size_t *size)
|
||||
{
|
||||
uint64_t enc_value; /* Property value to encode */
|
||||
uint8_t **pp = (uint8_t **)_pp;
|
||||
unsigned enc_size; /* Size of encoded property */
|
||||
|
||||
FUNC_ENTER_PACKAGE_NOERR
|
||||
|
||||
/* Sanity checks */
|
||||
HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t));
|
||||
HDassert(size);
|
||||
|
||||
/* Determine if this is the default value, in which case only encode
|
||||
* enc_size (as 255). Also set size needed for encoding. */
|
||||
if(*(const size_t *)value == H5D_ACS_DATA_CACHE_BYTE_SIZE_DEF) {
|
||||
enc_size = 0;
|
||||
*size += 1;
|
||||
} /* end if */
|
||||
else {
|
||||
enc_value = (uint64_t)*(const size_t *)value;
|
||||
enc_size = H5VM_limit_enc_size(enc_value);
|
||||
HDassert(enc_size > 0);
|
||||
*size += (1 + enc_size);
|
||||
} /* end else */
|
||||
|
||||
HDassert(enc_size < 256);
|
||||
|
||||
if(NULL != *pp) {
|
||||
/* Encode the size */
|
||||
*(*pp)++ = (uint8_t)enc_size;
|
||||
|
||||
/* Encode the value if necessary */
|
||||
if(enc_size != 0) {
|
||||
UINT64ENCODE_VAR(*pp, enc_value, enc_size);
|
||||
} /* end if */
|
||||
} /* end if */
|
||||
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
} /* end H5P__encode_chunk_cache_nbytes() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5P__decode_chunk_cache_nbytes
|
||||
*
|
||||
* Purpose: Decode the rdcc_nbytes parameter from a serialized
|
||||
* property list. Similar to H5P__decode_size_t except
|
||||
* the value of 255 for the enc_size field is reserved to
|
||||
* indicate H5D_ACS_DATA_CACHE_BYTE_SIZE_DEF, in which
|
||||
* nothing further needs to be decoded.
|
||||
*
|
||||
* Return: Success: Non-negative
|
||||
* Failure: Negative
|
||||
*
|
||||
* Programmer: Neil Fortner
|
||||
* Wednesday, January 23, 2013
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
H5P__decode_chunk_cache_nbytes(const void **_pp, void *_value)
|
||||
{
|
||||
size_t *value = (size_t *)_value; /* Property value to return */
|
||||
const uint8_t **pp = (const uint8_t **)_pp;
|
||||
uint64_t enc_value; /* Decoded property value */
|
||||
unsigned enc_size; /* Size of encoded property */
|
||||
|
||||
FUNC_ENTER_PACKAGE_NOERR
|
||||
|
||||
/* Sanity check */
|
||||
HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t));
|
||||
HDassert(pp);
|
||||
HDassert(*pp);
|
||||
HDassert(value);
|
||||
|
||||
/* Decode the size */
|
||||
enc_size = *(*pp)++;
|
||||
HDassert(enc_size < 256);
|
||||
|
||||
/* Determine if enc_size indicates that this is the default value, in which
|
||||
* case set value to H5D_ACS_DATA_CACHE_BYTE_SIZE_DEF and return */
|
||||
if(enc_size == 0)
|
||||
*value = H5D_ACS_DATA_CACHE_BYTE_SIZE_DEF;
|
||||
else {
|
||||
/* Decode the value */
|
||||
UINT64DECODE_VAR(*pp, enc_value, enc_size);
|
||||
H5_CHECKED_ASSIGN(*value, uint64_t, enc_value, size_t);
|
||||
} /* end else */
|
||||
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
} /* end H5P__decode_chunk_cache_nbytes() */
|
||||
|
||||
|
@ -639,7 +639,7 @@ H5P__fill_value_enc(const void *value, void **_pp, size_t *size)
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
uint8_t **pp = (uint8_t **)_pp;
|
||||
uint64_t enc_value;
|
||||
unsigned enc_size;
|
||||
unsigned enc_size = 0;
|
||||
|
||||
FUNC_ENTER_STATIC
|
||||
|
||||
|
@ -44,7 +44,7 @@ TEST_PROG= testhdf5 lheap ohdr stab gheap cache cache_api cache_tagging \
|
||||
pool accum hyperslab istore bittests dt_arith \
|
||||
dtypes dsets cmpd_dset filter_fail extend external efc objcopy links unlink \
|
||||
big mtime fillval mount flush1 flush2 app_ref enum \
|
||||
set_extent ttsafe enc_dec_plist enc_dec_plist_with_endianess\
|
||||
set_extent ttsafe enc_dec_plist enc_dec_plist_cross_platform\
|
||||
getname vfd ntypes dangle dtransform reserved cross_read \
|
||||
freespace mf farray earray btree2 fheap file_image unregister
|
||||
|
||||
|
235
test/enc_dec_plist_cross_platform.c
Normal file
235
test/enc_dec_plist_cross_platform.c
Normal file
@ -0,0 +1,235 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by The HDF Group. *
|
||||
* Copyright by the Board of Trustees of the University of Illinois. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
* terms governing use, modification, and redistribution, is contained in *
|
||||
* the files COPYING and Copyright.html. COPYING can be found at the root *
|
||||
* of the source code distribution tree; Copyright.html can be found at the *
|
||||
* root level of an installed copy of the electronic HDF5 document set and *
|
||||
* is linked from the top-level documents page. It can also be found at *
|
||||
* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
|
||||
* access to either file, you may request a copy from help@hdfgroup.org. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/*
|
||||
* Serial tests for encoding/decoding plists
|
||||
*/
|
||||
|
||||
#include "h5test.h"
|
||||
#include "H5srcdir.h"
|
||||
|
||||
#define CONFIG_LE 0x01
|
||||
#define CONFIG_64 0x02
|
||||
#define NCONFIG 0x04
|
||||
|
||||
static int test_plists(const char *filename_prefix);
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
if(VERBOSE_MED)
|
||||
printf("Encode/Decode property list endianess\n");
|
||||
|
||||
/******* ENCODE/DECODE DCPLS *****/
|
||||
TESTING("Default DCPL Encoding/Decoding");
|
||||
if(test_plists("testfiles/plist_files/def_dcpl_") < 0)
|
||||
FAIL_STACK_ERROR
|
||||
PASSED();
|
||||
TESTING("DCPL Encoding/Decoding");
|
||||
if(test_plists("testfiles/plist_files/dcpl_") < 0)
|
||||
FAIL_STACK_ERROR
|
||||
PASSED();
|
||||
|
||||
/******* ENCODE/DECODE DAPLS *****/
|
||||
TESTING("Default DAPL Encoding/Decoding");
|
||||
if(test_plists("testfiles/plist_files/def_dapl_") < 0)
|
||||
FAIL_STACK_ERROR
|
||||
PASSED();
|
||||
TESTING("DAPL Encoding/Decoding");
|
||||
if(test_plists("testfiles/plist_files/dapl_") < 0)
|
||||
FAIL_STACK_ERROR
|
||||
PASSED();
|
||||
|
||||
/******* ENCODE/DECODE DXPLS *****/
|
||||
TESTING("Default DXPL Encoding/Decoding");
|
||||
if(test_plists("testfiles/plist_files/def_dxpl_") < 0)
|
||||
FAIL_STACK_ERROR
|
||||
PASSED();
|
||||
TESTING("DXPL Encoding/Decoding");
|
||||
if(test_plists("testfiles/plist_files/dxpl_") < 0)
|
||||
FAIL_STACK_ERROR
|
||||
PASSED();
|
||||
|
||||
/******* ENCODE/DECODE GCPLS *****/
|
||||
TESTING("Default GCPL Encoding/Decoding");
|
||||
if(test_plists("testfiles/plist_files/def_gcpl_") < 0)
|
||||
FAIL_STACK_ERROR
|
||||
PASSED();
|
||||
TESTING("GCPL Encoding/Decoding");
|
||||
if(test_plists("testfiles/plist_files/gcpl_") < 0)
|
||||
FAIL_STACK_ERROR
|
||||
PASSED();
|
||||
|
||||
/******* ENCODE/DECODE LCPLS *****/
|
||||
TESTING("Default LCPL Encoding/Decoding");
|
||||
if(test_plists("testfiles/plist_files/def_lcpl_") < 0)
|
||||
FAIL_STACK_ERROR
|
||||
PASSED();
|
||||
TESTING("LCPL Encoding/Decoding");
|
||||
if(test_plists("testfiles/plist_files/lcpl_") < 0)
|
||||
FAIL_STACK_ERROR
|
||||
PASSED();
|
||||
|
||||
/******* ENCODE/DECODE LAPLS *****/
|
||||
TESTING("Default LAPL Encoding/Decoding");
|
||||
if(test_plists("testfiles/plist_files/def_lapl_") < 0)
|
||||
FAIL_STACK_ERROR
|
||||
PASSED();
|
||||
TESTING("LAPL Encoding/Decoding");
|
||||
if(test_plists("testfiles/plist_files/lapl_") < 0)
|
||||
FAIL_STACK_ERROR
|
||||
PASSED();
|
||||
|
||||
/******* ENCODE/DECODE OCPLS *****/
|
||||
TESTING("Default OCPL Encoding/Decoding");
|
||||
if(test_plists("testfiles/plist_files/def_ocpl_") < 0)
|
||||
FAIL_STACK_ERROR
|
||||
PASSED();
|
||||
TESTING("OCPL Encoding/Decoding");
|
||||
if(test_plists("testfiles/plist_files/ocpl_") < 0)
|
||||
FAIL_STACK_ERROR
|
||||
PASSED();
|
||||
|
||||
/******* ENCODE/DECODE OCPYPLS *****/
|
||||
TESTING("Default OCPYPL Encoding/Decoding");
|
||||
if(test_plists("testfiles/plist_files/def_ocpypl_") < 0)
|
||||
FAIL_STACK_ERROR
|
||||
PASSED();
|
||||
TESTING("OCPYPL Encoding/Decoding");
|
||||
if(test_plists("testfiles/plist_files/ocpypl_") < 0)
|
||||
FAIL_STACK_ERROR
|
||||
PASSED();
|
||||
|
||||
/******* ENCODE/DECODE FCPLS *****/
|
||||
TESTING("Default FCPL Encoding/Decoding");
|
||||
if(test_plists("testfiles/plist_files/def_fcpl_") < 0)
|
||||
FAIL_STACK_ERROR
|
||||
PASSED();
|
||||
TESTING("FCPL Encoding/Decoding");
|
||||
if(test_plists("testfiles/plist_files/fcpl_") < 0)
|
||||
FAIL_STACK_ERROR
|
||||
PASSED();
|
||||
|
||||
/******* ENCODE/DECODE FAPLS *****/
|
||||
TESTING("Default FAPL Encoding/Decoding");
|
||||
if(test_plists("testfiles/plist_files/def_fapl_") < 0)
|
||||
FAIL_STACK_ERROR
|
||||
PASSED();
|
||||
TESTING("FAPL Encoding/Decoding");
|
||||
if(test_plists("testfiles/plist_files/fapl_") < 0)
|
||||
FAIL_STACK_ERROR
|
||||
PASSED();
|
||||
|
||||
/******* ENCODE/DECODE STRCPLS *****/
|
||||
TESTING("Default STRCPL Encoding/Decoding");
|
||||
if(test_plists("testfiles/plist_files/def_strcpl_") < 0)
|
||||
FAIL_STACK_ERROR
|
||||
PASSED();
|
||||
TESTING("STRCPL Encoding/Decoding");
|
||||
if(test_plists("testfiles/plist_files/strcpl_") < 0)
|
||||
FAIL_STACK_ERROR
|
||||
PASSED();
|
||||
|
||||
/******* ENCODE/DECODE ACPLS *****/
|
||||
TESTING("Default ACPL Encoding/Decoding");
|
||||
if(test_plists("testfiles/plist_files/def_acpl_") < 0)
|
||||
FAIL_STACK_ERROR
|
||||
PASSED();
|
||||
TESTING("ACPL Encoding/Decoding");
|
||||
if(test_plists("testfiles/plist_files/acpl_") < 0)
|
||||
FAIL_STACK_ERROR
|
||||
PASSED();
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
test_plists(const char *filename_prefix)
|
||||
{
|
||||
unsigned config_1, config_2;
|
||||
int fd_1, fd_2;
|
||||
size_t size_1 = 0, size_2 = 0;
|
||||
void *buf_1 = NULL, *buf_2 = NULL;
|
||||
hid_t plist_1, plist_2;
|
||||
char filename[1024];
|
||||
const char *testfile;
|
||||
|
||||
/* Iterate over all combinations of configurations */
|
||||
for(config_1 = 0; config_1 < (NCONFIG - 1); config_1++)
|
||||
for(config_2 = config_1 + 1; config_2 < NCONFIG; config_2++) {
|
||||
/* Generate filename for file 1 */
|
||||
if(HDsnprintf(filename, sizeof(filename), "%s%s%s", filename_prefix,
|
||||
config_1 & CONFIG_64 ? "64" : "32",
|
||||
config_1 & CONFIG_LE ? "le" : "be") < 0)
|
||||
TEST_ERROR
|
||||
|
||||
/* Read file 1 */
|
||||
testfile = H5_get_srcdir_filename(filename);
|
||||
if((fd_1 = HDopen(testfile, O_RDONLY, 0666)) < 0)
|
||||
TEST_ERROR
|
||||
size_1 = (size_t)HDlseek(fd_1, (HDoff_t)0, SEEK_END);
|
||||
HDlseek(fd_1, (HDoff_t)0, SEEK_SET);
|
||||
buf_1 = (void *)HDmalloc(size_1);
|
||||
if(HDread(fd_1, buf_1, size_1) < 0)
|
||||
TEST_ERROR
|
||||
HDclose(fd_1);
|
||||
|
||||
/* Generate filename for file 2 */
|
||||
if(HDsnprintf(filename, sizeof(filename), "%s%s%s", filename_prefix,
|
||||
config_2 & CONFIG_64 ? "64" : "32",
|
||||
config_2 & CONFIG_LE ? "le" : "be") < 0)
|
||||
TEST_ERROR
|
||||
|
||||
/* Read file 1 */
|
||||
testfile = H5_get_srcdir_filename(filename);
|
||||
if((fd_2 = HDopen(testfile, O_RDONLY, 0666)) < 0)
|
||||
TEST_ERROR
|
||||
size_2 = (size_t)HDlseek(fd_2, (HDoff_t)0, SEEK_END);
|
||||
HDlseek(fd_2, (HDoff_t)0, SEEK_SET);
|
||||
buf_2 = (void *)HDmalloc(size_2);
|
||||
if(HDread(fd_2, buf_2, size_2) < 0)
|
||||
TEST_ERROR
|
||||
HDclose(fd_2);
|
||||
|
||||
/* Decode property lists */
|
||||
if((plist_1 = H5Pdecode(buf_1)) < 0)
|
||||
FAIL_STACK_ERROR
|
||||
if((plist_2 = H5Pdecode(buf_2)) < 0)
|
||||
FAIL_STACK_ERROR
|
||||
|
||||
/* Compare decoded property lists */
|
||||
if(!H5Pequal(plist_1, plist_2))
|
||||
FAIL_PUTS_ERROR("PLIST encoding/decoding comparison failed\n")
|
||||
|
||||
/* Close */
|
||||
if((H5Pclose(plist_1)) < 0)
|
||||
FAIL_STACK_ERROR
|
||||
if((H5Pclose(plist_2)) < 0)
|
||||
FAIL_STACK_ERROR
|
||||
|
||||
HDfree(buf_1);
|
||||
HDfree(buf_2);
|
||||
} /* end for */
|
||||
|
||||
return 1;
|
||||
|
||||
error:
|
||||
printf("***** Plist Encode/Decode tests FAILED! *****\n");
|
||||
return -1;
|
||||
}
|
||||
|
@ -1,160 +0,0 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by The HDF Group. *
|
||||
* Copyright by the Board of Trustees of the University of Illinois. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
* terms governing use, modification, and redistribution, is contained in *
|
||||
* the files COPYING and Copyright.html. COPYING can be found at the root *
|
||||
* of the source code distribution tree; Copyright.html can be found at the *
|
||||
* root level of an installed copy of the electronic HDF5 document set and *
|
||||
* is linked from the top-level documents page. It can also be found at *
|
||||
* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
|
||||
* access to either file, you may request a copy from help@hdfgroup.org. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/*
|
||||
* Serial tests for encoding/decoding plists
|
||||
*/
|
||||
|
||||
#include "h5test.h"
|
||||
#include "H5srcdir.h"
|
||||
|
||||
static int test_plists(const char *filename1, const char *filename2);
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
if(VERBOSE_MED)
|
||||
printf("Encode/Decode property list endianess\n");
|
||||
|
||||
/******* ENCODE/DECODE DCPLS *****/
|
||||
TESTING("DCPL Encoding/Decoding");
|
||||
if(test_plists("testfiles/plist_files/dcpl_le", "testfiles/plist_files/dcpl_be") < 0)
|
||||
FAIL_STACK_ERROR
|
||||
PASSED();
|
||||
|
||||
/******* ENCODE/DECODE DAPLS *****/
|
||||
TESTING("DAPL Encoding/Decoding");
|
||||
if(test_plists("testfiles/plist_files/dapl_le", "testfiles/plist_files/dapl_be") < 0)
|
||||
FAIL_STACK_ERROR
|
||||
PASSED();
|
||||
|
||||
/******* ENCODE/DECODE DXPLS *****/
|
||||
TESTING("DXPL Encoding/Decoding");
|
||||
if(test_plists("testfiles/plist_files/dxpl_le", "testfiles/plist_files/dxpl_be") < 0)
|
||||
FAIL_STACK_ERROR
|
||||
PASSED();
|
||||
|
||||
/******* ENCODE/DECODE GCPLS *****/
|
||||
TESTING("GCPL Encoding/Decoding");
|
||||
if(test_plists("testfiles/plist_files/gcpl_le", "testfiles/plist_files/gcpl_be") < 0)
|
||||
FAIL_STACK_ERROR
|
||||
PASSED();
|
||||
|
||||
/******* ENCODE/DECODE LCPLS *****/
|
||||
TESTING("LCPL Encoding/Decoding");
|
||||
if(test_plists("testfiles/plist_files/lcpl_le", "testfiles/plist_files/lcpl_be") < 0)
|
||||
FAIL_STACK_ERROR
|
||||
PASSED();
|
||||
|
||||
/******* ENCODE/DECODE LAPLS *****/
|
||||
TESTING("LAPL Encoding/Decoding");
|
||||
if(test_plists("testfiles/plist_files/lapl_le", "testfiles/plist_files/lapl_be") < 0)
|
||||
FAIL_STACK_ERROR
|
||||
PASSED();
|
||||
|
||||
/******* ENCODE/DECODE OCPLS *****/
|
||||
TESTING("OCPL Encoding/Decoding");
|
||||
if(test_plists("testfiles/plist_files/ocpl_le", "testfiles/plist_files/ocpl_be") < 0)
|
||||
FAIL_STACK_ERROR
|
||||
PASSED();
|
||||
|
||||
/******* ENCODE/DECODE OCPYPLS *****/
|
||||
TESTING("OCPYPL Encoding/Decoding");
|
||||
if(test_plists("testfiles/plist_files/ocpypl_le", "testfiles/plist_files/ocpypl_be") < 0)
|
||||
FAIL_STACK_ERROR
|
||||
PASSED();
|
||||
|
||||
/******* ENCODE/DECODE FCPLS *****/
|
||||
TESTING("FCPL Encoding/Decoding");
|
||||
if(test_plists("testfiles/plist_files/fcpl_le", "testfiles/plist_files/fcpl_be") < 0)
|
||||
FAIL_STACK_ERROR
|
||||
PASSED();
|
||||
|
||||
/******* ENCODE/DECODE FAPLS *****/
|
||||
TESTING("FAPL Encoding/Decoding");
|
||||
if(test_plists("testfiles/plist_files/fapl_le", "testfiles/plist_files/fapl_be") < 0)
|
||||
FAIL_STACK_ERROR
|
||||
PASSED();
|
||||
|
||||
/******* ENCODE/DECODE STRCPLS *****/
|
||||
TESTING("STRCPL Encoding/Decoding");
|
||||
if(test_plists("testfiles/plist_files/strcpl_le", "testfiles/plist_files/strcpl_be") < 0)
|
||||
FAIL_STACK_ERROR
|
||||
PASSED();
|
||||
|
||||
/******* ENCODE/DECODE ACPLS *****/
|
||||
TESTING("ACPL Encoding/Decoding");
|
||||
if(test_plists("testfiles/plist_files/acpl_le", "testfiles/plist_files/acpl_be") < 0)
|
||||
FAIL_STACK_ERROR
|
||||
PASSED();
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
test_plists(const char *filename1, const char *filename2)
|
||||
{
|
||||
int fd_le, fd_be;
|
||||
size_t size_le = 0, size_be = 0;
|
||||
void *buf_le = NULL, *buf_be = NULL;
|
||||
hid_t plist_le, plist_be; /* dataset create prop. list */
|
||||
const char *testfile;
|
||||
|
||||
testfile = H5_get_srcdir_filename(filename1);
|
||||
if((fd_le = HDopen(testfile, O_RDONLY, 0666)) < 0)
|
||||
TEST_ERROR
|
||||
size_le = HDlseek(fd_le, (HDoff_t)0, SEEK_END);
|
||||
HDlseek(fd_le, (HDoff_t)0, SEEK_SET);
|
||||
buf_le = (void *)HDmalloc(size_le);
|
||||
if(HDread(fd_le, buf_le, size_le) < 0)
|
||||
TEST_ERROR
|
||||
HDclose(fd_le);
|
||||
|
||||
testfile = H5_get_srcdir_filename(filename2);
|
||||
if((fd_be = HDopen(testfile, O_RDONLY, 0666)) < 0)
|
||||
TEST_ERROR
|
||||
size_be = HDlseek(fd_be, (HDoff_t)0, SEEK_END);
|
||||
HDlseek(fd_be, (HDoff_t)0, SEEK_SET);
|
||||
buf_be = (void *)HDmalloc(size_be);
|
||||
if(HDread(fd_be, buf_be, size_be) < 0)
|
||||
TEST_ERROR
|
||||
HDclose(fd_be);
|
||||
|
||||
if((plist_le = H5Pdecode(buf_le)) < 0)
|
||||
FAIL_STACK_ERROR
|
||||
if((plist_be = H5Pdecode(buf_be)) < 0)
|
||||
FAIL_STACK_ERROR
|
||||
|
||||
if(!H5Pequal(plist_le, plist_be))
|
||||
FAIL_PUTS_ERROR("PLIST encoding/decoding comparison failed\n")
|
||||
|
||||
if((H5Pclose(plist_le)) < 0)
|
||||
FAIL_STACK_ERROR
|
||||
if((H5Pclose(plist_be)) < 0)
|
||||
FAIL_STACK_ERROR
|
||||
|
||||
HDfree(buf_le);
|
||||
HDfree(buf_be);
|
||||
|
||||
return 1;
|
||||
|
||||
error:
|
||||
printf("***** Plist Encode/Decode tests FAILED! *****\n");
|
||||
return -1;
|
||||
}
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include "H5private.h"
|
||||
#include "hdf5.h"
|
||||
|
||||
static int encode_plist(hid_t plist_id, int little_endian, const char *filename_le, const char *filename_be);
|
||||
static int encode_plist(hid_t plist_id, int little_endian, int word_length, const char *filename_prefix);
|
||||
|
||||
int
|
||||
main(void)
|
||||
@ -54,6 +54,7 @@ main(void)
|
||||
unsigned min_dense;
|
||||
const char* c_to_f = "x+32";
|
||||
int little_endian;
|
||||
int word_length;
|
||||
H5AC_cache_config_t my_cache_config = {
|
||||
H5AC__CURR_CACHE_CONFIG_VERSION,
|
||||
1 /*TRUE*/,
|
||||
@ -99,6 +100,11 @@ main(void)
|
||||
little_endian = 0;
|
||||
}
|
||||
|
||||
/* check word length */
|
||||
{
|
||||
word_length = 8 * sizeof(void *);
|
||||
}
|
||||
|
||||
/* Explicitly initialize the library, since we are including the private header file */
|
||||
H5open();
|
||||
|
||||
@ -106,6 +112,9 @@ main(void)
|
||||
if((dcpl1 = H5Pcreate(H5P_DATASET_CREATE)) < 0)
|
||||
assert(dcpl1 > 0);
|
||||
|
||||
if((ret = encode_plist(dcpl1, little_endian, word_length, "testfiles/plist_files/def_dcpl_")) < 0)
|
||||
assert(ret > 0);
|
||||
|
||||
if((ret = H5Pset_chunk(dcpl1, 1, &chunk_size)) < 0)
|
||||
assert(ret > 0);
|
||||
|
||||
@ -131,7 +140,7 @@ main(void)
|
||||
(hsize_t)(max_size[0] * sizeof(int)/4))) < 0)
|
||||
assert(ret > 0);
|
||||
|
||||
if((ret = encode_plist(dcpl1, little_endian, "testfiles/plist_files/dcpl_le", "testfiles/plist_files/dcpl_be")) < 0)
|
||||
if((ret = encode_plist(dcpl1, little_endian, word_length, "testfiles/plist_files/dcpl_")) < 0)
|
||||
assert(ret > 0);
|
||||
|
||||
/* release resource */
|
||||
@ -143,10 +152,13 @@ main(void)
|
||||
if((dapl1 = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
|
||||
assert(dapl1 > 0);
|
||||
|
||||
if((ret = encode_plist(dapl1, little_endian, word_length, "testfiles/plist_files/def_dapl_")) < 0)
|
||||
assert(ret > 0);
|
||||
|
||||
if((ret = H5Pset_chunk_cache(dapl1, nslots, nbytes, w0)) < 0)
|
||||
assert(ret > 0);
|
||||
|
||||
if((ret = encode_plist(dapl1, little_endian, "testfiles/plist_files/dapl_le", "testfiles/plist_files/dapl_be")) < 0)
|
||||
if((ret = encode_plist(dapl1, little_endian, word_length, "testfiles/plist_files/dapl_")) < 0)
|
||||
assert(ret > 0);
|
||||
|
||||
/* release resource */
|
||||
@ -156,6 +168,10 @@ main(void)
|
||||
/******* ENCODE/DECODE DXPLS *****/
|
||||
if((dxpl1 = H5Pcreate(H5P_DATASET_XFER)) < 0)
|
||||
assert(dxpl1 > 0);
|
||||
|
||||
if((ret = encode_plist(dxpl1, little_endian, word_length, "testfiles/plist_files/def_dxpl_")) < 0)
|
||||
assert(ret > 0);
|
||||
|
||||
if((ret = H5Pset_btree_ratios(dxpl1, 0.2f, 0.6f, 0.2f)) < 0)
|
||||
assert(ret > 0);
|
||||
if((ret = H5Pset_hyper_vector_size(dxpl1, 5)) < 0)
|
||||
@ -177,7 +193,7 @@ main(void)
|
||||
if((ret = H5Pset_data_transform(dxpl1, c_to_f)) < 0)
|
||||
assert(ret > 0);
|
||||
|
||||
if((ret = encode_plist(dxpl1, little_endian, "testfiles/plist_files/dxpl_le", "testfiles/plist_files/dxpl_be")) < 0)
|
||||
if((ret = encode_plist(dxpl1, little_endian, word_length, "testfiles/plist_files/dxpl_")) < 0)
|
||||
assert(ret > 0);
|
||||
|
||||
/* release resource */
|
||||
@ -189,6 +205,9 @@ main(void)
|
||||
if((gcpl1 = H5Pcreate(H5P_GROUP_CREATE)) < 0)
|
||||
assert(gcpl1 > 0);
|
||||
|
||||
if((ret = encode_plist(gcpl1, little_endian, word_length, "testfiles/plist_files/def_gcpl_")) < 0)
|
||||
assert(ret > 0);
|
||||
|
||||
if((ret = H5Pset_local_heap_size_hint(gcpl1, 256)) < 0)
|
||||
assert(ret > 0);
|
||||
|
||||
@ -205,7 +224,7 @@ main(void)
|
||||
if((ret = H5Pset_link_creation_order(gcpl1, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED))) < 0)
|
||||
assert(ret > 0);
|
||||
|
||||
if((ret = encode_plist(gcpl1, little_endian, "testfiles/plist_files/gcpl_le", "testfiles/plist_files/gcpl_be")) < 0)
|
||||
if((ret = encode_plist(gcpl1, little_endian, word_length, "testfiles/plist_files/gcpl_")) < 0)
|
||||
assert(ret > 0);
|
||||
|
||||
/* release resource */
|
||||
@ -216,10 +235,13 @@ main(void)
|
||||
if((lcpl1 = H5Pcreate(H5P_LINK_CREATE)) < 0)
|
||||
assert(lcpl1 > 0);
|
||||
|
||||
if((ret = encode_plist(lcpl1, little_endian, word_length, "testfiles/plist_files/def_lcpl_")) < 0)
|
||||
assert(ret > 0);
|
||||
|
||||
if((ret = H5Pset_create_intermediate_group(lcpl1, 1 /*TRUE*/)) < 0)
|
||||
assert(ret > 0);
|
||||
|
||||
if((ret = encode_plist(lcpl1, little_endian, "testfiles/plist_files/lcpl_le", "testfiles/plist_files/lcpl_be")) < 0)
|
||||
if((ret = encode_plist(lcpl1, little_endian, word_length, "testfiles/plist_files/lcpl_")) < 0)
|
||||
assert(ret > 0);
|
||||
|
||||
/* release resource */
|
||||
@ -230,6 +252,9 @@ main(void)
|
||||
if((ocpypl1 = H5Pcreate(H5P_OBJECT_COPY)) < 0)
|
||||
assert(ocpypl1 > 0);
|
||||
|
||||
if((ret = encode_plist(ocpypl1, little_endian, word_length, "testfiles/plist_files/def_ocpypl_")) < 0)
|
||||
assert(ret > 0);
|
||||
|
||||
ret = H5Pset_copy_object(ocpypl1, H5O_COPY_EXPAND_EXT_LINK_FLAG);
|
||||
assert(ret >= 0);
|
||||
|
||||
@ -239,7 +264,7 @@ main(void)
|
||||
ret = H5Padd_merge_committed_dtype_path(ocpypl1, "bar");
|
||||
assert(ret >= 0);
|
||||
|
||||
if((ret = encode_plist(ocpypl1, little_endian, "testfiles/plist_files/ocpypl_le", "testfiles/plist_files/ocpypl_be")) < 0)
|
||||
if((ret = encode_plist(ocpypl1, little_endian, word_length, "testfiles/plist_files/ocpypl_")) < 0)
|
||||
assert(ret > 0);
|
||||
|
||||
/* release resource */
|
||||
@ -250,6 +275,9 @@ main(void)
|
||||
if((ocpl1 = H5Pcreate(H5P_OBJECT_CREATE)) < 0)
|
||||
assert(ocpl1 > 0);
|
||||
|
||||
if((ret = encode_plist(ocpl1, little_endian, word_length, "testfiles/plist_files/def_ocpl_")) < 0)
|
||||
assert(ret > 0);
|
||||
|
||||
if((ret = H5Pset_attr_creation_order(ocpl1, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED))) < 0)
|
||||
assert(ret > 0);
|
||||
|
||||
@ -259,7 +287,7 @@ main(void)
|
||||
if((ret = H5Pset_filter (ocpl1, H5Z_FILTER_FLETCHER32, 0, (size_t)0, NULL)) < 0)
|
||||
assert(ret > 0);
|
||||
|
||||
if((ret = encode_plist(ocpl1, little_endian, "testfiles/plist_files/ocpl_le", "testfiles/plist_files/ocpl_be")) < 0)
|
||||
if((ret = encode_plist(ocpl1, little_endian, word_length, "testfiles/plist_files/ocpl_")) < 0)
|
||||
assert(ret > 0);
|
||||
|
||||
/* release resource */
|
||||
@ -270,6 +298,9 @@ main(void)
|
||||
if((lapl1 = H5Pcreate(H5P_LINK_ACCESS)) < 0)
|
||||
assert(lapl1 > 0);
|
||||
|
||||
if((ret = encode_plist(lapl1, little_endian, word_length, "testfiles/plist_files/def_lapl_")) < 0)
|
||||
assert(ret > 0);
|
||||
|
||||
if((ret = H5Pset_nlinks(lapl1, (size_t)134)) < 0)
|
||||
assert(ret > 0);
|
||||
|
||||
@ -292,7 +323,7 @@ main(void)
|
||||
if((ret = H5Pclose(fapl1)) < 0)
|
||||
assert(ret > 0);
|
||||
|
||||
if((ret = encode_plist(lapl1, little_endian, "testfiles/plist_files/lapl_le", "testfiles/plist_files/lapl_be")) < 0)
|
||||
if((ret = encode_plist(lapl1, little_endian, word_length, "testfiles/plist_files/lapl_")) < 0)
|
||||
assert(ret > 0);
|
||||
|
||||
/* release resource */
|
||||
@ -303,6 +334,9 @@ main(void)
|
||||
if((fapl1 = H5Pcreate(H5P_FILE_ACCESS)) < 0)
|
||||
assert(fapl1 > 0);
|
||||
|
||||
if((ret = encode_plist(fapl1, little_endian, word_length, "testfiles/plist_files/def_fapl_")) < 0)
|
||||
assert(ret > 0);
|
||||
|
||||
if((ret = H5Pset_family_offset(fapl1, 1024)) < 0)
|
||||
assert(ret > 0);
|
||||
if((ret = H5Pset_meta_block_size(fapl1, 2098452)) < 0)
|
||||
@ -330,7 +364,7 @@ main(void)
|
||||
if((ret = H5Pset_core_write_tracking(fapl1, TRUE, (size_t)(1024 * 1024))) < 0)
|
||||
assert(ret > 0);
|
||||
|
||||
if((ret = encode_plist(fapl1, little_endian, "testfiles/plist_files/fapl_le", "testfiles/plist_files/fapl_be")) < 0)
|
||||
if((ret = encode_plist(fapl1, little_endian, word_length, "testfiles/plist_files/fapl_")) < 0)
|
||||
assert(ret > 0);
|
||||
|
||||
/* release resource */
|
||||
@ -341,6 +375,9 @@ main(void)
|
||||
if((fcpl1 = H5Pcreate(H5P_FILE_CREATE)) < 0)
|
||||
assert(fcpl1 > 0);
|
||||
|
||||
if((ret = encode_plist(fcpl1, little_endian, word_length, "testfiles/plist_files/def_fcpl_")) < 0)
|
||||
assert(ret > 0);
|
||||
|
||||
if((ret = H5Pset_userblock(fcpl1, 1024) < 0))
|
||||
assert(ret > 0);
|
||||
|
||||
@ -362,7 +399,7 @@ main(void)
|
||||
if((ret = H5Pset_sizes(fcpl1, 8, 4) < 0))
|
||||
assert(ret > 0);
|
||||
|
||||
if((ret = encode_plist(fcpl1, little_endian, "testfiles/plist_files/fcpl_le", "testfiles/plist_files/fcpl_be")) < 0)
|
||||
if((ret = encode_plist(fcpl1, little_endian, word_length, "testfiles/plist_files/fcpl_")) < 0)
|
||||
assert(ret > 0);
|
||||
|
||||
/* release resource */
|
||||
@ -373,10 +410,13 @@ main(void)
|
||||
strcpl1 = H5Pcreate(H5P_STRING_CREATE);
|
||||
assert(strcpl1 > 0);
|
||||
|
||||
ret = encode_plist(strcpl1, little_endian, word_length, "testfiles/plist_files/def_strcpl_");
|
||||
assert(ret > 0);
|
||||
|
||||
ret = H5Pset_char_encoding(strcpl1, H5T_CSET_UTF8);
|
||||
assert(ret >= 0);
|
||||
|
||||
ret = encode_plist(strcpl1, little_endian, "testfiles/plist_files/strcpl_le", "testfiles/plist_files/strcpl_be");
|
||||
ret = encode_plist(strcpl1, little_endian, word_length, "testfiles/plist_files/strcpl_");
|
||||
assert(ret > 0);
|
||||
|
||||
/* release resource */
|
||||
@ -387,10 +427,13 @@ main(void)
|
||||
acpl1 = H5Pcreate(H5P_ATTRIBUTE_CREATE);
|
||||
assert(acpl1 > 0);
|
||||
|
||||
ret = encode_plist(acpl1, little_endian, word_length, "testfiles/plist_files/def_acpl_");
|
||||
assert(ret > 0);
|
||||
|
||||
ret = H5Pset_char_encoding(acpl1, H5T_CSET_UTF8);
|
||||
assert(ret >= 0);
|
||||
|
||||
ret = encode_plist(acpl1, little_endian, "testfiles/plist_files/acpl_le", "testfiles/plist_files/acpl_be");
|
||||
ret = encode_plist(acpl1, little_endian, word_length, "testfiles/plist_files/acpl_");
|
||||
assert(ret > 0);
|
||||
|
||||
/* release resource */
|
||||
@ -401,13 +444,18 @@ main(void)
|
||||
}
|
||||
|
||||
static int
|
||||
encode_plist(hid_t plist_id, int little_endian, const char *filename_le, const char *filename_be)
|
||||
encode_plist(hid_t plist_id, int little_endian, int word_length, const char *filename_prefix)
|
||||
{
|
||||
int fd = 0; /* file descriptor */
|
||||
herr_t ret = 0;
|
||||
void *temp_buf = NULL;
|
||||
size_t temp_size = 0;
|
||||
ssize_t write_size;
|
||||
char filename[1024];
|
||||
|
||||
/* Generate filename */
|
||||
if((ret = HDsnprintf(filename, sizeof(filename), "%s%d%s", filename_prefix, word_length, little_endian ? "le" : "be")) < 0)
|
||||
assert(ret > 0);
|
||||
|
||||
/* first call to encode returns only the size of the buffer needed */
|
||||
if((ret = H5Pencode(plist_id, NULL, &temp_size)) < 0)
|
||||
@ -419,10 +467,7 @@ encode_plist(hid_t plist_id, int little_endian, const char *filename_le, const c
|
||||
if((ret = H5Pencode(plist_id, temp_buf, &temp_size)) < 0)
|
||||
assert(ret > 0);
|
||||
|
||||
if(little_endian)
|
||||
fd = HDopen(filename_le, O_RDWR | O_CREAT | O_TRUNC, 0666);
|
||||
else
|
||||
fd = HDopen(filename_be, O_RDWR | O_CREAT | O_TRUNC, 0666);
|
||||
fd = HDopen(filename, O_RDWR | O_CREAT | O_TRUNC, 0666);
|
||||
assert(fd > 0);
|
||||
|
||||
write_size = HDwrite(fd, temp_buf, temp_size);
|
||||
|
BIN
test/testfiles/plist_files/acpl_64be
Normal file
BIN
test/testfiles/plist_files/acpl_64be
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/acpl_64le
Normal file
BIN
test/testfiles/plist_files/acpl_64le
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/dapl_64be
Normal file
BIN
test/testfiles/plist_files/dapl_64be
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/dapl_64le
Normal file
BIN
test/testfiles/plist_files/dapl_64le
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/dcpl_64be
Normal file
BIN
test/testfiles/plist_files/dcpl_64be
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/dcpl_64le
Normal file
BIN
test/testfiles/plist_files/dcpl_64le
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/def_acpl_32be
Normal file
BIN
test/testfiles/plist_files/def_acpl_32be
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/def_acpl_32le
Normal file
BIN
test/testfiles/plist_files/def_acpl_32le
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/def_acpl_64be
Normal file
BIN
test/testfiles/plist_files/def_acpl_64be
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/def_acpl_64le
Normal file
BIN
test/testfiles/plist_files/def_acpl_64le
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/def_dapl_32be
Normal file
BIN
test/testfiles/plist_files/def_dapl_32be
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/def_dapl_32le
Normal file
BIN
test/testfiles/plist_files/def_dapl_32le
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/def_dapl_64be
Normal file
BIN
test/testfiles/plist_files/def_dapl_64be
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/def_dapl_64le
Normal file
BIN
test/testfiles/plist_files/def_dapl_64le
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/def_dcpl_32be
Normal file
BIN
test/testfiles/plist_files/def_dcpl_32be
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/def_dcpl_32le
Normal file
BIN
test/testfiles/plist_files/def_dcpl_32le
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/def_dcpl_64be
Normal file
BIN
test/testfiles/plist_files/def_dcpl_64be
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/def_dcpl_64le
Normal file
BIN
test/testfiles/plist_files/def_dcpl_64le
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/def_dxpl_32be
Normal file
BIN
test/testfiles/plist_files/def_dxpl_32be
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/def_dxpl_32le
Normal file
BIN
test/testfiles/plist_files/def_dxpl_32le
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/def_dxpl_64be
Normal file
BIN
test/testfiles/plist_files/def_dxpl_64be
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/def_dxpl_64le
Normal file
BIN
test/testfiles/plist_files/def_dxpl_64le
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/def_fapl_32be
Normal file
BIN
test/testfiles/plist_files/def_fapl_32be
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/def_fapl_32le
Normal file
BIN
test/testfiles/plist_files/def_fapl_32le
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/def_fapl_64be
Normal file
BIN
test/testfiles/plist_files/def_fapl_64be
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/def_fapl_64le
Normal file
BIN
test/testfiles/plist_files/def_fapl_64le
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/def_fcpl_32be
Normal file
BIN
test/testfiles/plist_files/def_fcpl_32be
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/def_fcpl_32le
Normal file
BIN
test/testfiles/plist_files/def_fcpl_32le
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/def_fcpl_64be
Normal file
BIN
test/testfiles/plist_files/def_fcpl_64be
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/def_fcpl_64le
Normal file
BIN
test/testfiles/plist_files/def_fcpl_64le
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/def_gcpl_32be
Normal file
BIN
test/testfiles/plist_files/def_gcpl_32be
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/def_gcpl_32le
Normal file
BIN
test/testfiles/plist_files/def_gcpl_32le
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/def_gcpl_64be
Normal file
BIN
test/testfiles/plist_files/def_gcpl_64be
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/def_gcpl_64le
Normal file
BIN
test/testfiles/plist_files/def_gcpl_64le
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/def_lapl_32be
Normal file
BIN
test/testfiles/plist_files/def_lapl_32be
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/def_lapl_32le
Normal file
BIN
test/testfiles/plist_files/def_lapl_32le
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/def_lapl_64be
Normal file
BIN
test/testfiles/plist_files/def_lapl_64be
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/def_lapl_64le
Normal file
BIN
test/testfiles/plist_files/def_lapl_64le
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/def_lcpl_32be
Normal file
BIN
test/testfiles/plist_files/def_lcpl_32be
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/def_lcpl_32le
Normal file
BIN
test/testfiles/plist_files/def_lcpl_32le
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/def_lcpl_64be
Normal file
BIN
test/testfiles/plist_files/def_lcpl_64be
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/def_lcpl_64le
Normal file
BIN
test/testfiles/plist_files/def_lcpl_64le
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/def_ocpl_32be
Normal file
BIN
test/testfiles/plist_files/def_ocpl_32be
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/def_ocpl_32le
Normal file
BIN
test/testfiles/plist_files/def_ocpl_32le
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/def_ocpl_64be
Normal file
BIN
test/testfiles/plist_files/def_ocpl_64be
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/def_ocpl_64le
Normal file
BIN
test/testfiles/plist_files/def_ocpl_64le
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/def_ocpypl_32be
Normal file
BIN
test/testfiles/plist_files/def_ocpypl_32be
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/def_ocpypl_32le
Normal file
BIN
test/testfiles/plist_files/def_ocpypl_32le
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/def_ocpypl_64be
Normal file
BIN
test/testfiles/plist_files/def_ocpypl_64be
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/def_ocpypl_64le
Normal file
BIN
test/testfiles/plist_files/def_ocpypl_64le
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/def_strcpl_32be
Normal file
BIN
test/testfiles/plist_files/def_strcpl_32be
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/def_strcpl_32le
Normal file
BIN
test/testfiles/plist_files/def_strcpl_32le
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/def_strcpl_64be
Normal file
BIN
test/testfiles/plist_files/def_strcpl_64be
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/def_strcpl_64le
Normal file
BIN
test/testfiles/plist_files/def_strcpl_64le
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/dxpl_32be
Normal file
BIN
test/testfiles/plist_files/dxpl_32be
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/dxpl_32le
Normal file
BIN
test/testfiles/plist_files/dxpl_32le
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/dxpl_64be
Normal file
BIN
test/testfiles/plist_files/dxpl_64be
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/dxpl_64le
Normal file
BIN
test/testfiles/plist_files/dxpl_64le
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
test/testfiles/plist_files/fapl_64be
Normal file
BIN
test/testfiles/plist_files/fapl_64be
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/fapl_64le
Normal file
BIN
test/testfiles/plist_files/fapl_64le
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/fcpl_64be
Normal file
BIN
test/testfiles/plist_files/fcpl_64be
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/fcpl_64le
Normal file
BIN
test/testfiles/plist_files/fcpl_64le
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/gcpl_64be
Normal file
BIN
test/testfiles/plist_files/gcpl_64be
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/gcpl_64le
Normal file
BIN
test/testfiles/plist_files/gcpl_64le
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
test/testfiles/plist_files/lapl_64be
Normal file
BIN
test/testfiles/plist_files/lapl_64be
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/lapl_64le
Normal file
BIN
test/testfiles/plist_files/lapl_64le
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/lcpl_64be
Normal file
BIN
test/testfiles/plist_files/lcpl_64be
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/lcpl_64le
Normal file
BIN
test/testfiles/plist_files/lcpl_64le
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/ocpl_64be
Normal file
BIN
test/testfiles/plist_files/ocpl_64be
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/ocpl_64le
Normal file
BIN
test/testfiles/plist_files/ocpl_64le
Normal file
Binary file not shown.
BIN
test/testfiles/plist_files/ocpypl_64be
Normal file
BIN
test/testfiles/plist_files/ocpypl_64be
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user