From e3846f981cc5d07b0cb10f26a6c9b59cb9a935d3 Mon Sep 17 00:00:00 2001 From: Phenom Date: Sat, 9 May 2020 14:34:48 +0200 Subject: [PATCH] Fix warning: control reaches end of non-void function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ../../../trunk/retroshare-gui/src/gui/common/FriendListModel.cpp: In member function ‘QVariant RsFriendListModel::displayRole(const RsFriendListModel::EntryIndex&, int) const’: ../../../trunk/retroshare-gui/src/gui/common/FriendListModel.cpp:716:1: warning: control reaches end of non-void function [-Wreturn-type] 716 | } | ^ --- .../src/gui/common/FriendListModel.cpp | 120 +++++++++--------- 1 file changed, 62 insertions(+), 58 deletions(-) diff --git a/retroshare-gui/src/gui/common/FriendListModel.cpp b/retroshare-gui/src/gui/common/FriendListModel.cpp index 65fb56ee2..74d5d8746 100644 --- a/retroshare-gui/src/gui/common/FriendListModel.cpp +++ b/retroshare-gui/src/gui/common/FriendListModel.cpp @@ -617,100 +617,104 @@ public: QVariant RsFriendListModel::displayRole(const EntryIndex& e, int col) const { #ifdef DEBUG_MODEL_INDEX - std::cerr << " Display role " << e.type << ", (" << (int)e.group_index << ","<< (int)e.profile_index << ","<< (int)e.node_index << ") col="<< col<<": "; - AutoEndel x; + std::cerr << " Display role " << e.type << ", (" << (int)e.group_index << ","<< (int)e.profile_index << ","<< (int)e.node_index << ") col="<< col<<": "; + AutoEndel x; #endif - switch(e.type) + switch(e.type) { - case ENTRY_TYPE_GROUP: - { - const HierarchicalGroupInformation *group = getGroupInfo(e); + case ENTRY_TYPE_GROUP: + { + const HierarchicalGroupInformation *group = getGroupInfo(e); - if(!group) - return QVariant(); + if(!group) + return QVariant(); - uint32_t nb_online = 0; + uint32_t nb_online = 0; - for(uint32_t i=0;ichild_profile_indices.size();++i) - for(uint32_t j=0;jchild_profile_indices[i]].child_node_indices.size();++j) - if(mLocations[mProfiles[group->child_profile_indices[i]].child_node_indices[j]].node_info.state & RS_PEER_STATE_CONNECTED) - { - nb_online++; - break;// only breaks the inner loop, on purpose. - } + for(uint32_t i=0;ichild_profile_indices.size();++i) + for(uint32_t j=0;jchild_profile_indices[i]].child_node_indices.size();++j) + if(mLocations[mProfiles[group->child_profile_indices[i]].child_node_indices[j]].node_info.state & RS_PEER_STATE_CONNECTED) + { + nb_online++; + break;// only breaks the inner loop, on purpose. + } switch(col) { - case COLUMN_THREAD_NAME: + case COLUMN_THREAD_NAME: #ifdef DEBUG_MODEL_INDEX - std::cerr << group->group_info.name.c_str() ; + std::cerr << group->group_info.name.c_str() ; #endif - if(!group->child_profile_indices.empty()) - return QVariant(QString::fromUtf8(group->group_info.name.c_str())+" (" + QString::number(nb_online) + "/" + QString::number(group->child_profile_indices.size()) + ")"); - else - return QVariant(QString::fromUtf8(group->group_info.name.c_str())); + if(!group->child_profile_indices.empty()) + return QVariant(QString::fromUtf8(group->group_info.name.c_str())+" (" + QString::number(nb_online) + "/" + QString::number(group->child_profile_indices.size()) + ")"); + else + return QVariant(QString::fromUtf8(group->group_info.name.c_str())); - case COLUMN_THREAD_ID: return QVariant(QString::fromStdString(group->group_info.id.toStdString())); - default: + case COLUMN_THREAD_ID: return QVariant(QString::fromStdString(group->group_info.id.toStdString())); + default: return QVariant(); } - } - break; + } + break; - case ENTRY_TYPE_PROFILE: + case ENTRY_TYPE_PROFILE: { - const HierarchicalProfileInformation *profile = getProfileInfo(e); + const HierarchicalProfileInformation *profile = getProfileInfo(e); - if(!profile) - return QVariant(); + if(!profile) + return QVariant(); #ifdef DEBUG_MODEL_INDEX - std::cerr << profile->profile_info.name.c_str() ; + std::cerr << profile->profile_info.name.c_str() ; #endif switch(col) { - case COLUMN_THREAD_NAME: return QVariant(QString::fromUtf8(profile->profile_info.name.c_str())); - case COLUMN_THREAD_ID: return QVariant(QString::fromStdString(profile->profile_info.gpg_id.toStdString()) ); + case COLUMN_THREAD_NAME: return QVariant(QString::fromUtf8(profile->profile_info.name.c_str())); + case COLUMN_THREAD_ID: return QVariant(QString::fromStdString(profile->profile_info.gpg_id.toStdString()) ); - default: + default: return QVariant(); } - } - break; + } + break; - case ENTRY_TYPE_NODE: - const HierarchicalNodeInformation *node = getNodeInfo(e); + case ENTRY_TYPE_NODE: + { + const HierarchicalNodeInformation *node = getNodeInfo(e); - if(!node) - return QVariant(); + if(!node) + return QVariant(); #ifdef DEBUG_MODEL_INDEX - std::cerr << node->node_info.location.c_str() ; + std::cerr << node->node_info.location.c_str() ; #endif - switch(col) - { - case COLUMN_THREAD_NAME: if(node->node_info.location.empty()) - return QVariant(QString::fromStdString(node->node_info.id.toStdString())); + switch(col) + { + case COLUMN_THREAD_NAME: if(node->node_info.location.empty()) + return QVariant(QString::fromStdString(node->node_info.id.toStdString())); - { - std::string css = rsMsgs->getCustomStateString(node->node_info.id); + { + std::string css = rsMsgs->getCustomStateString(node->node_info.id); - if(!css.empty() && mDisplayStatusString) - return QVariant(QString::fromUtf8(node->node_info.location.c_str())+"\n"+QString::fromUtf8(css.c_str())); - else - return QVariant(QString::fromUtf8(node->node_info.location.c_str())); - } + if(!css.empty() && mDisplayStatusString) + return QVariant(QString::fromUtf8(node->node_info.location.c_str())+"\n"+QString::fromUtf8(css.c_str())); + else + return QVariant(QString::fromUtf8(node->node_info.location.c_str())); + } - case COLUMN_THREAD_LAST_CONTACT: return QVariant(QDateTime::fromTime_t(node->node_info.lastConnect).toString()); - case COLUMN_THREAD_IP: return QVariant( (node->node_info.state & RS_PEER_STATE_CONNECTED) ? StatusDefs::connectStateIpString(node->node_info) : QString("---")); - case COLUMN_THREAD_ID: return QVariant( QString::fromStdString(node->node_info.id.toStdString()) ); + case COLUMN_THREAD_LAST_CONTACT: return QVariant(QDateTime::fromTime_t(node->node_info.lastConnect).toString()); + case COLUMN_THREAD_IP: return QVariant( (node->node_info.state & RS_PEER_STATE_CONNECTED) ? StatusDefs::connectStateIpString(node->node_info) : QString("---")); + case COLUMN_THREAD_ID: return QVariant( QString::fromStdString(node->node_info.id.toStdString()) ); - default: - return QVariant(); - } break; + default: + return QVariant(); + } break; + } + break; + default: //ENTRY_TYPE return QVariant(); } }