readingDataHandlerStringAS::getAge does not properly check for the age units

Issue #317 resolved
Paolo Brandoli repo owner created an issue

The check for the age units is wrong.

char unit = ageString[3];
if(
        unit != (char)ageUnit_t::days &&
        unit != (char)ageUnit_t::weeks &&
        unit == (char)ageUnit_t::months &&
        unit == (char)ageUnit_t::years)
{
    IMEBRA_THROW(DataHandlerCorruptedBufferError, "The AGE unit should be D, W, M or Y but is ascii code "<< (int)unit);
}

should be:

char unit = ageString[3];
if(
        unit != (char)ageUnit_t::days &&
        unit != (char)ageUnit_t::weeks &&
        unit != (char)ageUnit_t::months &&
        unit != (char)ageUnit_t::years)
{
    IMEBRA_THROW(DataHandlerCorruptedBufferError, "The AGE unit should be D, W, M or Y but is ascii code "<< (int)unit);
}

Comments (4)

  1. Log in to comment