Skip to content

Commit

Permalink
fix coverity issues
Browse files Browse the repository at this point in the history
  • Loading branch information
devernay committed Mar 19, 2018
1 parent ebbe1ac commit 5e937f8
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 29 deletions.
4 changes: 2 additions & 2 deletions CImg/CImgOperator.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ CImgOperatorPluginHelper<Params>::render(const OFX::RenderArguments &args)
srcAPixelData = srcA->getPixelData();
srcABounds = srcA->getBounds();
// = src->getRegionOfDefinition(); // Nuke's image RoDs are wrong
if (_supportsTiles) {
if (_supportsTiles && _srcAClip) {
OFX::Coords::toPixelEnclosing(_srcAClip->getRegionOfDefinition(time), args.renderScale, _srcAClip->getPixelAspectRatio(), &srcARoD);
} else {
// In Sony Catalyst Edit, clipGetRegionOfDefinition returns the RoD in pixels instead of canonical coordinates.
Expand Down Expand Up @@ -241,7 +241,7 @@ CImgOperatorPluginHelper<Params>::render(const OFX::RenderArguments &args)
srcBPixelData = srcB->getPixelData();
srcBBounds = srcB->getBounds();
// = srcB->getRegionOfDefinition(); // Nuke's image RoDs are wrong
if (_supportsTiles) {
if (_supportsTiles && _srcBClip) {
OFX::Coords::toPixelEnclosing(_srcBClip->getRegionOfDefinition(time), args.renderScale, _srcBClip->getPixelAspectRatio(), &srcBRoD);
} else {
// In Sony Catalyst Edit, clipGetRegionOfDefinition returns the RoD in pixels instead of canonical coordinates.
Expand Down
8 changes: 5 additions & 3 deletions CImg/Matrix/CImgMatrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ class CImgMatrixPlugin
for (int i = 0; i < dim; ++i) {
for (int j = 0; j < dim; ++j) {
bool isIdentityCoeff = false;
if (i == (dim-1)/2 && j == (dim-1/2) ) {
if (i == (dim-1)/2 && j == (dim-1)/2 ) {
if ( (params.coeff[i*dim + j] == 1.) ||
(params.coeff[i*dim + j] != 0. && params.normalize) ) {
isIdentityCoeff = true;
Expand Down Expand Up @@ -327,8 +327,10 @@ CImgMatrixPluginFactory<dim>::describeInContext(ImageEffectDescriptor& desc,

{
GroupParamDescriptor* group = desc.defineGroupParam(kParamMatrix);
group->setLabelAndHint(kParamMatrixLabel);
group->setOpen(true);
if (group) {
group->setLabelAndHint(kParamMatrixLabel);
group->setOpen(true);
}
for (int i = 0; i < dim; ++i) {
for (int j = 0; j < dim; ++j) {
DoubleParamDescriptor* param = desc.defineDoubleParam(std::string(kParamMatrix) + (char)('1' + i) + (char)('1' + j));
Expand Down
27 changes: 15 additions & 12 deletions Card3D/Card3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1082,13 +1082,15 @@ PosMatParam::define(ImageEffectDescriptor &desc,
{
{
GroupParamDescriptor* subgroup = desc.defineGroupParam(prefix + kParamPosMatFile);
subgroup->setLabelAndHint(kParamPosMatFileLabel);
subgroup->setOpen(false);
if (group) {
subgroup->setParent(*group);
}
if (page) {
page->addChild(*subgroup);
if (subgroup) {
subgroup->setLabelAndHint(kParamPosMatFileLabel);
subgroup->setOpen(false);
if (group) {
subgroup->setParent(*group);
}
if (page) {
page->addChild(*subgroup);
}
}
{
ChoiceParamDescriptor* param = desc.defineChoiceParam(prefix + kParamPosMatImportFormat);
Expand Down Expand Up @@ -2074,12 +2076,13 @@ Card3DPluginFactory::describeInContext(ImageEffectDescriptor &desc,
}
{
GroupParamDescriptor* group = desc.defineGroupParam(kCameraCam);
group->setLabel(kCameraCamLabel);
group->setOpen(false);
if (page) {
page->addChild(*group);
if (group) {
group->setLabel(kCameraCamLabel);
group->setOpen(false);
if (page) {
page->addChild(*group);
}
}

{
BooleanParamDescriptor* param = desc.defineBooleanParam(kParamCamEnable);
param->setLabelAndHint(kParamCamEnableLabel);
Expand Down
11 changes: 8 additions & 3 deletions LayerContactSheet/LayerContactSheet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,11 @@ LayerContactSheetPlugin::render(const OFX::RenderArguments &args)
OfxRectD srcFormatCanonical;
{
OfxRectI srcFormat;
_srcClip->getFormat(srcFormat);
double srcPar = _srcClip->getPixelAspectRatio();
double srcPar = 1.;
if (_srcClip) {
_srcClip->getFormat(srcFormat);
srcPar = _srcClip->getPixelAspectRatio();
}
if ( OFX::Coords::rectIsEmpty(srcFormat) ) {
// no format is available, use the RoD instead
srcFormatCanonical = _srcClip->getRegionOfDefinition(time);
Expand All @@ -297,7 +300,9 @@ LayerContactSheetPlugin::render(const OFX::RenderArguments &args)
}

std::vector<std::string> planes;
_srcClip->getPlanesPresent(&planes);
if (_srcClip) {
_srcClip->getPlanesPresent(&planes);
}

// now, for each clip, compute the required region of interest, which is the union of the intersection of each cell with the renderWindow
int rows, columns;
Expand Down
18 changes: 12 additions & 6 deletions Shuffle/Shuffle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,7 @@ ShufflePlugin::setupAndProcess(ShufflerBase &processor,
}
srcBitDepth = srcDefault->getPixelDepth();
srcComponents = srcDefault->getPixelComponents();
assert(_srcClipDefault->getPixelComponents() == srcComponents);
assert(_srcClipDefault && _srcClipDefault->getPixelComponents() == srcComponents);
}

if ( srcOther.get() ) {
Expand All @@ -927,7 +927,7 @@ ShufflePlugin::setupAndProcess(ShufflerBase &processor,
}
BitDepthEnum srcOtherBitDepth = srcOther->getPixelDepth();
PixelComponentEnum srcOtherComponents = srcOther->getPixelComponents();
assert(_srcClipOther->getPixelComponents() == srcOtherComponents);
assert(_srcClipOther && _srcClipOther->getPixelComponents() == srcOtherComponents);
// both input must have the same bit depth and components
if ( ( (srcBitDepth != eBitDepthNone) && (srcBitDepth != srcOtherBitDepth) ) ||
( ( srcComponents != ePixelComponentNone) && ( srcComponents != srcOtherComponents) ) ) {
Expand Down Expand Up @@ -1399,9 +1399,15 @@ ShufflePlugin::getClipPreferences(ClipPreferencesSetter &clipPreferences)
//dstPixelComps = mapStrToPixelComponentEnum(MultiPlane::ImagePlaneDesc::mapPlaneToOFXComponentsTypeString(colorPlaneMapped));
dstPixelComps = srcDefaultComps;
}
clipPreferences.setClipComponents(*_dstClip, dstPixelComps);
clipPreferences.setClipComponents(*_srcClipDefault, srcDefaultComps);
clipPreferences.setClipComponents(*_srcClipOther, srcOtherComps);
if (_dstClip) {
clipPreferences.setClipComponents(*_dstClip, dstPixelComps);
}
if (_srcClipDefault) {
clipPreferences.setClipComponents(*_srcClipDefault, srcDefaultComps);
}
if (_srcClipOther) {
clipPreferences.setClipComponents(*_srcClipOther, srcOtherComps);
}

if (getImageEffectHostDescription()->supportsMultipleClipDepths) {
// set the bitDepth of _dstClip
Expand Down Expand Up @@ -1873,7 +1879,7 @@ ShufflePluginFactory<majorVersion>::describeInContext(ImageEffectDescriptor &des
#endif
srcClipB->setTemporalClipAccess(false);
srcClipB->setSupportsTiles(kSupportsTiles);
srcClipB->setOptional(this->getMajorVersion() < 3 ? true : true);
srcClipB->setOptional(/*this->getMajorVersion() < 3 ? true : */true);

ClipDescriptor* srcClipA = desc.defineClip(kClipA);
srcClipA->addSupportedComponent(ePixelComponentRGBA);
Expand Down
4 changes: 2 additions & 2 deletions SlitScan/SlitScan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class SourceImages
: _effect(effect)
, _srcClip(srcClip)
{
if (!_srcClip->isConnected()) {
if (_srcClip && !_srcClip->isConnected()) {
_srcClip = NULL;
}
}
Expand Down Expand Up @@ -762,7 +762,7 @@ SlitScanPlugin::setupAndProcess(SlitScanProcessorBase &processor,
}
}
} else {
retimeMap.reset( _retimeMapClip->fetchImage(time) );
retimeMap.reset(_retimeMapClip ? _retimeMapClip->fetchImage(time) : NULL);
assert(retimeMap->getPixelComponents() == ePixelComponentAlpha);
processor.setRetimeMap( retimeMap.get() );

Expand Down
2 changes: 1 addition & 1 deletion Test/TestOpenGLRender.h
Original file line number Diff line number Diff line change
Expand Up @@ -1250,7 +1250,7 @@ TestOpenGLPlugin::RENDERFUNC(const OFX::RenderArguments &args)
GLenum srcTarget = GL_TEXTURE_2D;
GLuint srcIndex = 0;
# ifdef USE_OPENGL
if (args.openGLEnabled) {
if (args.openGLEnabled && srcTexture) {
// (OpenGL direct rendering only)
srcIndex = (GLuint)srcTexture->getIndex();
srcTarget = (GLenum)srcTexture->getTarget();
Expand Down

0 comments on commit 5e937f8

Please sign in to comment.