E57SimpleReader fails on reading uint16_t colours
asmaloney opened this issue · 1 comments
asmaloney commented
(This was reported by @ollira.)
The Data3DPointsData_t
struct contains fields for colours as follows:
uint8_t *colorRed = nullptr; //!< Pointer to a buffer with the Red color coefficient. Unit is unspecified
uint8_t *colorGreen = nullptr; //!< Pointer to a buffer with the Green color coefficient. Unit is unspecified
uint8_t *colorBlue = nullptr; //!< Pointer to a buffer with the Blue color coefficient. Unit is unspecified
When reading a file with colours stored as uint16_t
, E57SimpleReader fails with an exception:
ERROR: **** Got an e57 exception: a value could not be represented in the requested type (E57_ERROR_VALUE_NOT_REPRESENTABLE)
Debug info:
context: pathName=colorRed value=65280
sourceFunctionName: e57::SourceDestBufferImpl::setNextInt64
This is because the implicit conversions don't know how to convert uint16_t
to uint8_t
.
While this seems to be "working as intended", it seems reasonable to change this so that E57SimpleReader can handle more variations.
The proposed solution is to change the fields in the Data3DPointsData_t
struct to uint16_t
. From an API standpoint, this would be a breaking change.