Hi Hendrik,
I don't see any bool datatype in the code you posted, but I guess you're
referring to one of the 8-bit values in the struct, and that the datatype
in the file is HBOOL.

To clarify, a NATIVE_HBOOL (hbool_t) is defined in H5public.h as uint
(U32), whereas a NATIVE_B8 is a uchar (U8). It's permitted to write a U8
into a U32, but not to read a U32 into a U8 because of potential data loss,
hence the "no appropriate conversion path" error is raised.

Cheers,
Martijn

On 27 June 2016 at 17:24, Hendrik Greving <[email protected]>
wrote:

> FYI, the problem was that bool data had to be NATIVE_B8, whereas I thought
> it had to be NATIVE_HBOOL (I don't know the difference but it works now).
>
> On Wed, Jun 22, 2016 at 5:05 PM, Hendrik Greving <
> [email protected]> wrote:
>
>> I am getting the following error when doing dataset.read():
>>
>> HDF5-DIAG: Error detected in HDF5 (1.8.5) thread 0:
>>   #000: H5Dio.c line 174 in H5Dread(): can't read data
>>     major: Dataset
>>     minor: Read failed
>>   #001: H5Dio.c line 325 in H5D_read(): unable to set up type info
>>     major: Dataset
>>     minor: Unable to initialize object
>>   #002: H5Dio.c line 743 in H5D_typeinfo_init(): unable to convert
>> between src and dest datatype
>>     major: Dataset
>>     minor: Feature is unsupported
>>   #003: H5T.c line 4449 in H5T_path_find(): no appropriate function for
>> conversion path
>>     major: Datatype
>>     minor: Unable to initialize object
>> Allocated: 0.21MB
>> Allocated: 0.05MB
>>
>> My code:
>>
>> typedef struct {
>>     bt_SInt64_t Id;
>>     bt_SInt8_t CoreId;
>>     bt_SInt64_t ICount;
>>     bt_SInt64_t GuestICount;
>>     bt_SInt64_t PC;
>>     bt_SInt8_t taken;
>>     bt_UInt8_t flags;
>>     bt_UInt32_t fromAddr;
>>     bt_SInt8_t fromAddrInCC;
>>     bt_UInt32_t toAddr;
>>     bt_SInt8_t toAddrInCC;
>>     bt_SInt64_t toGuestAddr;
>> } StateBranch2_t;
>>
>>         H5File h5ffile(file, H5F_ACC_RDONLY);
>>         DataSet dataset = h5ffile.openDataSet(dataSetName); // is some
>> name..
>>
>>        CompType comp( sizeof(StateBranch2_t) );
>>         comp.insertMember("Id", HOFFSET(StateBranch2_t, Id),
>> PredType::NATIVE_INT64);
>>         comp.insertMember("CoreId", HOFFSET(StateBranch2_t, CoreId),
>> PredType::NATIVE_INT8);
>>         comp.insertMember("ICount", HOFFSET(StateBranch2_t, ICount),
>> PredType::NATIVE_INT64);
>>         comp.insertMember("GuestICount", HOFFSET(StateBranch2_t,
>> GuestICount), PredType::NATIVE_INT64);
>>         comp.insertMember("PC", HOFFSET(StateBranch2_t, PC),
>> PredType::NATIVE_INT64);
>>         comp.insertMember("taken", HOFFSET(StateBranch2_t, taken),
>> PredType::NATIVE_INT8);
>>         comp.insertMember("flags", HOFFSET(StateBranch2_t, flags),
>> PredType::NATIVE_UINT8);
>>         comp.insertMember("fromAddr", HOFFSET(StateBranch2_t, fromAddr),
>> PredType::NATIVE_UINT32);
>>         comp.insertMember("fromAddrInCC", HOFFSET(StateBranch2_t,
>> fromAddrInCC), PredType::NATIVE_INT8);
>>         comp.insertMember("toAddr", HOFFSET(StateBranch2_t, toAddr),
>> PredType::NATIVE_UINT32);
>>         comp.insertMember("toAddrInCC", HOFFSET(StateBranch2_t,
>> toAddrInCC), PredType::NATIVE_INT8);
>>         comp.insertMember("toGuestAddr", HOFFSET(StateBranch2_t,
>> toGuestAddr), PredType::NATIVE_INT64);
>>
>>         dataset.read(readdata, comp);
>>
>> Does anybody see what's wrong here / can help / give me a tip?
>>
>> Regards, Thanks,
>> Hendrik
>>
>
>
> _______________________________________________
> Hdf-forum is for HDF software users discussion.
> [email protected]
> http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
> Twitter: https://twitter.com/hdf5
>
_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5

Reply via email to