Commit a73852cb authored by Mathieu Faverge's avatar Mathieu Faverge

Fix issues reported by Sonarqube and warnings reported by the compiler

parent a4bfb9ef
......@@ -36,4 +36,3 @@ sonar_vite:
- ./analysis.sh
only:
- master@solverstack/vite
......@@ -404,7 +404,7 @@ private:
double start = (i * (max_val - min_val))/nbreaks + min_val;
double end = ((i+1) * (max_val - min_val))/nbreaks + min_val;
printf("BIN[%d] = %d / %d - [ %lf, %lf [\n", i, cnt[i], total_cnt, start, end);
printf("BIN[%u] = %u / %u - [ %lf, %lf [\n", i, cnt[i], total_cnt, start, end);
}
/* Start from a blank canva */
......
......@@ -19,8 +19,8 @@ public:
virtual void finish() = 0;
protected:
bool m_is_finished;
bool m_is_canceled;
bool m_is_finished = false;
bool m_is_canceled = false;
};
#endif
......@@ -57,7 +57,7 @@ private:
QTime m_time;
QLabel* m_label;
char m_fpsString[256];
char m_fpsString[256] = { '\0' };
double m_qtToGLWidthCoeff;
double m_qtToGLHeightCoeff;
......@@ -68,11 +68,11 @@ private:
int m_mouseYClicked;
CameraPosition m_camera;
int m_drawTempSelection;
int m_tempSelectionX;
int m_tempSelectionY;
int m_tempSelectionDx;
int m_tempSelectionDy;
int m_drawTempSelection = 0;
int m_tempSelectionX = 0;
int m_tempSelectionY = 0;
int m_tempSelectionDx = 0;
int m_tempSelectionDy = 0;
// Zoom stack
std::stack<CameraPosition> m_savedPositions;
......
......@@ -286,18 +286,16 @@ void Session::get_palettes_name(const std::string &type, QStringList &list) {
}
Palette *Session::get_palette(const std::string &type, const std::string &palette_name) {
Palette *p, **where_from;
Palette *p = NULL;
if( type == "palette" ) {
p = _palettes_state;
where_from = &_palettes_state;
}
else if( type == "link_types" ) {
p = _palettes_link;
where_from = &_palettes_link;
}
else if( type == "event_types" ) {
p = _palettes_event;
where_from = &_palettes_event;
}
if(!p || p->get_name() != palette_name) {
......@@ -306,7 +304,6 @@ Palette *Session::get_palette(const std::string &type, const std::string &palett
QMap <QString, QVariant> qmap = S->value(QString::fromStdString(type+"/"+palette_name+"/map")).toMap();
p = new Palette(string(type+"/"+palette_name));
*where_from = p;
for(QMap<QString, QVariant>::const_iterator it = qmap.constBegin() ;
it != qmap.constEnd() ; ++ it) {
const QColor qc = it.value().value<QColor>();
......
......@@ -59,7 +59,7 @@ using namespace std;
bool convert_to_double(const std::string &arg, double *val) {
unsigned int nb_read;
// Try to convert first in the current locale
sscanf(arg.c_str(), "%lf%n", val, &nb_read);
sscanf(arg.c_str(), "%lf%u", val, &nb_read);
if(nb_read == arg.size()) {
return true; // It is the good format
......@@ -88,7 +88,7 @@ bool convert_to_double(const std::string &arg, double *val) {
}
// Reads the value in the new locale
sscanf(arg.c_str(), "%lf%n", val, &nb_read);
sscanf(arg.c_str(), "%lf%u", val, &nb_read);
return nb_read == arg.size();
}
}
......
......@@ -972,33 +972,46 @@ void Core::launch_action(int state, void* arg) {
//printf("we ask to switch %s and %s \n", container->get_name().to_string().c_str(), container2->get_name().to_string().c_str());
const std::list<Container*>* children=nullptr;
const std::list<Container*>* children = nullptr;
bool children_allocated = false;
if(parent==nullptr){//we switch top level containers
if( parent == nullptr ) {//we switch top level containers
children = _trace->get_view_root_containers();
if(children->empty()) children = _trace->get_root_containers();
}else{
if( children->empty() )
children = _trace->get_root_containers();
} else {
children = new std::list<Container*>(*parent->get_view_children());
if(children->empty()) children = parent->get_children();
if( children->empty() ) {
delete children;
children = parent->get_children();
}
else {
children_allocated = true;
}
}
std::list<Container*>::const_iterator it= children->begin();
const std::list<Container*>::const_iterator it_end= children->end();
if(parent!=nullptr){
if( parent != nullptr ) {
parent->clear_view_children();
for(; it!=it_end; it++){
if((*it)==container) parent->add_view_child(const_cast<Container*>(container2));
else if((*it)==container2) parent->add_view_child(const_cast<Container*>(container));
else parent->add_view_child(*it);
if( (*it) == container )
parent->add_view_child(const_cast<Container*>(container2));
else if( (*it) == container2 )
parent->add_view_child(const_cast<Container*>(container));
else
parent->add_view_child(*it);
}
}else{//for root containers we have to build a new list and fill it
} else {//for root containers we have to build a new list and fill it
std::list<Container*>* new_list= new std::list<Container*> ();
for(; it!=it_end; it++){
if((*it)==container){
if( (*it) == container ) {
new_list->push_back(const_cast<Container*>(container2));
}
else if((*it)==container2) new_list->push_back(const_cast<Container*>(container));
else new_list->push_back(*it);
else if( (*it) == container2 )
new_list->push_back(const_cast<Container*>(container));
else
new_list->push_back(*it);
}
_trace->set_view_root_containers(*new_list);
}
......@@ -1015,6 +1028,10 @@ void Core::launch_action(int state, void* arg) {
launch_action(Core:: _STATE_ZOOM_IN_AN_INTERVAL, &zoom);
launch_action(Core:: _STATE_RENDER_UPDATE);
if ( children_allocated ) {
delete children;
}
break;
}
......
......@@ -664,11 +664,13 @@ void
Settings_window::on_cb_nolinks_stateChanged(int index)
{
_c->launch_action(Core::_STATE_RENDER_UPDATE);
(void)index;
}
void
Settings_window::on_cb_noevents_stateChanged(int index)
{
_c->launch_action(Core::_STATE_RENDER_UPDATE);
(void)index;
}
......@@ -108,8 +108,8 @@ int main(int argc, char **argv) {
trace_finish(file, (clockGet()-timestamp), 0, -1);
memAllocUntrace();
#endif
fprintf(stdout, "Max Memory allocated : %ld\n", memAllocGetMax());
fprintf(stdout, "Memory still allocated : %ld\n", memAllocGetCurrent());
fprintf(stdout, "Max Memory allocated : %lu\n", memAllocGetMax());
fprintf(stdout, "Memory still allocated : %lu\n", memAllocGetCurrent());
#endif
return EXIT_SUCCESS;
......
......@@ -73,14 +73,14 @@
/* -- */
using namespace std;
map<OTF2_SystemTreeNodeRef, OTF2_SystemTreeNode* > ParserDefinitionOTF2::_system_tree_node;
map<OTF2_LocationGroupRef, OTF2_LocationGroup* > ParserDefinitionOTF2::_location_group;
map<OTF2_LocationRef, OTF2_Location* > ParserDefinitionOTF2::_location;
map<OTF2_SystemTreeNodeRef, OTF2_SystemTreeNode* > ParserDefinitionOTF2::_system_tree_node;
map<OTF2_LocationGroupRef, OTF2_LocationGroup* > ParserDefinitionOTF2::_location_group;
map<OTF2_LocationRef, OTF2_Location* > ParserDefinitionOTF2::_location;
map<OTF2_MetricMemberRef, OTF2_MetricMember > ParserDefinitionOTF2::_metric_member;
map<OTF2_MetricRef, OTF2_MetricClass > ParserDefinitionOTF2::_metric_class;
map<OTF2_MetricRef, OTF2_MetricClass > ParserDefinitionOTF2::_metric_class;
map<uint32_t, OTF2_Function > ParserDefinitionOTF2::_functions;
map<uint32_t, OTF2_Function > ParserDefinitionOTF2::_functions;
map<uint32_t, const char * > ParserDefinitionOTF2::_strings;
......@@ -131,20 +131,21 @@ ParserDefinitionOTF2::~ParserDefinitionOTF2() {
void ParserDefinitionOTF2::set_handlers(Trace *t) {
OTF2_GlobalDefReaderCallbacks_SetSystemTreeNodeCallback(_global_def_callbacks, &handler_DefSystemTreeNode);
OTF2_GlobalDefReaderCallbacks_SetLocationCallback(_global_def_callbacks, &handler_DefLocation);
OTF2_GlobalDefReaderCallbacks_SetLocationGroupCallback(_global_def_callbacks, handler_DefLocationGroup);
OTF2_GlobalDefReaderCallbacks_SetStringCallback(_global_def_callbacks, &handler_DefString);
OTF2_GlobalDefReaderCallbacks_SetClockPropertiesCallback(_global_def_callbacks, &handler_DefTimerResolution);
OTF2_GlobalDefReaderCallbacks_SetRegionCallback(_global_def_callbacks, &handler_DefState);
OTF2_GlobalDefReaderCallbacks_SetSystemTreeNodeCallback ( _global_def_callbacks, &handler_DefSystemTreeNode );
OTF2_GlobalDefReaderCallbacks_SetLocationCallback ( _global_def_callbacks, &handler_DefLocation );
OTF2_GlobalDefReaderCallbacks_SetLocationGroupCallback ( _global_def_callbacks, handler_DefLocationGroup );
OTF2_GlobalDefReaderCallbacks_SetStringCallback ( _global_def_callbacks, &handler_DefString );
OTF2_GlobalDefReaderCallbacks_SetClockPropertiesCallback( _global_def_callbacks, &handler_DefTimerResolution );
OTF2_GlobalDefReaderCallbacks_SetRegionCallback ( _global_def_callbacks, &handler_DefState );
// SetGroupCallback to get containerType, stateType... ?
OTF2_GlobalDefReaderCallbacks_SetGroupCallback(_global_def_callbacks, &handler_DefGroup);
OTF2_GlobalDefReaderCallbacks_SetGroupCallback ( _global_def_callbacks, &handler_DefGroup );
OTF2_GlobalDefReaderCallbacks_SetMetricMemberCallback(_global_def_callbacks, &handler_DefMetricMember );
OTF2_GlobalDefReaderCallbacks_SetMetricClassCallback(_global_def_callbacks, &handler_DefMetricClass );
OTF2_GlobalDefReaderCallbacks_SetMetricInstanceCallback(_global_def_callbacks, &handler_DefMetricInstance );
OTF2_GlobalDefReaderCallbacks_SetMetricMemberCallback (_global_def_callbacks, &handler_DefMetricMember );
OTF2_GlobalDefReaderCallbacks_SetMetricClassCallback (_global_def_callbacks, &handler_DefMetricClass );
OTF2_GlobalDefReaderCallbacks_SetMetricInstanceCallback (_global_def_callbacks, &handler_DefMetricInstance );
OTF2_GlobalDefReaderCallbacks_SetMetricClassRecorderCallback(_global_def_callbacks, &handler_DefMetricClassRecorder);
(void)t;
}
/*
......@@ -172,38 +173,41 @@ OTF2_CallbackCode ParserDefinitionOTF2::handler_DefString(void */*userData */,
return OTF2_CALLBACK_SUCCESS;
}
OTF2_CallbackCode ParserDefinitionOTF2::handler_DefSystemTreeNode(void */*userData */,
OTF2_CallbackCode ParserDefinitionOTF2::handler_DefSystemTreeNode(void * /*userData */,
OTF2_SystemTreeNodeRef tree_node_id,
OTF2_StringRef name_id,
OTF2_StringRef class_id,
OTF2_StringRef /*class_id*/,
OTF2_SystemTreeNodeRef parent_node_id) {
OTF2_SystemTreeNode* temp = new OTF2_SystemTreeNode();
temp->_node_id=tree_node_id;
temp->_name_id=name_id;
temp->_parent=parent_node_id;
temp->_node_id = tree_node_id;
temp->_name_id = name_id;
temp->_parent = parent_node_id;
generate_string_id(temp);
struct OTF2_SystemTreeNode *tree_node = ParserDefinitionOTF2::get_system_tree_node_by_id(parent_node_id);
if(tree_node != NULL) {
if( tree_node != NULL ) {
tree_node->_child_nodes[tree_node_id] = temp;
}
_system_tree_node[tree_node_id] = temp;
#if DEBUG
#if defined(OTF2_DEBUG)
cout<<"DefSystemTreeNode(node_id="<<tree_node_id<<", name="<<temp->_id_string<<", parent=";
if(tree_node)
cout<<tree_node->_id_string;
else
cout<<"(none)";
if( tree_node ) {
cout << tree_node->_id_string;
}
else {
cout << "(none)";
}
cout<<"\n";
#endif // DEBUG
#endif
return OTF2_CALLBACK_SUCCESS;
}
OTF2_CallbackCode ParserDefinitionOTF2::handler_DefLocationGroup(void */*userdata*/,
OTF2_LocationGroupRef location_group_identifier,
OTF2_StringRef name,
OTF2_LocationGroupType type,
OTF2_LocationGroupType /*type*/,
OTF2_SystemTreeNodeRef system_tree_parent) {
OTF2_LocationGroup *temp = new OTF2_LocationGroup();
temp->_group_id = location_group_identifier;
......@@ -217,24 +221,25 @@ OTF2_CallbackCode ParserDefinitionOTF2::handler_DefLocationGroup(void */*userdat
}
_location_group[location_group_identifier] = temp;
#if DEBUG
#if defined(OTF2_DEBUG)
cout<<"DefLocationGroup(group_id="<<location_group_identifier<<", name="<<temp->_id_string<<", parent=";
if(tree_node)
cout<<tree_node->_id_string;
else
cout<<"(none)";
cout<<"\n";
#endif // DEBUG
#endif // defined(OTF2_DEBUG)
return OTF2_CALLBACK_SUCCESS;
}
OTF2_CallbackCode ParserDefinitionOTF2::handler_DefLocation(void *userData,
OTF2_LocationRef locationIdentifier,
OTF2_StringRef name_id,
OTF2_LocationType location_type,
uint64_t numberOfEvents,
OTF2_LocationGroupRef locationGroup) {
OTF2_CallbackCode ParserDefinitionOTF2::handler_DefLocation(void * userData,
OTF2_LocationRef locationIdentifier,
OTF2_StringRef name_id,
OTF2_LocationType /*location_type*/,
uint64_t numberOfEvents,
OTF2_LocationGroupRef locationGroup)
{
OTF2_Reader* reader = (OTF2_Reader *) userData;
OTF2_EvtReader* evt_reader = OTF2_Reader_GetEvtReader(reader, locationIdentifier);
OTF2_DefReader* def_reader = OTF2_Reader_GetDefReader(reader, locationIdentifier);
......@@ -254,18 +259,20 @@ OTF2_CallbackCode ParserDefinitionOTF2::handler_DefLocation(void *userData,
}
_location[locationIdentifier] = temp;
#if DEBUG
#if defined(OTF2_DEBUG)
cout<<"DefLocation(id="<<locationIdentifier<<", name="<<temp->_id_string<<", parent=";
if(location_group)
cout<<location_group->_id_string;
else
cout<<"(none)";
cout<<"\n";
#endif // DEBUG
#endif // defined(OTF2_DEBUG)
(void)evt_reader;
return OTF2_CALLBACK_SUCCESS;
}
OTF2_CallbackCode ParserDefinitionOTF2::handler_DefState(void *userData,
OTF2_CallbackCode ParserDefinitionOTF2::handler_DefState(void */*userData*/,
OTF2_RegionRef self,
OTF2_StringRef name,
OTF2_StringRef canonicalName,
......@@ -282,14 +289,14 @@ OTF2_CallbackCode ParserDefinitionOTF2::handler_DefState(void *userData,
return OTF2_CALLBACK_SUCCESS;
}
OTF2_CallbackCode ParserDefinitionOTF2::handler_DefGroup(void *userData,
OTF2_GroupRef group_id,
OTF2_StringRef name_id,
OTF2_GroupType type,
OTF2_Paradigm paradigm,
OTF2_GroupFlag flags,
uint32_t numberOfMembers,
const uint64_t *members) {
OTF2_CallbackCode ParserDefinitionOTF2::handler_DefGroup(void * /*userData*/,
OTF2_GroupRef group_id,
OTF2_StringRef name_id,
OTF2_GroupType type,
OTF2_Paradigm /*paradigm*/,
OTF2_GroupFlag /*flags*/,
uint32_t /*numberOfMembers*/,
const uint64_t */*members*/) {
switch(type) {
case OTF2_GROUP_TYPE_UNKNOWN:
break;
......@@ -318,7 +325,7 @@ OTF2_CallbackCode ParserDefinitionOTF2::handler_DefGroup(void *userData,
return OTF2_CALLBACK_SUCCESS;
}
OTF2_CallbackCode ParserDefinitionOTF2::handler_DefMetricMember( void* userData,
OTF2_CallbackCode ParserDefinitionOTF2::handler_DefMetricMember( void* /*userData*/,
OTF2_MetricMemberRef self,
OTF2_StringRef name,
OTF2_StringRef description,
......@@ -345,7 +352,7 @@ OTF2_CallbackCode ParserDefinitionOTF2::handler_DefMetricMember( void*
return OTF2_CALLBACK_SUCCESS;
}
OTF2_CallbackCode ParserDefinitionOTF2::handler_DefMetricClass( void* userData,
OTF2_CallbackCode ParserDefinitionOTF2::handler_DefMetricClass( void* /*userData*/,
OTF2_MetricRef self,
uint8_t numberOfMetrics,
const OTF2_MetricMemberRef* metricMembers,
......@@ -365,20 +372,20 @@ OTF2_CallbackCode ParserDefinitionOTF2::handler_DefMetricClass( void*
return OTF2_CALLBACK_SUCCESS;
}
OTF2_CallbackCode ParserDefinitionOTF2::handler_DefMetricInstance( void* userData,
OTF2_MetricRef self,
OTF2_MetricRef metricClass,
OTF2_LocationRef recorder,
OTF2_MetricScope metricScope,
uint64_t scope )
OTF2_CallbackCode ParserDefinitionOTF2::handler_DefMetricInstance( void* /*userData*/,
OTF2_MetricRef /*self*/,
OTF2_MetricRef /*metricClass*/,
OTF2_LocationRef /*recorder*/,
OTF2_MetricScope /*metricScope*/,
uint64_t /*scope*/ )
{
cout<<__FUNCTION__<<" not implemented\n";
return OTF2_CALLBACK_SUCCESS;
}
OTF2_CallbackCode ParserDefinitionOTF2::handler_DefMetricClassRecorder( void* userData,
OTF2_MetricRef metric,
OTF2_LocationRef recorder )
OTF2_CallbackCode ParserDefinitionOTF2::handler_DefMetricClassRecorder( void* /*userData*/,
OTF2_MetricRef /*metric*/,
OTF2_LocationRef /*recorder*/ )
{
cout<<__FUNCTION__<<" not implemented\n";
return OTF2_CALLBACK_SUCCESS;
......@@ -546,7 +553,6 @@ void ParserDefinitionOTF2::create_system_tree_node(Trace *t, OTF2_SystemTreeNode
}
void ParserDefinitionOTF2::create_container_types(Trace *t) {
unsigned int i;
std::map<OTF2_SystemTreeNodeRef, OTF2_SystemTreeNode* >::const_iterator it_tree, end_tree;
end_tree = _system_tree_node.end();
......@@ -602,7 +608,9 @@ void ParserDefinitionOTF2::create_metric_member(Trace *t, OTF2_MetricMember m) {
}
}
void ParserDefinitionOTF2::create_metric_class(Trace *t, OTF2_MetricClass m) {
void ParserDefinitionOTF2::create_metric_class(Trace * /*t*/,
OTF2_MetricClass /*m*/)
{
// Nothing to do ?
}
......
/*
** This file is part of the ViTE project.
**
** This software is governed by the CeCILL-A license under French law
** and abiding by the rules of distribution of free software. You can
** use, modify and/or redistribute the software under the terms of the
** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following
** URL: "http://www.cecill.info".
**
** As a counterpart to the access to the source code and rights to copy,
** modify and redistribute granted by the license, users are provided
** only with a limited warranty and the software's author, the holder of
** the economic rights, and the successive licensors have only limited
** liability.
**
** In this respect, the user's attention is drawn to the risks associated
** with loading, using, modifying and/or developing or reproducing the
** software by the user in light of its specific status of free software,
** that may mean that it is complicated to manipulate, and that also
** therefore means that it is reserved for developers and experienced
** professionals having in-depth computer knowledge. Users are therefore
** encouraged to load and test the software's suitability as regards
** their requirements in conditions enabling the security of their
** systems and/or data to be ensured and, more generally, to use and
** operate it in the same conditions as regards security.
**
** The fact that you are presently reading this means that you have had
** knowledge of the CeCILL-A license and that you accept its terms.
**
**
** ViTE developers are (for version 0.* to 1.0):
**
** - COULOMB Kevin
** - FAVERGE Mathieu
** - JAZEIX Johnny
** - LAGRASSE Olivier
** - MARCOUEILLE Jule
** - NOISETTE Pascal
** - REDONDY Arthur
** - VUCHENER Clément
**
*/
** This file is part of the ViTE project.
**
** This software is governed by the CeCILL-A license under French law
** and abiding by the rules of distribution of free software. You can
** use, modify and/or redistribute the software under the terms of the
** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following
** URL: "http://www.cecill.info".
**
** As a counterpart to the access to the source code and rights to copy,
** modify and redistribute granted by the license, users are provided
** only with a limited warranty and the software's author, the holder of
** the economic rights, and the successive licensors have only limited
** liability.
**
** In this respect, the user's attention is drawn to the risks associated
** with loading, using, modifying and/or developing or reproducing the
** software by the user in light of its specific status of free software,
** that may mean that it is complicated to manipulate, and that also
** therefore means that it is reserved for developers and experienced
** professionals having in-depth computer knowledge. Users are therefore
** encouraged to load and test the software's suitability as regards
** their requirements in conditions enabling the security of their
** systems and/or data to be ensured and, more generally, to use and
** operate it in the same conditions as regards security.
**
** The fact that you are presently reading this means that you have had
** knowledge of the CeCILL-A license and that you accept its terms.
**
**
** ViTE developers are (for version 0.* to 1.0):
**
** - COULOMB Kevin
** - FAVERGE Mathieu
** - JAZEIX Johnny
** - LAGRASSE Olivier
** - MARCOUEILLE Jule
** - NOISETTE Pascal
** - REDONDY Arthur
** - VUCHENER Clément
**
*/
/**
* @file ParserDefinitionOTF2.hpp
*
......@@ -126,24 +126,24 @@ struct OTF2_Location {
* \brief Contains the definition of a function (equivalent in Paje : State)
*/
struct OTF2_Function {
/*! \brief Name of the state */
OTF2_StringRef _name_id;
/*! \brief Alternative name of the region (e.g. mangled name */
OTF2_StringRef _canonicalName;
/*! \brief A more detailed description of this region */
OTF2_StringRef _region_description;
/*! \brief Region role. */
OTF2_RegionRole _regionRole;
/*! \brief Paradigm. */
OTF2_Paradigm _paradigm;
/*! \brief Region flags. */
OTF2_RegionFlag _regionFlags;
/*! \brief The source file where this region was declared */
OTF2_StringRef _sourceFile;
/*! \brieg Starting line number of this region in the source file. */
uint32_t _begin_line_number;
/*! \brieg Ending line number of this region in the source file. */
uint32_t _end_line_number;
/*! \brief Name of the state */
OTF2_StringRef _name_id;
/*! \brief Alternative name of the region (e.g. mangled name */
OTF2_StringRef _canonicalName;
/*! \brief A more detailed description of this region */
OTF2_StringRef _region_description;
/*! \brief Region role. */
OTF2_RegionRole _regionRole;
/*! \brief Paradigm. */
OTF2_Paradigm _paradigm;
/*! \brief Region flags. */
OTF2_RegionFlag _regionFlags;
/*! \brief The source file where this region was declared */
OTF2_StringRef _sourceFile;
/*! \brieg Starting line number of this region in the source file. */
uint32_t _begin_line_number;
/*! \brieg Ending line number of this region in the source file. */
uint32_t _end_line_number;
};
struct OTF2_MetricMember {
......
This diff is collapsed.
/*
** This file is part of the ViTE project.
**
** This software is governed by the CeCILL-A license under French law
** and abiding by the rules of distribution of free software. You can
** use, modify and/or redistribute the software under the terms of the
** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following
** URL: "http://www.cecill.info".
**