Opened 3 hours ago

Last modified 3 hours ago

#19444 new enhancement

explicit attribute type compatibility checking and conversion

Reported by: grexe Owned by: nobody
Priority: normal Milestone: Unscheduled
Component: Kits/Storage Kit Version: R1/Development
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description (last modified by grexe)

BNode::WriteAttr() does not report type compatibility but silently clears values of different type, even if they could be converted relatively easily.

Case in point: double vs. int

I have a value from an external service (JSON) in double format, for whatever reason they use double for Years (!). So the fraction is always .0. When converting to type Media:Year which is int32, the value gets silently set to 0.

This creates hard to spot subtle errors and should be reported in a dedicated result code of WriteAttr, e.g. B_BAD_TYPE.

Even better yet, at least for simple cases like this one, attribute values should be converted to the target type.

Change History (1)

comment:1 by grexe, 3 hours ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.