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 14, 2016
1 parent de1123a commit 8b0e6ac
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions AppendClip/AppendClip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ class AppendClipPlugin
assert(i < 1000);
name[0] = (i < 10) ? ('0' + i) : ((i < 100) ? ('0' + i / 10) : ('0' + i / 100));
name[1] = (i < 10) ? 0 : ((i < 100) ? ('0' + i % 10) : ('0' + ((i/10)%10)));
// coverity[dead_error_line]
name[2] = (i < 10) ? 0 : ((i < 100) ? 0 : ('0' + i % 10));
_srcClip[j] = fetchClip(name);
}
Expand Down Expand Up @@ -927,6 +928,7 @@ AppendClipPluginFactory::describeInContext(OFX::ImageEffectDescriptor &desc,
assert(i < 1000);
name[0] = (i < 10) ? ('0' + i) : ((i < 100) ? ('0' + i / 10) : ('0' + i / 100));
name[1] = (i < 10) ? 0 : ((i < 100) ? ('0' + i % 10) : ('0' + ((i/10)%10)));
// coverity[dead_error_line]
name[2] = (i < 10) ? 0 : ((i < 100) ? 0 : ('0' + i % 10));
srcClip = desc.defineClip(name);
srcClip->setOptional(true);
Expand Down
2 changes: 2 additions & 0 deletions Dissolve/Dissolve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ class DissolvePlugin
char name[4] = { 0, 0, 0, 0 }; // don't use std::stringstream (not thread-safe on OSX)
name[0] = (i < 10) ? ('0' + i) : ((i < 100) ? ('0' + i / 10) : ('0' + i / 100));
name[1] = (i < 10) ? 0 : ((i < 100) ? ('0' + i % 10) : ('0' + ((i/10)%10)));
// coverity[dead_error_line]
name[2] = (i < 10) ? 0 : ((i < 100) ? 0 : ('0' + i % 10));
_srcClip[i] = fetchClip(name);
}
Expand Down Expand Up @@ -553,6 +554,7 @@ DissolvePluginFactory::describeInContext(OFX::ImageEffectDescriptor &desc,
char name[4] = { 0, 0, 0, 0 }; // don't use std::stringstream (not thread-safe on OSX)
name[0] = (i < 10) ? ('0' + i) : ((i < 100) ? ('0' + i / 10) : ('0' + i / 100));
name[1] = (i < 10) ? 0 : ((i < 100) ? ('0' + i % 10) : ('0' + ((i/10)%10)));
// coverity[dead_error_line]
name[2] = (i < 10) ? 0 : ((i < 100) ? 0 : ('0' + i % 10));
srcClip = desc.defineClip(name);
srcClip->setOptional(true);
Expand Down
1 change: 1 addition & 0 deletions Merge/Merge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1171,6 +1171,7 @@ MergePluginFactory<plugin>::describeInContext(OFX::ImageEffectDescriptor &desc,
assert(i < 1000);
name[1] = (i < 10) ? ('0' + i) : ((i < 100) ? ('0' + i / 10) : ('0' + i / 100));
name[2] = (i < 10) ? 0 : ((i < 100) ? ('0' + i % 10) : ('0' + ((i/10)%10)));
// coverity[dead_error_line]
name[3] = (i < 10) ? 0 : ((i < 100) ? 0 : ('0' + i % 10));
OFX::ClipDescriptor* optionalSrcClip = desc.defineClip(name);
optionalSrcClip->addSupportedComponent( OFX::ePixelComponentRGBA );
Expand Down
2 changes: 2 additions & 0 deletions Switch/Switch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ SwitchPlugin::SwitchPlugin(OfxImageEffectHandle handle, bool numerousInputs)
char name[4] = { 0, 0, 0, 0 }; // don't use std::stringstream (not thread-safe on OSX)
name[0] = (i < 10) ? ('0' + i) : ((i < 100) ? ('0' + i / 10) : ('0' + i / 100));
name[1] = (i < 10) ? 0 : ((i < 100) ? ('0' + i % 10) : ('0' + ((i/10)%10)));
// coverity[dead_error_line]
name[2] = (i < 10) ? 0 : ((i < 100) ? 0 : ('0' + i % 10));
_srcClip[i] = fetchClip(name);
}
Expand Down Expand Up @@ -434,6 +435,7 @@ void SwitchPluginFactory::describeInContext(OFX::ImageEffectDescriptor &desc, OF
char name[4] = { 0, 0, 0, 0 }; // don't use std::stringstream (not thread-safe on OSX)
name[0] = (i < 10) ? ('0' + i) : ((i < 100) ? ('0' + i / 10) : ('0' + i / 100));
name[1] = (i < 10) ? 0 : ((i < 100) ? ('0' + i % 10) : ('0' + ((i/10)%10)));
// coverity[dead_error_line]
name[2] = (i < 10) ? 0 : ((i < 100) ? 0 : ('0' + i % 10));
srcClip = desc.defineClip(name);
srcClip->setOptional(true);
Expand Down
8 changes: 8 additions & 0 deletions TimeBuffer/TimeBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,19 +390,23 @@ class TimeBufferReadPlugin : public OFX::ImageEffect
if (!timeBuffer) {
setPersistentMessage(OFX::Message::eMessageError, "", std::string("No TimeBuffer exists with name \"")+_name+"\". Try using another name.");
throwSuiteStatusException(kOfxStatFailed);
return NULL;
}
if (timeBuffer && !timeBuffer->readInstance) {
setPersistentMessage(OFX::Message::eMessageError, "", std::string("Another TimeBufferRead already exists with name \"")+_name+"\". Try using another name.");
throwSuiteStatusException(kOfxStatFailed);
return NULL;
}
if (timeBuffer && timeBuffer->readInstance && timeBuffer->readInstance != this) {
// a buffer already exists with that name
setPersistentMessage(OFX::Message::eMessageError, "", std::string("Another TimeBufferRead already exists with name \"")+_name+"\". Try using another name.");
throwSuiteStatusException(kOfxStatFailed);
return NULL;
}
if (timeBuffer && !timeBuffer->writeInstance) {
setPersistentMessage(OFX::Message::eMessageError, "", std::string("No TimeBufferWrite exists with name \"")+_name+"\". Create one and connect it to this TimeBufferRead via the Sync input.");
throwSuiteStatusException(kOfxStatFailed);
return NULL;
}
return timeBuffer;
}
Expand Down Expand Up @@ -447,6 +451,7 @@ TimeBufferReadPlugin::render(const OFX::RenderArguments &args)
(dst->getField() != OFX::eFieldNone /* for DaVinci Resolve */ && dst->getField() != args.fieldToRender)) {
setPersistentMessage(OFX::Message::eMessageError, "", "OFX Host gave image with wrong scale or field properties");
OFX::throwSuiteStatusException(kOfxStatFailed);
return;
}
OFX::BitDepthEnum dstBitDepth = dst->getPixelDepth();
OFX::PixelComponentEnum dstComponents = dst->getPixelComponents();
Expand All @@ -460,6 +465,7 @@ TimeBufferReadPlugin::render(const OFX::RenderArguments &args)
timeBuffer = getBuffer();
if (!timeBuffer) {
throwSuiteStatusException(kOfxStatFailed);
return;
}
int startFrame = _startFrame->getValue();
// * if t <= startTime:
Expand Down Expand Up @@ -562,6 +568,7 @@ TimeBufferReadPlugin::getClipPreferences(OFX::ClipPreferencesSetter &clipPrefere
TimeBuffer* timeBuffer = getBuffer();
if (!timeBuffer) {
throwSuiteStatusException(kOfxStatFailed);
return;
}
clearPersistentMessage();
clipPreferences.setOutputFrameVarying(true);
Expand All @@ -576,6 +583,7 @@ TimeBufferReadPlugin::getRegionOfDefinition(const OFX::RegionOfDefinitionArgumen
timeBuffer = getBuffer();
if (!timeBuffer) {
throwSuiteStatusException(kOfxStatFailed);
return;
}
// * if t <= startTime:
// - the RoD is empty
Expand Down

0 comments on commit 8b0e6ac

Please sign in to comment.