Commit a966ca31 authored by whitlocb's avatar whitlocb
Browse files

Fixed some errors flagged in Klockworks.


git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@3240 18c085ea-50e0-402c-830e-de6fd14e8384
parent 3614b441
......@@ -53,7 +53,7 @@ const char *AnnotationObjectList::TypeMapFormatString = "a*";
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Dec 20 09:40:33 PDT 2007
// Creation: Fri Feb 15 15:36:18 PST 2008
//
// Modifications:
//
......@@ -73,7 +73,7 @@ AnnotationObjectList::AnnotationObjectList() :
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Dec 20 09:40:33 PDT 2007
// Creation: Fri Feb 15 15:36:18 PST 2008
//
// Modifications:
//
......@@ -112,7 +112,7 @@ AnnotationObjectList::AnnotationObjectList(const AnnotationObjectList &obj) :
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Dec 20 09:40:33 PDT 2007
// Creation: Fri Feb 15 15:36:18 PST 2008
//
// Modifications:
//
......@@ -136,7 +136,7 @@ AnnotationObjectList::~AnnotationObjectList()
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Dec 20 09:40:33 PDT 2007
// Creation: Fri Feb 15 15:36:18 PST 2008
//
// Modifications:
//
......@@ -177,7 +177,7 @@ AnnotationObjectList::operator = (const AnnotationObjectList &obj)
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Dec 20 09:40:33 PDT 2007
// Creation: Fri Feb 15 15:36:18 PST 2008
//
// Modifications:
//
......@@ -210,7 +210,7 @@ AnnotationObjectList::operator == (const AnnotationObjectList &obj) const
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Dec 20 09:40:33 PDT 2007
// Creation: Fri Feb 15 15:36:18 PST 2008
//
// Modifications:
//
......@@ -231,7 +231,7 @@ AnnotationObjectList::operator != (const AnnotationObjectList &obj) const
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Dec 20 09:40:33 PDT 2007
// Creation: Fri Feb 15 15:36:18 PST 2008
//
// Modifications:
//
......@@ -252,7 +252,7 @@ AnnotationObjectList::TypeName() const
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Dec 20 09:40:33 PDT 2007
// Creation: Fri Feb 15 15:36:18 PST 2008
//
// Modifications:
//
......@@ -280,7 +280,7 @@ AnnotationObjectList::CopyAttributes(const AttributeGroup *atts)
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Dec 20 09:40:33 PDT 2007
// Creation: Fri Feb 15 15:36:18 PST 2008
//
// Modifications:
//
......@@ -306,7 +306,7 @@ AnnotationObjectList::CreateCompatible(const std::string &tname) const
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Dec 20 09:40:33 PDT 2007
// Creation: Fri Feb 15 15:36:18 PST 2008
//
// Modifications:
//
......@@ -333,7 +333,7 @@ AnnotationObjectList::NewInstance(bool copy) const
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Dec 20 09:40:33 PDT 2007
// Creation: Fri Feb 15 15:36:18 PST 2008
//
// Modifications:
//
......@@ -354,7 +354,7 @@ AnnotationObjectList::SelectAll()
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Dec 20 09:40:33 PDT 2007
// Creation: Fri Feb 15 15:36:18 PST 2008
//
// Modifications:
//
......@@ -379,7 +379,7 @@ AnnotationObjectList::CreateSubAttributeGroup(int)
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Dec 20 09:40:33 PDT 2007
// Creation: Fri Feb 15 15:36:18 PST 2008
//
// Modifications:
//
......@@ -422,7 +422,7 @@ AnnotationObjectList::CreateNode(DataNode *parentNode, bool completeSave, bool f
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Dec 20 09:40:33 PDT 2007
// Creation: Fri Feb 15 15:36:18 PST 2008
//
// Modifications:
//
......@@ -447,13 +447,16 @@ AnnotationObjectList::SetFromNode(DataNode *parentNode)
// Go through all of the children and construct a new
// AnnotationObject for each one of them.
children = searchNode->GetChildren();
for(i = 0; i < searchNode->GetNumChildren(); ++i)
if(children != 0)
{
if(children[i]->GetKey() == std::string("AnnotationObject"))
for(i = 0; i < searchNode->GetNumChildren(); ++i)
{
AnnotationObject temp;
temp.SetFromNode(children[i]);
AddAnnotation(temp);
if(children[i]->GetKey() == std::string("AnnotationObject"))
{
AnnotationObject temp;
temp.SetFromNode(children[i]);
AddAnnotation(temp);
}
}
}
......@@ -502,7 +505,7 @@ AnnotationObjectList::SelectAnnotation()
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Dec 20 09:40:33 PDT 2007
// Creation: Fri Feb 15 15:36:18 PST 2008
//
// Modifications:
//
......@@ -527,7 +530,7 @@ AnnotationObjectList::AddAnnotation(const AnnotationObject &obj)
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Dec 20 09:40:33 PDT 2007
// Creation: Fri Feb 15 15:36:18 PST 2008
//
// Modifications:
//
......@@ -555,7 +558,7 @@ AnnotationObjectList::ClearAnnotations()
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Dec 20 09:40:33 PDT 2007
// Creation: Fri Feb 15 15:36:18 PST 2008
//
// Modifications:
//
......@@ -568,7 +571,7 @@ AnnotationObjectList::RemoveAnnotation(int index)
// Iterate through the vector "index" times.
for(int i = 0; i < index; ++i)
++pos;
if(pos != annotation.end()) ++pos;
// If pos is still a valid iterator, remove that element.
if(pos != annotation.end())
......@@ -590,7 +593,7 @@ AnnotationObjectList::RemoveAnnotation(int index)
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Dec 20 09:40:33 PDT 2007
// Creation: Fri Feb 15 15:36:18 PST 2008
//
// Modifications:
//
......@@ -611,7 +614,7 @@ AnnotationObjectList::GetNumAnnotations() const
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Dec 20 09:40:33 PDT 2007
// Creation: Fri Feb 15 15:36:18 PST 2008
//
// Modifications:
//
......@@ -632,7 +635,7 @@ AnnotationObjectList::GetAnnotation(int i)
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Dec 20 09:40:33 PDT 2007
// Creation: Fri Feb 15 15:36:18 PST 2008
//
// Modifications:
//
......@@ -653,7 +656,7 @@ AnnotationObjectList::GetAnnotation(int i) const
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Dec 20 09:40:33 PDT 2007
// Creation: Fri Feb 15 15:36:18 PST 2008
//
// Modifications:
//
......@@ -674,7 +677,7 @@ AnnotationObjectList::operator [] (int i)
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Dec 20 09:40:33 PDT 2007
// Creation: Fri Feb 15 15:36:18 PST 2008
//
// Modifications:
//
......@@ -699,7 +702,7 @@ AnnotationObjectList::operator [] (int i) const
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Dec 20 09:40:33 PDT 2007
// Creation: Fri Feb 15 15:36:18 PST 2008
//
// Modifications:
//
......@@ -724,7 +727,7 @@ AnnotationObjectList::GetFieldName(int index) const
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Dec 20 09:40:33 PDT 2007
// Creation: Fri Feb 15 15:36:18 PST 2008
//
// Modifications:
//
......@@ -749,7 +752,7 @@ AnnotationObjectList::GetFieldType(int index) const
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Dec 20 09:40:33 PDT 2007
// Creation: Fri Feb 15 15:36:18 PST 2008
//
// Modifications:
//
......@@ -774,7 +777,7 @@ AnnotationObjectList::GetFieldTypeName(int index) const
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Dec 20 09:40:33 PDT 2007
// Creation: Fri Feb 15 15:36:18 PST 2008
//
// Modifications:
//
......
......@@ -1418,25 +1418,32 @@ NetworkManager::SetGlobalCellCount(int netId, int cellCount)
// Mark C. Miller, Tue Jan 4 10:23:19 PST 2005
// Modified to get information for specific window
//
// Brad Whitlock, Fri Feb 15 15:30:31 PST 2008
// Test value of iterator.
//
// ****************************************************************************
int
NetworkManager::GetScalableThreshold(int windowID) const
{
int scalableAutoThreshold;
RenderingAttributes::TriStateMode scalableActivationMode;
int scalableAutoThreshold = RenderingAttributes::DEFAULT_SCALABLE_AUTO_THRESHOLD;
RenderingAttributes::TriStateMode scalableActivationMode =
(RenderingAttributes::TriStateMode)RenderingAttributes::DEFAULT_SCALABLE_ACTIVATION_MODE;
// since we're in a const method, we can't use the [] operator to index
// into the map directly becuase that operator will modify the map if the
// key is new
std::map<int, EngineVisWinInfo>::const_iterator it;
it = viswinMap.find(windowID);
const EngineVisWinInfo &viswinInfo = it->second;
const WindowAttributes &windowAttributes = viswinInfo.windowAttributes;
if(it != viswinMap.end())
{
const EngineVisWinInfo &viswinInfo = it->second;
const WindowAttributes &windowAttributes = viswinInfo.windowAttributes;
scalableAutoThreshold =
windowAttributes.GetRenderAtts().GetScalableAutoThreshold();
scalableActivationMode =
windowAttributes.GetRenderAtts().GetScalableActivationMode();
scalableAutoThreshold =
windowAttributes.GetRenderAtts().GetScalableAutoThreshold();
scalableActivationMode =
windowAttributes.GetRenderAtts().GetScalableActivationMode();
}
int t = RenderingAttributes::GetEffectiveScalableThreshold(
scalableActivationMode,
......@@ -4372,6 +4379,9 @@ NetworkManager::CallProgressCallback(const char *module, const char *msg,
// Changed default format to PNG, to avoid patent issues with old TIFF
// libraries.
//
// Brad Whitlock, Fri Feb 15 15:27:21 PST 2008
// Delete fileWriter.
//
// ****************************************************************************
static void
DumpImage(avtDataObject_p img, const char *fmt, bool allprocs)
......@@ -4396,6 +4406,7 @@ DumpImage(avtDataObject_p img, const char *fmt, bool allprocs)
fileWriter->SetFormat(SaveWindowAttributes::PNG);
int compress = 1;
fileWriter->Write(tmpName, img, 100, false, compress, false);
delete fileWriter;
if (allprocs)
numDumpsAll++;
......
......@@ -1536,7 +1536,7 @@ FileServerList::OpenAndGetMetaData(const QualifiedFilename &filename,
// definition, which is only updated when we change the selected
// files. Copy the time step names over the virtual file
// definition.
if(newMetaData->GetIsVirtualDatabase())
if(newMetaData != 0 && newMetaData->GetIsVirtualDatabase())
{
const stringVector &states = newMetaData->GetTimeStepNames();
virtualFiles[filename.FullName()] = states;
......
......@@ -5196,6 +5196,9 @@ QvisGUIApplication::GetVirtualDatabaseDefinitions(
// The new method merges the old selected files list with the new, updated
// selected files list.
//
// Brad Whitlock, Fri Feb 15 14:53:27 PST 2008
// Fixed the comparison of the stringVectors.
//
// ****************************************************************************
void
......@@ -5288,7 +5291,7 @@ QvisGUIApplication::RefreshFileList()
// If the virtual file definitions are different then reopen the
// database on the viewer so that plots are reexecuted.
if(oldDef != newDef)
if(oldDef->second != newDef->second)
{
debug1 << "Telling the viewer to check " << fileName.c_str()
<< " for new time states." << endl;
......
......@@ -926,6 +926,9 @@ MDServerConnection::GetCurrentSIL() const
// Enhancements to attribute groups allowed separate vectors for the
// read and write options, so I switched to this simpler organization.
//
// Brad Whitlock, Fri Feb 15 15:23:49 PST 2008
// Protect a with NULL test.
//
// ****************************************************************************
DBPluginInfoAttributes *
......@@ -949,11 +952,17 @@ MDServerConnection::GetDBPluginInfo()
hasWriter[i] = manager->PluginHasWriter(fullname);
CommonDatabasePluginInfo *info =manager->GetCommonPluginInfo(fullname);
DBOptionsAttributes *a = info->GetReadOptions();
rv->AddDbReadOptions(*a);
delete a;
if(a != 0)
{
rv->AddDbReadOptions(*a);
delete a;
}
a = info->GetWriteOptions();
rv->AddDbWriteOptions(*a);
delete a;
if(a != 0)
{
rv->AddDbWriteOptions(*a);
delete a;
}
}
rv->SetTypes(types);
rv->SetTypesFullNames(fullnames);
......@@ -1350,6 +1359,9 @@ MDServerConnection::ReadCWD()
// I moved the code to stat files out of this method so we now just get
// file list (on UNIX anyway).
//
// Brad Whitlock, Fri Feb 15 15:20:21 PST 2008
// Protect closedir() with NULL test.
//
// ****************************************************************************
void
......@@ -1457,10 +1469,10 @@ MDServerConnection::ReadFileList()
fl.sizes.push_back(0);
fl.access.push_back(1);
}
closedir(dir);
}
visitTimer->StopTimer(timeid, "Copying filenames");
closedir(dir);
#endif
// Sort the file list.
......
......@@ -186,6 +186,9 @@ IndexSelectViewerPluginInfo::GetClientAtts(AttributeSubject *atts)
// Kathleen Bonnell, Thu Jun 7 10:18:37 PDT 2007
// Add logic to retrieve sbuset and category names from SIL.
//
// Brad Whitlock, Fri Feb 15 15:15:01 PST 2008
// Delete silAtts.
//
// ****************************************************************************
void
......@@ -261,7 +264,9 @@ IndexSelectViewerPluginInfo::InitializeOperatorAtts(AttributeSubject *atts,
}
}
}
}
}
delete silAtts;
}
}
......
......@@ -188,7 +188,10 @@ OnionPeelViewerPluginInfo::GetClientAtts(AttributeSubject *atts)
//
// Kathleen Bonnell, Thu Jan 26 07:33:29 PST 2006
// Add silTopSet to argslist for GetCollectionIndex.
//
//
// Brad Whitlock, Fri Feb 15 15:32:57 PST 2008
// Delete silAtts.
//
// ****************************************************************************
void
......@@ -265,7 +268,9 @@ OnionPeelViewerPluginInfo::InitializeOperatorAtts(AttributeSubject *atts,
}
}
}
}
}
delete silAtts;
}
}
......
......@@ -181,6 +181,10 @@ using std::vector;
// Brad Whitlock, Fri Dec 14 14:13:02 PST 2007
// Add case identifiers for fields.
//
// Brad Whitlock, Fri Feb 15 15:01:39 PST 2008
// Added some tests that should prevent source from being flagged as an
// error in Klockwork.
//
// ****************************************************************************
// ----------------------------------------------------------------------------
......@@ -1173,13 +1177,16 @@ class AttsGeneratorAttVector : public virtual AttVector , public virtual AttsGen
c << " // " << attType << " for each one of them." << endl;
c << " children = searchNode->GetChildren();" << endl;
c << " for(i = 0; i < searchNode->GetNumChildren(); ++i)" << endl;
c << " if(children != 0)" << endl;
c << " {" << endl;
c << " if(children[i]->GetKey() == std::string(\"" << attType << "\"))" << endl;
c << " for(i = 0; i < searchNode->GetNumChildren(); ++i)" << endl;
c << " {" << endl;
c << " " << attType << " temp;" << endl;
c << " temp.SetFromNode(children[i]);" << endl;
c << " Add" << Name << "(temp);" << endl;
c << " if(children[i]->GetKey() == std::string(\"" << attType << "\"))" << endl;
c << " {" << endl;
c << " " << attType << " temp;" << endl;
c << " temp.SetFromNode(children[i]);" << endl;
c << " Add" << Name << "(temp);" << endl;
c << " }" << endl;
c << " }" << endl;
c << " }" << endl << endl;
}
......@@ -1233,7 +1240,7 @@ class AttsGeneratorAttVector : public virtual AttVector , public virtual AttsGen
c << endl;
c << " // Iterate through the vector \"index\" times. " << endl;
c << " for(int i = 0; i < index; ++i)" << endl;
c << " ++pos;" << endl;
c << " if(pos != " << name << ".end()) ++pos;" << endl;
c << endl;
c << " // If pos is still a valid iterator, remove that element." << endl;
c << " if(pos != " << name << ".end())" << endl;
......
......@@ -595,7 +595,7 @@ LineoutListItem::HandleTool(const avtToolInterface &ti)
bool
LineoutListItem::InitializeTool(avtToolInterface &ti)
{
bool success;
bool success = false;
for (int i = 0; i < nQueries; i++)
{
if (queries[i]->CanHandleTool())
......
......@@ -3774,6 +3774,9 @@ ViewerSubject::CreateAttributesDataNode(const avtDefaultPlotMetaData *dp) const
// Brad Whitlock, Thu Jan 24 12:00:29 PDT 2008
// Added argument to ViewerPlotList::AddPlot().
//
// Brad Whitlock, Fri Feb 15 14:54:34 PST 2008
// Delete the adn from the default plot.
//
// ****************************************************************************
int
......@@ -4036,6 +4039,9 @@ ViewerSubject::OpenDatabaseHelper(const std::string &entireDBName,
plotList->AddPlot(type, dp->plotVar, false, false, true, adn);
defaultPlotsAdded = true;
}
if(adn != 0)
delete adn;
}
//
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment