Skip to content
This repository has been archived by the owner on Sep 1, 2023. It is now read-only.

NTA_CHECK assertion incorrect in VectorFileSensor #1416

Open
sjgallagher2 opened this issue Apr 10, 2018 · 2 comments
Open

NTA_CHECK assertion incorrect in VectorFileSensor #1416

sjgallagher2 opened this issue Apr 10, 2018 · 2 comments

Comments

@sjgallagher2
Copy link

sjgallagher2 commented Apr 10, 2018

Noticed that in the VectorFileSensor.cpp function setParameterFromBuffer:328 it seems the NTA_CHECK assertion is backwards in some places. For example:

void VectorFileSensor::setParameterFromBuffer(const std::string& name, Int64 index, IReadBuffer& value)
...
  if (name == "repeatCount")
  {
    NTA_CHECK(value.read(int_param) == 0)
      << where << "Unable to read repeatCount: "
      << int_param << " - Should be a positive integer";

It appears that this checks if the supplied value is 0, and otherwise it throws a 'positive integer' error. Shouldn't this be:

    NTA_CHECK(value.read(int_param) > 0)
      << where << "Unable to read repeatCount: "
      << int_param << " - Should be a positive integer"; 

Or maybe I'm confused about how to use NTA_CHECK or value.read().

@sjgallagher2 sjgallagher2 changed the title NTA_CHECK assertion correct in VectorFileSensor NTA_CHECK assertion incorrect in VectorFileSensor Apr 11, 2018
@rhyolight
Copy link
Member

@scottpurdy or @lscheinkman do you guys know how NTA_CHECK works?

@scottpurdy
Copy link
Contributor

The expression inside NTA_CHECK() should evaluate to true when the code and inputs are correct. I'm not sure if the listed check is incorrect though. The comment says that int_param should be a positive integer, not the return value of read.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants