apply some code analyzer recommendations
This commit is contained in:
@@ -28,10 +28,10 @@ ContainersModel::ContainersModel() {
|
||||
void ContainersModel::update(const PIVector<PIIntrospectionContainers::TypeInfo> & t) {
|
||||
prev_data.clear();
|
||||
all.fill(0U);
|
||||
piForeachC(PIIntrospectionContainers::TypeInfo & i, cur_data) {
|
||||
for (const auto & i: cur_data) {
|
||||
prev_data[i.id] = i;
|
||||
}
|
||||
piForeachC(PIIntrospectionContainers::TypeInfo & i, t) {
|
||||
for (const auto & i: t) {
|
||||
all[ccCount] += i.count;
|
||||
#if PIP_VERSION >= PIP_MAKE_VERSION(2, 35, 0)
|
||||
all[ccBytesAllocated] += i.allocated_bytes;
|
||||
|
||||
@@ -34,7 +34,7 @@ void ObjectsView::showObjects(const PIVector<PIIntrospection::ObjectInfo> & obje
|
||||
|
||||
int vpos = treeObjects->verticalScrollBar()->value();
|
||||
treeObjects->clear();
|
||||
piForeachC(PIIntrospection::ObjectInfo & i, objects) {
|
||||
for (const auto & i: objects) {
|
||||
stat[PI2QString(i.classname)]++;
|
||||
QTreeWidgetItem * ti = new QTreeWidgetItem();
|
||||
ti->setText(coClassName, PI2QString(i.classname));
|
||||
|
||||
@@ -29,7 +29,7 @@ QPIIntrospector::QPIIntrospector(QWidget * parent): EMainWindow(parent), peer("_
|
||||
session.addEntry(tabWidgetMain);
|
||||
PICodeInfo::EnumInfo * ei = PICODEINFO::enums().value("PIIntrospection::InfoTypes");
|
||||
if (ei) {
|
||||
piForeachC(PICodeInfo::EnumeratorInfo & e, ei->members) {
|
||||
for (const auto & e: ei->members) {
|
||||
#if PIP_VERSION >= PIP_MAKE_VERSION(2, 39, 0)
|
||||
QCheckBox * cb = new QCheckBox(PI2QString(e.name.mid(2).toString()));
|
||||
#else
|
||||
@@ -83,7 +83,7 @@ void QPIIntrospector::buildTree(QByteArray d) {
|
||||
PIByteArray pd = Q2PIByteArray(d);
|
||||
pd >> threads;
|
||||
treeContainers->clear();
|
||||
piForeachC (PIIntrospectionThreads::ThreadInfo & t, threads) {
|
||||
for (const auto & t: threads) {
|
||||
QTreeWidgetItem * ti = new QTreeWidgetItem();
|
||||
ti->setText(0, QString(PI2QString(t.name) + " (%1)").arg(t.id));
|
||||
treeContainers->addTopLevelItem(ti);
|
||||
@@ -241,7 +241,7 @@ void QPIIntrospector::peersChanged(const PIString & name) {
|
||||
QString cs = listApp->currentItem() ? listApp->currentItem()->text() : "";
|
||||
listApp->clear();
|
||||
peer.lock();
|
||||
piForeachC(PIPeer::PeerInfo & p, peer.allPeers()) {
|
||||
for (const auto & p: peer.allPeers()) {
|
||||
QString pn = PI2QString(p.name);
|
||||
if (!pn.contains(tag)) continue;
|
||||
QListWidgetItem * li = new QListWidgetItem(pn.left(pn.indexOf(tag)));
|
||||
|
||||
@@ -24,7 +24,7 @@ enum ColumnThreads {
|
||||
ThreadsModel::ThreadsModel() {
|
||||
PICodeInfo::EnumInfo * ei = PICODEINFO::enums().value("PIIntrospectionThreads::ThreadState");
|
||||
if (ei) {
|
||||
piForeachC(PICodeInfo::EnumeratorInfo & e, ei->members) {
|
||||
for (const auto & e: ei->members) {
|
||||
#if PIP_VERSION >= PIP_MAKE_VERSION(2, 39, 0)
|
||||
state_names[e.value] = PI2QString(e.name.mid(1).toString());
|
||||
#else
|
||||
@@ -118,7 +118,7 @@ QVariant ThreadsModel::data(const QModelIndex & index, int role) const {
|
||||
case ctDelay: return QString::number(ti.delay);
|
||||
case ctState: return state_names.value(ti.state);
|
||||
case ctLoad: {
|
||||
piForeachC(PISystemMonitor::ThreadStats & s, stat) {
|
||||
for (const auto & s: stat) {
|
||||
if (s.id == llong(ti.id)) {
|
||||
return QString::number(s.cpu_load_kernel + s.cpu_load_user, 'f', 2) + " %";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user