Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix memory, initialization and other coverity issues in Framework (especially Load* classes) #390

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
0a7446b
fix coverity 1075408, re #11328
FedeMPouzols Mar 12, 2015
ecfe4ba
fix coverity 1075417 (constructor init), re #11328
FedeMPouzols Mar 12, 2015
27aaf76
fix coverity 1075403 (constructor init), re #11328
FedeMPouzols Mar 12, 2015
83073db
fix coverity 1075405 (constructor init), re #11328
FedeMPouzols Mar 12, 2015
c5856a0
fix coverity 1075411,12 (constructor init), re #11328
FedeMPouzols Mar 12, 2015
816b1f7
fix coverity 1075399, 1076097 (init and int32/64), re #11328
FedeMPouzols Mar 12, 2015
1456d58
fix coverity 1075398,1076096,1076114 (init,int32/64,return), re #11328
FedeMPouzols Mar 12, 2015
eb2a92b
fix coverity 1075397,1076095 (constructor init, int32/64), re #11328
FedeMPouzols Mar 12, 2015
e919757
fix coverity 1127169 (constructor init), re #11328
FedeMPouzols Mar 12, 2015
bf540a1
fix coverity 1075395 (constructor init), re #11328
FedeMPouzols Mar 12, 2015
eeb168c
fix coverity 1237306 (constructor init), re #11328
FedeMPouzols Mar 12, 2015
590375b
fix coverity 1271720,21 (destructor, leak), re #11328
FedeMPouzols Mar 12, 2015
6fcbfae
fix coverity 1271722 (destructor, leak), re #11328
FedeMPouzols Mar 12, 2015
a698e22
fix coverity 1075695 (switch-break), re #11328
FedeMPouzols Mar 12, 2015
b702ed2
fix coverity 1075403 (constructor init), re #11328
FedeMPouzols Mar 12, 2015
9aa44ba
fix coverity 1075397,1076095 (constructor init, int32/64), re #11328
FedeMPouzols Mar 12, 2015
125e2e8
fix coverity 1075399, 1076097 (init and int32/64), re #11328
FedeMPouzols Mar 12, 2015
a378938
fix coverity 1075395 (constructor init), re #11328
FedeMPouzols Mar 12, 2015
28c6a47
fix coverity 1075395 (constructor init), re #11328
FedeMPouzols Mar 12, 2015
5dafbb7
fix coverity 1075417 (constructor init), re #11328
FedeMPouzols Mar 12, 2015
8ff5d47
fix coverity 1075349,1075341 (constructor init), re #11328
FedeMPouzols Mar 12, 2015
96a5638
fix coverity 1075401 (constructor init), re #11328
FedeMPouzols Mar 12, 2015
d7efff8
fix coverity 1075404 (constructor init), re #11328
FedeMPouzols Mar 12, 2015
a14f13a
fix coverity 1076262-64 (dynamic_cast checks), re #11328
FedeMPouzols Mar 12, 2015
78c44fe
fix coverity 1076257 (dynamic_cast checks), re #11328
FedeMPouzols Mar 12, 2015
27d2136
fix coverity 1223399,1223400 (dynamic_cast checks), re #11328
FedeMPouzols Mar 12, 2015
f78e829
fix capitalization mistake in some data members, re #11328
FedeMPouzols Mar 13, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -102,20 +102,20 @@ class DLLExport LoadDetectorsGroupingFile : public API::Algorithm {
void generateNoInstrumentGroupWorkspace();

/// Grouping Workspace
DataObjects::GroupingWorkspace_sptr mGroupWS;
DataObjects::GroupingWorkspace_sptr m_groupWS;

/// Instrument to use if given by user
Geometry::Instrument_const_sptr mInstrument;
Geometry::Instrument_const_sptr m_instrument;

/// XML document loaded
Poco::XML::Document *pDoc;
Poco::XML::Document *m_pDoc;
/// Root element of the parsed XML
Poco::XML::Element *pRootElem;
Poco::XML::Element *m_pRootElem;

/// Data structures to store XML to Group/Detector conversion map
std::map<int, std::vector<std::string>> mGroupComponentsMap;
std::map<int, std::vector<detid_t>> mGroupDetectorsMap;
std::map<int, std::vector<int>> mGroupSpectraMap;
std::map<int, std::vector<std::string>> m_groupComponentsMap;
std::map<int, std::vector<detid_t>> m_groupDetectorsMap;
std::map<int, std::vector<int>> m_groupSpectraMap;
};

class DLLExport LoadGroupXMLFile {
Expand All @@ -125,59 +125,59 @@ class DLLExport LoadGroupXMLFile {

void loadXMLFile(std::string xmlfilename);
void setDefaultStartingGroupID(int startgroupid) {
mStartGroupID = startgroupid;
m_startGroupID = startgroupid;
}

std::string getInstrumentName() { return mInstrumentName; }
bool isGivenInstrumentName() { return mUserGiveInstrument; }
std::string getInstrumentName() { return m_instrumentName; }
bool isGivenInstrumentName() { return m_userGiveInstrument; }

std::string getDate() { return mDate; }
bool isGivenDate() { return mUserGiveDate; }
std::string getDate() { return m_date; }
bool isGivenDate() { return m_userGiveDate; }

std::string getDescription() { return mDescription; }
bool isGivenDescription() { return mUserGiveDescription; }
std::string getDescription() { return m_description; }
bool isGivenDescription() { return m_userGiveDescription; }

/// Data structures to store XML to Group/Detector conversion map
std::map<int, std::vector<std::string>> getGroupComponentsMap() {
return mGroupComponentsMap;
return m_groupComponentsMap;
}
std::map<int, std::vector<detid_t>> getGroupDetectorsMap() {
return mGroupDetectorsMap;
return m_groupDetectorsMap;
}
std::map<int, std::vector<int>> getGroupSpectraMap() {
return mGroupSpectraMap;
return m_groupSpectraMap;
}

std::map<int, std::string> getGroupNamesMap() { return mGroupNamesMap; }
std::map<int, std::string> getGroupNamesMap() { return m_groupNamesMap; }

private:
/// Instrument name
std::string mInstrumentName;
std::string m_instrumentName;
/// User-define instrument name
bool mUserGiveInstrument;
bool m_userGiveInstrument;

/// Date in ISO 8601 for which this grouping is relevant
std::string mDate;
std::string m_date;
/// Whether date is given by user
bool mUserGiveDate;
bool m_userGiveDate;

/// Grouping description. Empty if not specified.
std::string mDescription;
std::string m_description;
/// Whether description is given by user
bool mUserGiveDescription;
bool m_userGiveDescription;

/// XML document loaded
Poco::XML::Document *pDoc;
Poco::XML::Document *m_pDoc;
/// Root element of the parsed XML
Poco::XML::Element *pRootElem;
Poco::XML::Element *m_pRootElem;
/// Data structures to store XML to Group/Detector conversion map
std::map<int, std::vector<std::string>> mGroupComponentsMap;
std::map<int, std::vector<detid_t>> mGroupDetectorsMap;
std::map<int, std::vector<int>> mGroupSpectraMap;
int mStartGroupID;
std::map<int, std::vector<std::string>> m_groupComponentsMap;
std::map<int, std::vector<detid_t>> m_groupDetectorsMap;
std::map<int, std::vector<int>> m_groupSpectraMap;
int m_startGroupID;

/// Map of group names
std::map<int, std::string> mGroupNamesMap;
std::map<int, std::string> m_groupNamesMap;

/// Initialize XML parser
void initializeXMLParser(const std::string &filename);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,16 +115,16 @@ class DLLExport LoadMask : public API::Algorithm {
std::vector<int> &rangeendvec);

/// Mask Workspace
DataObjects::MaskWorkspace_sptr mMaskWS;
DataObjects::MaskWorkspace_sptr m_maskWS;
/// Instrument name
std::string m_instrumentPropValue;
/// XML document loaded
Poco::XML::Document *pDoc;
Poco::XML::Document *m_pDoc;
/// Root element of the parsed XML
Poco::XML::Element *pRootElem;
Poco::XML::Element *m_pRootElem;

/// Default setup. If true, not masking, but use the pixel
bool mDefaultToUse;
bool m_defaultToUse;

std::vector<int32_t> mask_detid_single;
std::vector<int32_t> mask_specid_single;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace DataHandling {
class DLLExport LoadPreNexusMonitors : public Mantid::API::Algorithm {
public:
/// (Empty) Constructor
LoadPreNexusMonitors() : Mantid::API::Algorithm() {}
LoadPreNexusMonitors();
/// Virtual destructor
virtual ~LoadPreNexusMonitors() {}
/// Algorithm's name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,6 @@ class DLLExport LoadRawSpectrum0 : public LoadRawHelper {
int64_t m_lengthIn;
/// number of time regime
int64_t m_noTimeRegimes;

/// TimeSeriesProperty<int> containing data periods.
boost::shared_ptr<Kernel::Property> m_perioids;
};
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ class DLLExport LoadTOFRawNexus
std::vector<std::string> &bankNames);

/// Number of pixels
size_t numPixels;
size_t m_numPixels;

/// Signal # to load. Default 1
int signalNo;
int m_signalNo;

protected:
void init();
Expand All @@ -101,7 +101,7 @@ class DLLExport LoadTOFRawNexus
std::vector<Kernel::DateAndTime> pulseTimes;

/// Number of bins
size_t numBins;
size_t m_numBins;

/// Interval of chunk
specid_t m_spec_min, m_spec_max;
Expand Down
4 changes: 2 additions & 2 deletions Code/Mantid/Framework/DataHandling/src/DetermineChunking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,12 +229,12 @@ void DetermineChunking::exec() {
filesize = double(info.getSize()) * 144.0 / (1024.0 * 1024.0 * 1024.0);
g_log.notice() << "Wksp size is " << filesize << " GB" << std::endl;
LoadTOFRawNexus lp;
lp.signalNo = 1;
lp.m_signalNo = 1;
// Find the entry name we want.
std::string entry_name = LoadTOFRawNexus::getEntryName(filename);
std::vector<std::string> bankNames;
lp.countPixels(filename, entry_name, bankNames);
m_numberOfSpectra = static_cast<int>(lp.numPixels);
m_numberOfSpectra = static_cast<int>(lp.m_numPixels);
g_log.notice() << "Spectra size is " << m_numberOfSpectra << " spectra"
<< std::endl;
} else {
Expand Down
3 changes: 2 additions & 1 deletion Code/Mantid/Framework/DataHandling/src/LoadCanSAS1D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ void LoadCanSAS1D::exec() {
std::string runName;
switch (numEntries) {
case 0:
Exception::NotFoundError("No <SASentry>s were found in the file", fileName);
throw Exception::NotFoundError("No <SASentry>s were found in the file", fileName);
break;
case 1:
// the value of the string runName is unused in this case
WS = loadEntry(entryList->item(0), runName);
Expand Down