[Image] [Inspection] remove superfluous nullptr checks
This commit is contained in:
@@ -201,7 +201,7 @@ int ImageBase::_setColorFormat(int format, unsigned short numSigBitsPerSample)
|
||||
int ImageBase::_allocate()
|
||||
{
|
||||
// Check that pixel data pointer is null
|
||||
if (_pPixelData != nullptr)
|
||||
if (_pPixelData)
|
||||
return -1;
|
||||
|
||||
// Allocate the space needed to store the pixel data
|
||||
@@ -296,7 +296,7 @@ int ImageBase::pointTo(void* pSrcPixelData, unsigned long width, unsigned long h
|
||||
// if there is no image data
|
||||
int ImageBase::getSample(int x, int y, unsigned short sampleIndex, double &value)
|
||||
{
|
||||
if ((_pPixelData == nullptr) ||
|
||||
if ((!_pPixelData) ||
|
||||
(sampleIndex >= _numSamples) ||
|
||||
(x < 0) || (x >= (int)_width) ||
|
||||
(y < 0) || (y >= (int)_height))
|
||||
|
||||
@@ -243,7 +243,7 @@ void GLImageBox::drawImage()
|
||||
glPixelTransferf(GL_BLUE_SCALE, (float)scale);
|
||||
|
||||
// Load the color map if present
|
||||
if (_pColorMap != nullptr)
|
||||
if (_pColorMap)
|
||||
{
|
||||
if (!haveMesa) glPixelTransferf(GL_MAP_COLOR, 1.0);
|
||||
glPixelMapfv(GL_PIXEL_MAP_R_TO_R, _numMapEntries, _pColorMap);
|
||||
@@ -851,7 +851,7 @@ int GLImageBox::setColorMapAlphaValue(int index, float value)
|
||||
// Helper function to convert a pixel's value (of a sample) to the color map index (i.e. the map index that will be used for that pixel value)
|
||||
unsigned int GLImageBox::pixValToMapIndex(double PixVal)
|
||||
{
|
||||
if (_pColorMap != nullptr)
|
||||
if (_pColorMap)
|
||||
{
|
||||
double MaxVal = pow(2.0, _image.getNumBitsPerSample()) - 1.0;
|
||||
double Scale = (pow(2.0, _image.getNumBitsPerSample()) - 1.0) / (pow(2.0, _image.getNumSigBitsPerSample()) - 1.0);
|
||||
|
||||
@@ -478,7 +478,7 @@ private:
|
||||
if (usePolyline == Py_True) {
|
||||
polyOverride = true;
|
||||
}
|
||||
if (optionSource != nullptr) {
|
||||
if (optionSource) {
|
||||
defaultOptions = optionSource;
|
||||
}
|
||||
|
||||
@@ -527,7 +527,7 @@ private:
|
||||
if (usePolyline == Py_True) {
|
||||
polyOverride = true;
|
||||
}
|
||||
if (optionSource != nullptr) {
|
||||
if (optionSource) {
|
||||
defaultOptions = optionSource;
|
||||
}
|
||||
|
||||
@@ -587,7 +587,7 @@ private:
|
||||
polyOverride = true;
|
||||
}
|
||||
|
||||
if (optionSource != nullptr) {
|
||||
if (optionSource) {
|
||||
defaultOptions = optionSource;
|
||||
}
|
||||
|
||||
@@ -641,7 +641,7 @@ private:
|
||||
polyOverride = true;
|
||||
}
|
||||
|
||||
if (optionSource != nullptr) {
|
||||
if (optionSource) {
|
||||
defaultOptions = optionSource;
|
||||
}
|
||||
|
||||
|
||||
@@ -479,7 +479,7 @@ void ViewProviderInspection::inspectCallback(void * ud, SoEventCallback * n)
|
||||
}
|
||||
else if (mbe->getButton() == SoMouseButtonEvent::BUTTON1 && mbe->getState() == SoButtonEvent::UP) {
|
||||
const SoPickedPoint * point = n->getPickedPoint();
|
||||
if (point == nullptr) {
|
||||
if (!point) {
|
||||
Base::Console().Message("No point picked.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user