Commit cf664687 authored by whitlocb's avatar whitlocb

Eliminate errors and warnings found using LLVM clang compiler.



git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@15652 18c085ea-50e0-402c-830e-de6fd14e8384
parent 304baa34
......@@ -54,6 +54,13 @@ static bool icDomainCompare(const avtIntegralCurve *icA,
return icA->sortKey < icB->sortKey;
}
std::ostream &
avtICAlgorithm::ICStatistics::operator << (std::ostream &out) const
{
out<<this->nm<<" V: "<<this->value<<" "<<this->total<<" ["<<this->min<<", "<<this->max<<", "<<this->mean<<" : "<<this->sigma<<"]";
return out;
}
// ****************************************************************************
// Method: avtICAlgorithm::avtICAlgorithm
//
......
......@@ -177,12 +177,7 @@ class avtICAlgorithm
float value;
std::string nm;
friend ostream& operator<<(std::ostream &out, const avtICAlgorithm::ICStatistics &s)
//friend ostream& operator<<(std::ostream &out)
{
out<<s.nm<<" V: "<<s.value<<" "<<s.total<<" ["<<s.min<<", "<<s.max<<", "<<s.mean<<" : "<<s.sigma<<"]";
return out;
}
ostream& operator<<(std::ostream &out) const;
};
virtual void ReportStatistics();
......
......@@ -78,7 +78,7 @@ avtIVPVTKTimeVaryingField::avtIVPVTKTimeVaryingField( vtkDataSet* dataset,
if( ds )
ds->Register( NULL );
if( velData[0] = ds->GetPointData()->GetVectors() )
if( (velData[0] = ds->GetPointData()->GetVectors()) )
{
velCellBased = false;
......@@ -86,7 +86,7 @@ avtIVPVTKTimeVaryingField::avtIVPVTKTimeVaryingField( vtkDataSet* dataset,
ds->GetPointData()
->GetArray( NextTimePrefix );
}
else if( velData[0] = ds->GetCellData()->GetVectors() )
else if( (velData[0] = ds->GetCellData()->GetVectors()) )
{
velCellBased = true;
......@@ -491,13 +491,13 @@ avtIVPVTKTimeVaryingField::SetScalarVariable(unsigned char index, const std::str
vtkDataArray* data[2] = { NULL, NULL };
bool cellBased;
if( data[0] = ds->GetPointData()->GetScalars( name.c_str() ) )
if( (data[0] = ds->GetPointData()->GetScalars( name.c_str() )) )
{
cellBased = false;
data[1] =
ds->GetPointData()->GetArray( (NextTimePrefix+name).c_str() );
}
else if( data[0] = ds->GetCellData()->GetScalars( name.c_str() ) )
else if( (data[0] = ds->GetCellData()->GetScalars( name.c_str() )) )
{
cellBased = true;
data[1] =
......
......@@ -1217,7 +1217,7 @@ avtDataRepresentation::DebugDump(avtWebpage *webpage, const char *prefix)
oss << "<ul>";
for (int i=0; i<data[fd]->GetNumberOfArrays(); i++)
{
char *arr_type = "<unknown>";
const char *arr_type = "<unknown>";
switch (data[fd]->GetArray(i)->GetDataType())
{
case VTK_CHAR:
......@@ -1270,7 +1270,7 @@ avtDataRepresentation::DebugDump(avtWebpage *webpage, const char *prefix)
}
}
SNPRINTF(str,strsize,oss.str().c_str());
SNPRINTF(str,strsize,"%s",oss.str().c_str());
return str;
}
......@@ -887,7 +887,7 @@ vtkVisItCubeAxesActor::ComputeLabelExponent(const double bnds[6])
this->mustAdjustXValue = false;
if (XUnits == NULL || XUnits[0] == '\0')
SNPRINTF(xTitle,64, this->XTitle);
SNPRINTF(xTitle,64, "%s", this->XTitle);
else
SNPRINTF(xTitle,64, "%s (%s)", this->XTitle, XUnits);
}
......@@ -924,7 +924,7 @@ vtkVisItCubeAxesActor::ComputeLabelExponent(const double bnds[6])
}
this->mustAdjustYValue = false;
if (YUnits == NULL || YUnits[0] == '\0')
SNPRINTF(yTitle,64, this->YTitle);
SNPRINTF(yTitle,64, "%s", this->YTitle);
else
SNPRINTF(yTitle,64, "%s (%s)", this->YTitle, YUnits);
}
......@@ -962,7 +962,7 @@ vtkVisItCubeAxesActor::ComputeLabelExponent(const double bnds[6])
this->mustAdjustZValue = false;
if (ZUnits == NULL || ZUnits[0] == '\0')
SNPRINTF(zTitle,64, this->ZTitle);
SNPRINTF(zTitle,64, "%s", this->ZTitle);
else
SNPRINTF(zTitle,64, "%s (%s)", this->ZTitle, ZUnits);
}
......
......@@ -683,12 +683,12 @@ vtkVisItScalarBarActor::BuildLabels(vtkViewport * viewport, double bo,
}
else
{
sprintf(labelString, this->definedLabels[idx].c_str() );
sprintf(labelString, "%s", this->definedLabels[idx].c_str() );
}
}
else if (lv && la)
{
sprintf(labelString, this->suppliedLabels[idx].c_str());
sprintf(labelString, "%s", this->suppliedLabels[idx].c_str());
}
else
{
......@@ -696,7 +696,7 @@ vtkVisItScalarBarActor::BuildLabels(vtkViewport * viewport, double bo,
}
}
else // not using supplied labels
sprintf(labelString, this->definedLabels[idx].c_str());
sprintf(labelString, "%s", this->definedLabels[idx].c_str());
this->LabelMappers[i]->SetInput(labelString);
}
break;
......
......@@ -677,20 +677,20 @@ VisWinAxes::UpdatePlotList(vector<avtActor_p> &list)
}
if(!userXUnits)
SNPRINTF(unitsX, 256, x.c_str());
SNPRINTF(unitsX, 256, "%s", x.c_str());
if(!userYUnits)
SNPRINTF(unitsY, 256, y.c_str());
SNPRINTF(unitsY, 256, "%s", y.c_str());
if(!userXTitle)
{
if (lx != "")
SNPRINTF(xTitle, 256, lx.c_str());
SNPRINTF(xTitle, 256, "%s", lx.c_str());
else
strcpy(xTitle, "X-Axis");
}
if(!userYTitle)
{
if (ly != "")
SNPRINTF(yTitle, 256, ly.c_str());
SNPRINTF(yTitle, 256, "%s", ly.c_str());
else
strcpy(yTitle, "Y-Axis");
}
......
......@@ -500,9 +500,9 @@ VisWinAxesArray::UpdatePlotList(vector<avtActor_p> &list)
axes[k].xpos = k;
axes[k].range[0] = extents[2*k+0];
axes[k].range[1] = extents[2*k+1];
SNPRINTF(axes[k].title, 256,
SNPRINTF(axes[k].title, 256, "%s",
atts.GetVariableSubnames(var)[k].c_str());
SNPRINTF(axes[k].units, 256,
SNPRINTF(axes[k].units, 256, "%s",
atts.GetVariableUnits(var).c_str());
}
delete[] extents;
......@@ -528,8 +528,8 @@ VisWinAxesArray::UpdatePlotList(vector<avtActor_p> &list)
atts.GetThisProcsOriginalDataExtents(var)->CopyTo(axes[axis].range);
axes[axis].xpos = axis;
SNPRINTF(axes[axis].title,256, var);
SNPRINTF(axes[axis].units,256, atts.GetVariableUnits(var).c_str());
SNPRINTF(axes[axis].title,256, "%s", var);
SNPRINTF(axes[axis].units,256, "%s", atts.GetVariableUnits(var).c_str());
}
}
}
......
......@@ -483,7 +483,7 @@ VisWinAxesParallel::UpdatePlotList(vector<avtActor_p> &list)
axes[i+1].xpos = i + 0.5;
axes[i+1].range[0] = extents[0];
axes[i+1].range[1] = extents[1];
SNPRINTF(axes[i+1].title, 256, labels[i].c_str());
SNPRINTF(axes[i+1].title, 256, "%s", labels[i].c_str());
}
}
}
......
......@@ -345,7 +345,7 @@ VisWinUserInfo::UpdateUserText()
//
// Get the user name.
//
char *user = NULL;
const char *user = NULL;
#if defined(_WIN32)
char username[100];
DWORD maxLen = 100;
......
......@@ -717,6 +717,9 @@ VisitHotPointInteractor::StartAxisParallelMode(INTERACTION_MODE mode)
}
newInteractor = pick;
break;
default:
newInteractor = NULL;
break;
}
if (newInteractor == NULL)
......
......@@ -304,7 +304,7 @@ XMLNode *
XMLNode::TakeChild(int index)
{
if(index < 0 || index >= children.size())
return false;
return 0;
XMLNode *child = children[index];
children.erase(children.begin()+index);
......
......@@ -1972,6 +1972,8 @@ avtCGNSFileFormat::GetUnstructuredMesh(int base, int zone, const char *meshname,
break;
case ElementTypeNull:
case MIXED:
case PYRA_13:
case NFACE_n:
// What to do here?
break;
}
......
......@@ -369,7 +369,7 @@ avtImageFileFormat::ReadImageVolumeHeader(void)
"has %d slices, it can be decomposed for parallel across at most %d processors.\n"
"You are using %d processors and so %d of these are not adding any additional\n"
"parallel speedup to operations involving it.",
fname.c_str(), subImages.size(), subImages.size(), size, size-subImages.size());
fname.c_str(), (int)subImages.size(), (int)subImages.size(), size, (int)(size-subImages.size()));
if (!avtCallback::IssueWarning(msg))
cerr << msg << endl;
haveIssuedProcWarning = true;
......
......@@ -219,7 +219,9 @@ avtNASTRANFileFormat::ActivateTimestep()
// Mark C. Miller, Mon May 11 14:21:22 PDT 2009
// Ok, I 'fixed' this funky logic again. The above 'fix' caused the alg.
// to basically completely fail.
//
// ****************************************************************************
static float Getf(const char *s)
{
char *ends;
......@@ -240,7 +242,7 @@ static float Getf(const char *s)
bool haveSeenNumChars = false;
while (!haveSeenNumChars || (*p != '-' && *p != '+' && *p != '\0'))
{
if ('0' <= *p && *p <= '9' || *p == '.' || *p == '+' || *p == '-')
if (('0' <= *p && *p <= '9') || *p == '.' || *p == '+' || *p == '-')
haveSeenNumChars = true;
*q++ = *p++;
}
......@@ -1054,7 +1056,7 @@ avtNASTRANFileFormat::GetMaterial(const char *mat)
char msg[256];
SNPRINTF(msg, sizeof(msg), "Material count specified in read options, %d, "
"does not match what is actually found in the file, %d",
matCountOpt, uniqMatIds.size());
matCountOpt, (int)uniqMatIds.size());
EXCEPTION1(ImproperUseException, msg);
}
......
......@@ -512,7 +512,7 @@ PF3DFileFormat::Initialize()
}
// Read in nx, ny, nx
char *key = "nx";
const char *key = "nx";
READ_VALUE(GetInteger, key, nx);
key = "ny";
READ_VALUE(GetInteger, key, ny);
......
......@@ -471,7 +471,7 @@ Streaker::FindMaterial(PDBFileObject *pdb, int *zDimensions, int zDims)
&nTotalElements, &dimensions, &nDims);
// Check whether ireg is the same size as zvar.
bool sameSize = nDims == nDims;
bool sameSize = nDims == zDims;
if(sameSize)
{
for(int k = 0; k < nDims; ++k)
......
......@@ -570,7 +570,7 @@ std::string avtXdmfFileFormat::GetFormattedExpressionName(std::string & attribut
iter++;
}
for (iter; iter != tokens.end(); ++iter) {
for (; iter != tokens.end(); ++iter) {
formatted << "\\ " << *iter;
}
......@@ -746,7 +746,7 @@ int avtXdmfFileFormat::GetNumberOfCellComponents(XdmfGrid* grid, XdmfAttribute*
std::istream_iterator<std::string> end;
std::vector<std::string> tokens(it, end);
std::vector<std::string>::const_iterator iter = tokens.begin();
for (iter; iter != tokens.end(); ++iter) {
for (; iter != tokens.end(); ++iter) {
int val = atoi((*iter).c_str());
if (grid->GetTopology()->GetClass() == XDMF_STRUCTURED) {
if (val - 1 > 0) {
......@@ -892,7 +892,7 @@ int avtXdmfFileFormat::GetNumberOfPoints(XdmfGrid * grid)
std::istream_iterator<std::string> end;
std::vector<std::string> tokens(it, end);
std::vector<std::string>::const_iterator iter = tokens.begin();
for (iter; iter != tokens.end(); ++iter) {
for (; iter != tokens.end(); ++iter) {
int val = atoi((*iter).c_str());
if (val > 0) {
numPoints *= val;
......
......@@ -6,9 +6,10 @@
#include <iomanip>
#include <istream>
#include "DebugStream.h"
#include "stringutil.h" // for doubleToString
namespace rclib {
using namespace std;
using namespace std; // HOOKS_IGNORE
template <class T>
struct Point {
/*!
......
......@@ -148,8 +148,8 @@ namespace paraDIS {
*/
bool operator <(const NodeID &other) const {
return (mDomainID < other.mDomainID ||
mDomainID == other.mDomainID &&
mNodeID < other.mNodeID);
(mDomainID == other.mDomainID &&
mNodeID < other.mNodeID));
}
/*!
Accessor function
......@@ -324,8 +324,8 @@ namespace paraDIS {
bool operator <(const Neighbor&other) const {
return mEndpoints[0] < other.mEndpoints[0] ||
mEndpoints[0] == other.mEndpoints[0] &&
mEndpoints[1] < other.mEndpoints[1];
(mEndpoints[0] == other.mEndpoints[0] &&
mEndpoints[1] < other.mEndpoints[1]);
}
/*!
conversion of Neighbor to string
......
......@@ -6,9 +6,10 @@
#include <iomanip>
#include <istream>
#include "DebugStream.h"
#include "stringutil.h"
namespace rclib {
using namespace std;
using namespace std; //HOOKS_IGNORE
template <class T>
struct Point {
/*!
......
......@@ -704,7 +704,6 @@ avtparaDIS_tecplotFileFormat::GetVar(const char *varname)
string err = string("GetTecplotVar: rejected varname ") + varname +" because it does not begin with 'paraDIS_Tecplot_' or does not contain '_var_'";
cerr << err << endl;
EXCEPTION1(VisItException, err.c_str());
return false;
}
/* Get the variable number.
Note that it does not matter if this is the line mesh or the
......@@ -723,7 +722,7 @@ avtparaDIS_tecplotFileFormat::GetVar(const char *varname)
}
if (varnum == mNumVars) {
cerr << "Warning: possible malformed tecplot variable: Could not determine varnum from apparently valid tecplot variable name: " << varname <<endl;
return false;
return NULL;
}
debug4 << "Looking for varnum " << varnum << endl;
......
......@@ -214,7 +214,7 @@ XDisplay::Connect()
{
// Our X server might have died. Don't bother spinning
// until we can connect if it's never going to start!
switch(waitpid(this->xserver, &status, WNOHANG) == -1)
switch(waitpid(this->xserver, &status, WNOHANG))
{
case -1:
debug1 << this->hostname << ": waitpid(" << this->xserver
......
......@@ -1488,7 +1488,7 @@ QvisExpressionsWindow::ParsePythonExpression(const QString &expr_def,
return false;
res_args = edef.mid(start_idx,args_stop_idx - start_idx).trimmed();
res_script.trimmed();
res_script = res_script.trimmed();
return true;
}
......
......@@ -832,7 +832,7 @@ QvisFileWindowBase::AddFileItem(QListWidget *parent, const QString &displayName,
if(names.size() > (MAX_DISPLAYED_NAMES*2))
{
QString nFilesString;
nFilesString.sprintf("(%d total files)", names.size());
nFilesString.sprintf("(%d total files)", (int)names.size());
itemText += QString("\n") + nFilesString;
for(i = 0; i < MAX_DISPLAYED_NAMES; ++i)
......
......@@ -418,6 +418,9 @@ GUI_LogQtMessages(QtMsgType type, const char *msg)
case QtWarningMsg:
debug1 << "Qt: Warning: " << msg << endl;
break;
case QtCriticalMsg:
debug1 << "Qt: Critical: " << msg << endl;
break;
case QtFatalMsg:
debug1 << "Qt: Fatal: " << msg << endl;
abort(); // HOOKS_IGNORE
......
......@@ -1039,7 +1039,7 @@ QvisPlotManagerWidget::UpdatePlotList()
QualifiedFilename qualifiedFile(current.GetDatabaseName());
int index = fileServer->GetFileIndex(qualifiedFile);
if (globalAtts->GetSources().size() <= 1 && sourceVisible)
SNPRINTF(prefix, 200, "");
prefix[0] = '\0';
else if (index < 0 || sourceVisible)
SNPRINTF(prefix, 200, "%s:", qualifiedFile.filename.c_str());
else
......
......@@ -561,8 +561,7 @@ QvisLabelPlotWindow::GetCurrentValues(int which_widget)
textHeight1SpinBox->prefix().length() : 0;
int slen = (temp.indexOf(textHeight1SpinBox->suffix()) != -1) ?
textHeight1SpinBox->suffix().length() : 0;
temp = temp.mid(plen, temp.length() - plen - slen);
temp.simplified();
temp = temp.mid(plen, temp.length() - plen - slen).simplified();
okay = !temp.isEmpty();
if(okay)
{
......@@ -587,8 +586,7 @@ QvisLabelPlotWindow::GetCurrentValues(int which_widget)
textHeight2SpinBox->prefix().length() : 0;
int slen = (temp.indexOf(textHeight2SpinBox->suffix()) != -1) ?
textHeight2SpinBox->suffix().length() : 0;
temp = temp.mid(plen, temp.length() - plen - slen);
temp.simplified();
temp = temp.mid(plen, temp.length() - plen - slen).simplified();
okay = !temp.isEmpty();
if(okay)
{
......
......@@ -1722,6 +1722,9 @@ QvisPoincarePlotWindow::UpdateIntegrationAttributes()
absTolLabel->show();
absTolSizeType->show();
break;
default:
break;
}
}
......
......@@ -2703,6 +2703,9 @@ QvisStreamlinePlotWindow::UpdateIntegrationAttributes()
absTolLabel->show();
absTolSizeType->show();
break;
default:
break;
}
}
......
......@@ -706,6 +706,9 @@ avtStreamlinePlot::UpdateMapperAndLegend()
case StreamlineAttributes::ColorByVariable:
varLegend->SetVarName(atts.GetColoringVariable().c_str());
break;
default:
// ColorByCorrelationDistance
break;
}
}
......
......@@ -455,7 +455,7 @@ static int GetLocalhostName(void)
/* Couldn't get the full host entry; it's probably invalid */
return FALSE;
}
sprintf(localhost, localhostEnt->h_name);
sprintf(localhost, "%s", localhostEnt->h_name);
return TRUE;
}
......
......@@ -87,7 +87,7 @@ GetObject(visit_handle h, const char *fname)
}
else
{
SNPRINTF(tmp, 100, "An invalid handle was provided.", fname);
SNPRINTF(tmp, 100, "%s: An invalid handle was provided.", fname);
VisItError(tmp);
}
......
......@@ -137,6 +137,9 @@ QvisMessageDialog::DisplayMessage(MessageAttributes *messageAtts)
case MessageAttributes::Information:
severityLabel->setText(tr("Information"));
break;
default:
severityLabel->setText("");
break;
}
// Set the message text.
......
......@@ -208,7 +208,7 @@ SyntheticDiagnosticApp::SyntheticDiagnosticApp(VisItViewer *v) : QMainWindow()
* sampling:
* beam type: all variations.
* std deviation:
* /
*/
......
......@@ -69,13 +69,13 @@ enum ComponentTypes
};
inline std::vector<QString>
ParseCharacters(const QString &buff)
ParseCharacters(const QString &buff_input)
{
std::vector<QString> output;
// split one string into a list of strings when delimited by whitespace
// or quotation marks, e.g. <string1 "string two" "" string4>
buff.trimmed();
QString buff(buff_input.trimmed());
bool quote=false;
QString tmp="";
for (int i=0; i<(int)buff.length(); i++)
......
......@@ -79,11 +79,11 @@ class UniqueStringList
};
inline std::vector<QString>
SplitValues(const QString &buff)
SplitValues(const QString &buff_input)
{
std::vector<QString> output;
buff.trimmed();
QString buff(buff_input.trimmed());
QString tmp="";
int len = buff.length();
for (int i=0; i<len; i++)
......
......@@ -82,6 +82,9 @@ Viewer_LogQtMessages(QtMsgType type, const char *msg)
case QtWarningMsg:
debug1 << "Qt: Warning: " << msg << endl;
break;
case QtCriticalMsg:
debug1 << "Qt: Critical: " << msg << endl;
break;
case QtFatalMsg:
debug1 << "Qt: Fatal: " << msg << endl;
abort(); // HOOKS_IGNORE
......
......@@ -2569,9 +2569,9 @@ SpontaneousStateLogger(const std::string &s)
if(logFile != 0)
{
fprintf(logFile, beginSpontaneousComment);
fprintf(logFile, "%s", beginSpontaneousComment);
fprintf(logFile, "%s", s.c_str());
fprintf(logFile, endSpontaneousComment);
fprintf(logFile, "%s", endSpontaneousComment);
}
if(macroRecord)
......@@ -2610,10 +2610,10 @@ SS_log_ViewAxisArray(const std::string &s)
if(logFile != 0)
{
fprintf(logFile, beginSpontaneousComment);
fprintf(logFile, "%s", beginSpontaneousComment);
fprintf(logFile, "%s", s.c_str());
fprintf(logFile, v);
fprintf(logFile, endSpontaneousComment);
fprintf(logFile, "%s", v);
fprintf(logFile, "%s", endSpontaneousComment);
}
if(macroRecord)
......@@ -2650,10 +2650,10 @@ SS_log_ViewCurve(const std::string &s)
if(logFile != 0)
{
fprintf(logFile, beginSpontaneousComment);
fprintf(logFile, "%s", beginSpontaneousComment);
fprintf(logFile, "%s", s.c_str());
fprintf(logFile, v);
fprintf(logFile, endSpontaneousComment);
fprintf(logFile, "%s", v);
fprintf(logFile, "%s", endSpontaneousComment);
}
if(macroRecord)
......@@ -2690,10 +2690,10 @@ SS_log_View2D(const std::string &s)
if(logFile != 0)
{
fprintf(logFile, beginSpontaneousComment);
fprintf(logFile, "%s", beginSpontaneousComment);
fprintf(logFile, "%s", s.c_str());
fprintf(logFile, v);
fprintf(logFile, endSpontaneousComment);
fprintf(logFile, "%s", v);
fprintf(logFile, "%s", endSpontaneousComment);
}
if(macroRecord)
......@@ -2730,10 +2730,10 @@ SS_log_View3D(const std::string &s)
if(logFile != 0)
{
fprintf(logFile, beginSpontaneousComment);
fprintf(logFile, "%s", beginSpontaneousComment);
fprintf(logFile, "%s", s.c_str());
fprintf(logFile, v);
fprintf(logFile, endSpontaneousComment);
fprintf(logFile, "%s", v);
fprintf(logFile, "%s", endSpontaneousComment);
}
if(macroRecord)
......
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