pvs fix warnings

git-svn-id: svn://db.shs.com.ru/pip@280 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
2016-11-07 13:07:46 +00:00
parent bf2f224eb9
commit a393f93ee1
21 changed files with 84 additions and 64 deletions

View File

@@ -480,51 +480,51 @@ void PIConsole::run() {
toUpperLeft();
if (max_y < cvars.size()) max_y = cvars.size();
j = 0;
piForeachC (Variable & tv, cvars) {
piForeachC (Variable & tv_, cvars) {
if (j > height - 3) continue;
j++;
moveRight(cx);
if (tv.type == 15) {
if (tv_.type == 15) {
newLine();
continue;
}
moveRight(tv.offset);
moveRight(tv_.offset);
const void * ptr = 0;
if (tv.remote) {
if (tv.type == 0) {
if (tv_.remote) {
if (tv_.type == 0) {
rstr.clear();
rba = tv.rdata;
rba = tv_.rdata;
rba >> rstr;
rstr.trim();
ptr = &rstr;
} else
ptr = tv.rdata.data();
ptr = tv_.rdata.data();
} else
ptr = tv.ptr;
switch (tv.type) {
case 0: clen = printValue(ptr != 0 ? *(const PIString*)ptr : PIString(), tv.format); break;
case 1: clen = printValue(ptr != 0 ? *(const bool*)ptr : false, tv.format); break;
case 2: clen = printValue(ptr != 0 ? *(const int*)ptr : 0, tv.format); break;
case 3: clen = printValue(ptr != 0 ? *(const long*)ptr : 0l, tv.format); break;
case 4: clen = printValue(ptr != 0 ? *(const char*)ptr : char(0), tv.format); break;
case 5: clen = printValue(ptr != 0 ? *(const float*)ptr : 0.f, tv.format); break;
case 6: clen = printValue(ptr != 0 ? *(const double*)ptr : 0., tv.format); break;
case 7: clen = printValue(ptr != 0 ? *(const short*)ptr : short(0), tv.format); break;
case 8: clen = printValue(ptr != 0 ? *(const uint*)ptr : 0u, tv.format); break;
case 9: clen = printValue(ptr != 0 ? *(const ulong*)ptr : 0ul, tv.format); break;
case 10: clen = printValue(ptr != 0 ? *(const ushort*)ptr : ushort(0), tv.format); break;
case 11: clen = printValue(ptr != 0 ? *(const uchar*)ptr : uchar(0), tv.format); break;
case 12: clen = printValue(ptr != 0 ? *(const llong*)ptr : 0l, tv.format); break;
case 13: clen = printValue(ptr != 0 ? *(const ullong*)ptr: 0ull, tv.format); break;
case 20: clen = printValue(ptr != 0 ? *(const PISystemTime*)ptr: PISystemTime(), tv.format); break;
case 14: clen = printValue(bitsValue(ptr, tv.bitFrom, tv.bitCount), tv.format); break;
ptr = tv_.ptr;
switch (tv_.type) {
case 0: clen = printValue(ptr != 0 ? *(const PIString*)ptr : PIString(), tv_.format); break;
case 1: clen = printValue(ptr != 0 ? *(const bool*)ptr : false, tv_.format); break;
case 2: clen = printValue(ptr != 0 ? *(const int*)ptr : 0, tv_.format); break;
case 3: clen = printValue(ptr != 0 ? *(const long*)ptr : 0l, tv_.format); break;
case 4: clen = printValue(ptr != 0 ? *(const char*)ptr : char(0), tv_.format); break;
case 5: clen = printValue(ptr != 0 ? *(const float*)ptr : 0.f, tv_.format); break;
case 6: clen = printValue(ptr != 0 ? *(const double*)ptr : 0., tv_.format); break;
case 7: clen = printValue(ptr != 0 ? *(const short*)ptr : short(0), tv_.format); break;
case 8: clen = printValue(ptr != 0 ? *(const uint*)ptr : 0u, tv_.format); break;
case 9: clen = printValue(ptr != 0 ? *(const ulong*)ptr : 0ul, tv_.format); break;
case 10: clen = printValue(ptr != 0 ? *(const ushort*)ptr : ushort(0), tv_.format); break;
case 11: clen = printValue(ptr != 0 ? *(const uchar*)ptr : uchar(0), tv_.format); break;
case 12: clen = printValue(ptr != 0 ? *(const llong*)ptr : 0l, tv_.format); break;
case 13: clen = printValue(ptr != 0 ? *(const ullong*)ptr: 0ull, tv_.format); break;
case 20: clen = printValue(ptr != 0 ? *(const PISystemTime*)ptr: PISystemTime(), tv_.format); break;
case 14: clen = printValue(bitsValue(ptr, tv_.bitFrom, tv_.bitCount), tv_.format); break;
}
if (clen + tv.offset < (uint)col_wid) {
if (clen + tv_.offset < (uint)col_wid) {
PIString ts = PIString(
#if defined(QNX) || defined(FREE_BSD)
col_wid - clen - tv.offset - 1, ' ');
col_wid - clen - tv_.offset - 1, ' ');
#else
col_wid - clen - tv.offset, ' ');
col_wid - clen - tv_.offset, ' ');
#endif
printf("%s", ts.data());
}
@@ -575,10 +575,10 @@ void PIConsole::fillLabels() {
if (int(j) > height - 3) continue;
if (max_y < j) max_y = j;
moveRight(cx);
Variable & tv(cvars[j]);
Variable & tv_(cvars[j]);
cvars[j].nx = cx;
cvars[j].ny = cy;
if (tv.name.isEmpty()) {
if (tv_.name.isEmpty()) {
cvars[j].offset = 0;
clearLine();
newLine();
@@ -586,33 +586,33 @@ void PIConsole::fillLabels() {
continue;
}
clearLine();
//piCout << tv.name << tv.type << tv.ptr;
if (tv.type == 15) {
//piCout << tv_.name << tv_.type << tv_.ptr;
if (tv_.type == 15) {
cvars[j].offset = cvars[j].name.length();
cvars[j].nx += cvars[j].offset;
printLine(tv.name, cx, tv.format);
printLine(tv_.name, cx, tv_.format);
newLine();
cy++;
continue;
}
if (!tv.isEmpty()) {
if (!tv_.isEmpty()) {
switch (ccol.alignment) {
case Nothing:
cvars[j].offset = (tv.name + ": ").length();
cvars[j].offset = (tv_.name + ": ").length();
cvars[j].nx += cvars[j].offset;
printValue(tv.name + ": ", tv.format);
printValue(tv_.name + ": ", tv_.format);
break;
case Left:
cvars[j].offset = mx;
cvars[j].nx += cvars[j].offset;
printValue(tv.name + ": ", tv.format);
printValue(tv_.name + ": ", tv_.format);
break;
case Right:
cvars[j].offset = mx;
cvars[j].nx += cvars[j].offset;
dx = mx - (tv.name + ": ").length();
dx = mx - (tv_.name + ": ").length();
moveRight(dx);
printValue(tv.name + ": ", tv.format);
printValue(tv_.name + ": ", tv_.format);
moveLeft(dx);
break;
}