mirror of https://github.com/ecmwf/eccodes.git
ECC-727: handle all versions of HDF5 Super Block (versions)
This commit is contained in:
parent
09116019e8
commit
dec1eced12
|
@ -1,29 +1,31 @@
|
||||||
# http://www.hdfgroup.org/HDF5/doc/H5.format.html#Superblock
|
# http://www.hdfgroup.org/HDF5/doc/H5.format.html#Superblock
|
||||||
constant identifier="HDF5";
|
constant identifier="HDF5";
|
||||||
|
|
||||||
|
|
||||||
ascii[8] signature : dump;
|
ascii[8] signature : dump;
|
||||||
uint8 versionNumberOfSuperblock : dump;
|
uint8 versionNumberOfSuperblock : dump;
|
||||||
|
|
||||||
if(versionNumberOfSuperblock == 2) {
|
if (versionNumberOfSuperblock == 0 ||
|
||||||
uint8 sizeOfOffsets : dump;
|
versionNumberOfSuperblock == 1 ||
|
||||||
uint8 sizeOfLength : dump;
|
versionNumberOfSuperblock == 2 ||
|
||||||
uint8 fileConsistencyFlags : dump;
|
versionNumberOfSuperblock == 3)
|
||||||
|
{
|
||||||
|
uint8 sizeOfOffsets : dump;
|
||||||
|
uint8 sizeOfLength : dump;
|
||||||
|
uint8 fileConsistencyFlags : dump;
|
||||||
|
|
||||||
if(sizeOfOffsets == 8) {
|
if(sizeOfOffsets == 8) {
|
||||||
uint64_little_endian baseAddress : dump;
|
uint64_little_endian baseAddress : dump;
|
||||||
uint64_little_endian superblockExtensionAddress : dump;
|
uint64_little_endian superblockExtensionAddress : dump;
|
||||||
uint64_little_endian endOfFileAddress : dump;
|
uint64_little_endian endOfFileAddress : dump;
|
||||||
uint64_little_endian rootGroupObjectHeaderAddress : dump;
|
uint64_little_endian rootGroupObjectHeaderAddress : dump;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(sizeOfOffsets == 4) {
|
if(sizeOfOffsets == 4) {
|
||||||
uint32_little_endian baseAddress : dump;
|
uint32_little_endian baseAddress : dump;
|
||||||
uint32_little_endian superblockExtensionAddress : dump;
|
uint32_little_endian superblockExtensionAddress : dump;
|
||||||
uint32_little_endian endOfFileAddress : dump;
|
uint32_little_endian endOfFileAddress : dump;
|
||||||
uint32_little_endian rootGroupObjectHeaderAddress : dump;
|
uint32_little_endian rootGroupObjectHeaderAddress : dump;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ascii[4] superblockChecksum;
|
|
||||||
|
|
||||||
|
#ascii[4] superblockChecksum;
|
||||||
}
|
}
|
||||||
|
|
|
@ -491,7 +491,11 @@ static int read_HDF5_offset(reader *r, int length, unsigned long* v, unsigned ch
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
static int check_hdf5_superblock_version(unsigned char version)
|
||||||
|
{
|
||||||
|
if (version==0 || version==1 || version==2 || version==3) return GRIB_SUCCESS;
|
||||||
|
return GRIB_INVALID_MESSAGE;
|
||||||
|
}
|
||||||
static int read_HDF5(reader *r)
|
static int read_HDF5(reader *r)
|
||||||
{
|
{
|
||||||
/* See: http://www.hdfgroup.org/HDF5/doc/H5.format.html#Superblock */
|
/* See: http://www.hdfgroup.org/HDF5/doc/H5.format.html#Superblock */
|
||||||
|
@ -529,9 +533,9 @@ static int read_HDF5(reader *r)
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp[i++] = version_of_superblock;
|
tmp[i++] = version_of_superblock;
|
||||||
|
err = check_hdf5_superblock_version(version_of_superblock);
|
||||||
if(version_of_superblock != 2) {
|
if(err) {
|
||||||
grib_context_log(c, GRIB_LOG_ERROR,"read_HDF5: invalid version_of_superblock: %ld, only version 2 is supported", (long)version_of_superblock);
|
grib_context_log(c, GRIB_LOG_ERROR,"read_HDF5: invalid version of superblock: %ld", (long)version_of_superblock);
|
||||||
return GRIB_NOT_IMPLEMENTED;
|
return GRIB_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue