Skip to content

Commit

Permalink
Merge branch 'bugfix/10345_coverity_issues_in_mantidqt' into develop
Browse files Browse the repository at this point in the history
Conflicts:
	Code/Mantid/MantidQt/CustomInterfaces/src/JumpFit.cpp

Refs #10345
  • Loading branch information
DanNixon committed Oct 13, 2014
2 parents 402ce4e + 44645e1 commit 0e78dc1
Show file tree
Hide file tree
Showing 32 changed files with 169 additions and 96 deletions.
2 changes: 1 addition & 1 deletion Code/Mantid/Build/CMake/DarwinSetup.cmake
Expand Up @@ -85,7 +85,7 @@ set ( CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++0x" )

if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-register" )
set ( CMAKE_XCODE_ATTRIBUTE_OTHER_CPLUSPLUSFLAGS "-Wno-decprecated-register")
set ( CMAKE_XCODE_ATTRIBUTE_OTHER_CPLUSPLUSFLAGS "-Wno-deprecated-register")
set ( CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++" )
endif()

Expand Down
3 changes: 2 additions & 1 deletion Code/Mantid/MantidQt/API/src/GenericDialog.cpp
Expand Up @@ -43,7 +43,8 @@ using namespace Mantid::API;
/**
* Default Constructor
*/
GenericDialog::GenericDialog(QWidget* parent) : AlgorithmDialog(parent)
GenericDialog::GenericDialog(QWidget* parent) : AlgorithmDialog(parent),
m_algoPropertiesWidget(NULL)
{
}

Expand Down
3 changes: 2 additions & 1 deletion Code/Mantid/MantidQt/API/src/MantidQwtIMDWorkspaceData.cpp
Expand Up @@ -94,7 +94,8 @@ MantidQwtIMDWorkspaceData::MantidQwtIMDWorkspaceData(Mantid::API::IMDWorkspace_c

//-----------------------------------------------------------------------------
/// Copy constructor
MantidQwtIMDWorkspaceData::MantidQwtIMDWorkspaceData(const MantidQwtIMDWorkspaceData& data)
MantidQwtIMDWorkspaceData::MantidQwtIMDWorkspaceData(const MantidQwtIMDWorkspaceData& data) :
m_minPositive(0.0)
{
this->operator =(data);
}
Expand Down
3 changes: 3 additions & 0 deletions Code/Mantid/MantidQt/API/src/QwtRasterDataMD.cpp
Expand Up @@ -19,6 +19,9 @@ using Mantid::Geometry::IMDDimension_const_sptr;
QwtRasterDataMD::QwtRasterDataMD()
: m_ws(), m_overlayWS(),
m_slicePoint(NULL), m_fast(true), m_zerosAsNan(true),
m_overlayXMin(0.0), m_overlayXMax(0.0),
m_overlayYMin(0.0), m_overlayYMax(0.0),
m_overlayInSlice(false),
m_normalization(Mantid::API::VolumeNormalization)
{
m_range = QwtDoubleInterval(0.0, 1.0);
Expand Down
Expand Up @@ -38,7 +38,7 @@ using namespace MantidQt::CustomDialogs;
* Constructor
*/
CreateSampleShapeDialog::CreateSampleShapeDialog(QWidget *parent) :
AlgorithmDialog(parent), m_setup_map(), m_details_map(), m_ops_map()
AlgorithmDialog(parent), m_shapeTree(NULL), m_setup_map(), m_details_map(), m_ops_map()
{
m_object_viewer = new MantidGLWidget;
}
Expand Down Expand Up @@ -334,6 +334,7 @@ void CreateSampleShapeDialog::addShape(QAction *shape)
{
// Get the selected item
BinaryTreeWidgetItem *parent = getSelectedItem();
if(!parent) return;
if( parent && parent->childCount() == 2 ) return;

BinaryTreeWidgetItem *child = new BinaryTreeWidgetItem(QStringList(shape->text()));
Expand All @@ -360,6 +361,7 @@ void CreateSampleShapeDialog::addOperation(QAction *opt)
{
//Get the selected item
BinaryTreeWidgetItem *selected = getSelectedItem();
if(!selected) return;
if( selected && selected->childCount() == 2 ) return;

BinaryTreeWidgetItem *operation = new BinaryTreeWidgetItem;
Expand Down Expand Up @@ -468,6 +470,7 @@ void CreateSampleShapeDialog::setupDetailsBox()
if( m_uiForm.details_scroll->widget() ) m_uiForm.details_scroll->takeWidget();

BinaryTreeWidgetItem *item = dynamic_cast<BinaryTreeWidgetItem*>(selection[0]);
if(!item) return;
QString shapename = item->text(0);
if( m_setup_map.contains(shapename) )
{
Expand All @@ -484,7 +487,6 @@ void CreateSampleShapeDialog::setupDetailsBox()
//Set it as the currently displayed widget
m_uiForm.details_scroll->setWidget(obj);
}

}

/**
Expand Down
8 changes: 6 additions & 2 deletions Code/Mantid/MantidQt/CustomDialogs/src/LoadAsciiDialog.cpp
Expand Up @@ -15,13 +15,17 @@ namespace MantidQt
DECLARE_DIALOG(LoadAsciiDialog)

LoadAsciiDialog::LoadAsciiDialog(QWidget *parent)
: MantidQt::API::AlgorithmDialog(parent)
: MantidQt::API::AlgorithmDialog(parent),
m_lineFilename(NULL),
m_lineOutputWorkspace(NULL),
m_lineCommentIndicator(NULL),
m_lineCustomSeparator(NULL),
m_separatorBox(NULL)
{
}

LoadAsciiDialog::~LoadAsciiDialog()
{

}

void LoadAsciiDialog::initLayout()
Expand Down
18 changes: 12 additions & 6 deletions Code/Mantid/MantidQt/CustomDialogs/src/LoadDAEDialog.cpp
Expand Up @@ -20,13 +20,19 @@ class NoDeleting
{
public:
/// Does nothing
void operator()(void*){}
/// Does nothing
void operator()(const void*){}
};
void operator()(void*){}
/// Does nothing
void operator()(const void*){}
};

LoadDAEDialog::LoadDAEDialog(QWidget *parent)
: MantidQt::API::AlgorithmDialog(parent)
LoadDAEDialog::LoadDAEDialog(QWidget *parent)
: MantidQt::API::AlgorithmDialog(parent),
lineHost(NULL),
lineName(NULL),
minSpLineEdit(NULL),
maxSpLineEdit(NULL),
listSpLineEdit(NULL),
updateLineEdit(NULL)
{
}

Expand Down
3 changes: 2 additions & 1 deletion Code/Mantid/MantidQt/CustomDialogs/src/LoadRawDialog.cpp
Expand Up @@ -35,7 +35,8 @@ using namespace MantidQt::CustomDialogs;
/**
* Constructor
*/
LoadRawDialog::LoadRawDialog(QWidget *parent) : AlgorithmDialog(parent)
LoadRawDialog::LoadRawDialog(QWidget *parent) : AlgorithmDialog(parent),
m_pathBox(NULL), m_wsBox(NULL)
{
}

Expand Down
Expand Up @@ -13,7 +13,8 @@ const QString SmoothNeighboursDialog::RECTANGULAR_GROUP = "Rectangular Detectors
const QString SmoothNeighboursDialog::INPUT_WORKSPACE = "InputWorkspace";

SmoothNeighboursDialog::SmoothNeighboursDialog(QWidget* parent)
: AlgorithmDialog(parent)
: AlgorithmDialog(parent),
m_propertiesWidget(NULL), m_dialogLayout(NULL)
{
}

Expand Down
Expand Up @@ -71,7 +71,9 @@ namespace CustomDialogs
//----------------------
///Constructor
StartLiveDataDialog::StartLiveDataDialog(QWidget *parent) :
AlgorithmDialog(parent)
AlgorithmDialog(parent),
m_useProcessAlgo(false), m_useProcessScript(NULL),
m_usePostProcessAlgo(false), m_usePostProcessScript(false)
{
// Create the input history. This loads it too.
LiveDataAlgInputHistory::Instance();
Expand Down
Expand Up @@ -43,7 +43,7 @@ namespace CustomInterfaces
{
public:
/// constructor
RectDetectorDetails(){}
RectDetectorDetails(): m_minDetId(0), m_maxDetId(0) {}
///destructor
~RectDetectorDetails(){}
/// set minimum detector id
Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/MantidQt/CustomInterfaces/src/ApplyCorr.cpp
Expand Up @@ -17,7 +17,7 @@ namespace CustomInterfaces
namespace IDA
{
ApplyCorr::ApplyCorr(QWidget * parent) :
IDATab(parent)
IDATab(parent), m_valPosDbl(NULL)
{
}

Expand Down
10 changes: 1 addition & 9 deletions Code/Mantid/MantidQt/CustomInterfaces/src/ConvFit.cpp
Expand Up @@ -894,15 +894,7 @@ namespace IDA
{
// Two Lorentz
QString pref = prefBase;

if ( usingCompositeFunc )
{
pref += "f" + QString::number(funcIndex) + ".f" + QString::number(subIndex) + ".";
}
else
{
pref += "f" + QString::number(subIndex) + ".";
}
pref += "f" + QString::number(funcIndex) + ".f" + QString::number(subIndex) + ".";

m_cfDblMng->setValue(m_cfProp["Lorentzian 2.Amplitude"], parameters[pref+"Amplitude"]);
m_cfDblMng->setValue(m_cfProp["Lorentzian 2.PeakCentre"], parameters[pref+"PeakCentre"]);
Expand Down
4 changes: 3 additions & 1 deletion Code/Mantid/MantidQt/CustomInterfaces/src/Homer.cpp
Expand Up @@ -38,7 +38,9 @@ using namespace MantidQt::CustomInterfaces;
Homer::Homer(QWidget *parent, Ui::DirectConvertToEnergy & uiForm) :
UserSubWindow(parent), m_uiForm(uiForm),
m_backgroundDialog(NULL), m_diagPage(NULL),m_saveChanged(false),
m_backgroundWasVisible(false), m_absEiDirty(false), m_topSettingsGroup("CustomInterfaces/Homer")
m_backgroundWasVisible(false), m_absEiDirty(false),
m_saveChecksGroup(NULL),
m_topSettingsGroup("CustomInterfaces/Homer")
{}

/// Set up the dialog layout
Expand Down
Expand Up @@ -34,7 +34,9 @@ namespace IDA
* @param parent :: the parent QWidget.
*/
IndirectDataAnalysis::IndirectDataAnalysis(QWidget *parent) :
UserSubWindow(parent), m_dblEdFac(NULL), m_blnEdFac(NULL),
UserSubWindow(parent),
m_valInt(NULL), m_valDbl(NULL),
m_dblEdFac(NULL), m_blnEdFac(NULL),
m_changeObserver(*this, &IndirectDataAnalysis::handleDirectoryChange)
{
// Allows us to get a handle on a tab using an enum, for example "m_tabs[ELWIN]".
Expand Down
Expand Up @@ -320,7 +320,10 @@ void IndirectDataReduction::openDirectoryDialog()
*/
void IndirectDataReduction::setIDFValues(const QString & prefix)
{
dynamic_cast<IndirectConvertToEnergy *>(m_tab_convert_to_energy)->setIDFValues(prefix);
IndirectConvertToEnergy *etTab = dynamic_cast<IndirectConvertToEnergy *>(m_tab_convert_to_energy);

if(etTab)
etTab->setIDFValues(prefix);
}

/**
Expand Down
68 changes: 36 additions & 32 deletions Code/Mantid/MantidQt/CustomInterfaces/src/JumpFit.cpp
Expand Up @@ -182,39 +182,43 @@ namespace MantidQt
for (size_t i = 0; i < ws->getNumberHistograms(); ++i)
{
auto axis = dynamic_cast<Mantid::API::TextAxis*>(ws->getAxis(1));
std::string title = axis->label(i);

//check if the axis labels indicate this spectrum is width data
size_t qLinesWidthIndex = title.find(".Width");
size_t convFitWidthIndex = title.find(".FWHM");

bool qLinesWidth = qLinesWidthIndex != std::string::npos;
bool convFitWidth = convFitWidthIndex != std::string::npos;

//if we get a match, add this spectrum to the combobox
if(convFitWidth || qLinesWidth)
{
std::string cbItemName = "";
size_t substrIndex = 0;

if (qLinesWidth)
{
substrIndex = qLinesWidthIndex;
}
else if (convFitWidth)
{
substrIndex = convFitWidthIndex;
}

cbItemName = title.substr(0, substrIndex);
m_spectraList[cbItemName] = static_cast<int>(i);
m_uiForm.cbWidth->addItem(QString(cbItemName.c_str()));

//display widths f1.f1, f2.f1 and f2.f2
if (m_uiForm.cbWidth->count() == 3)
{
return;
}
if(axis)
{
std::string title = axis->label(i);

//check if the axis labels indicate this spectrum is width data
size_t qLinesWidthIndex = title.find(".Width");
size_t convFitWidthIndex = title.find(".FWHM");

bool qLinesWidth = qLinesWidthIndex != std::string::npos;
bool convFitWidth = convFitWidthIndex != std::string::npos;

//if we get a match, add this spectrum to the combobox
if(convFitWidth || qLinesWidth)
{
std::string cbItemName = "";
size_t substrIndex = 0;

if (qLinesWidth)
{
substrIndex = qLinesWidthIndex;
}
else if (convFitWidth)
{
substrIndex = convFitWidthIndex;
}

cbItemName = title.substr(0, substrIndex);
m_spectraList[cbItemName] = static_cast<int>(i);
m_uiForm.cbWidth->addItem(QString(cbItemName.c_str()));

//display widths f1.f1, f2.f1 and f2.f2
if (m_uiForm.cbWidth->count() == 3)
{
return;
}
}
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion Code/Mantid/MantidQt/CustomInterfaces/src/MSDFit.cpp
Expand Up @@ -16,7 +16,9 @@ namespace CustomInterfaces
{
namespace IDA
{
MSDFit::MSDFit(QWidget * parent) : IDATab(parent), m_msdPlot(NULL), m_msdRange(NULL), m_msdDataCurve(NULL), m_msdFitCurve(NULL),
MSDFit::MSDFit(QWidget * parent) : IDATab(parent),
m_intVal(NULL),
m_msdPlot(NULL), m_msdRange(NULL), m_msdDataCurve(NULL), m_msdFitCurve(NULL),
m_msdTree(NULL), m_msdProp(), m_msdDblMng(NULL)
{}

Expand Down
Expand Up @@ -844,7 +844,7 @@ QPair<QStringList, QMap<QString, double> > SANSPlotSpecial::getProperties(const
//------- Utility "Transform" Class ----------------------------------
//--------------------------------------------------------------------
SANSPlotSpecial::Transform::Transform(Transform::TransformType type) : m_type(type),
m_xWidgets(QList<QWidget*>()), m_yWidgets(QList<QWidget*>()), m_gDeriv(""), m_iDeriv("")
m_xWidgets(QList<QWidget*>()), m_yWidgets(QList<QWidget*>()), m_parent(NULL), m_gDeriv(""), m_iDeriv("")
{
init();
}
Expand Down
2 changes: 2 additions & 0 deletions Code/Mantid/MantidQt/CustomInterfaces/src/SANSRunWindow.cpp
Expand Up @@ -156,11 +156,13 @@ SANSRunWindow::SANSRunWindow(QWidget *parent) :
UserSubWindow(parent), m_addFilesTab(NULL), m_displayTab(NULL), m_diagnosticsTab(NULL),
m_saveWorkspaces(NULL), m_ins_defdir(""), m_last_dir(""),
m_cfg_loaded(true), m_userFname(false), m_sample_file(),
m_reducemapper(NULL),
m_warnings_issued(false), m_force_reload(false),
m_newInDir(*this, &SANSRunWindow::handleInputDirChange),
m_delete_observer(*this, &SANSRunWindow::handleMantidDeleteWorkspace),
m_s2d_detlabels(), m_loq_detlabels(), m_allowed_batchtags(),
m_have_reducemodule(false), m_dirty_batch_grid(false), m_tmp_batchfile(""),
m_batch_paste(NULL), m_batch_clear(NULL),
slicingWindow(NULL)
{
ConfigService::Instance().addObserver(m_newInDir);
Expand Down

0 comments on commit 0e78dc1

Please sign in to comment.