fix all PIFile::readAll calls
This commit is contained in:
@@ -113,7 +113,7 @@ bool PISystemMonitor::startOnProcess(int pID, PISystemTime interval) {
|
||||
}
|
||||
# endif
|
||||
# else
|
||||
PRIVATE->hProc = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, pID_);
|
||||
PRIVATE->hProc = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, pID_);
|
||||
if (PRIVATE->hProc == 0) {
|
||||
piCoutObj << "Can`t open process with ID = %1, %2!"_tr("PISystemMonitor").arg(pID_).arg(errorString());
|
||||
return false;
|
||||
@@ -130,7 +130,7 @@ bool PISystemMonitor::startOnSelf(PISystemTime interval) {
|
||||
bool ret = startOnProcess(PIProcess::currentPID(), interval);
|
||||
cycle = -1;
|
||||
#else
|
||||
bool ret = start(interval);
|
||||
bool ret = start(interval);
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
@@ -212,7 +212,7 @@ void PISystemMonitor::run() {
|
||||
// piCout << (PRIVATE->cpu_u_cur - PRIVATE->cpu_u_prev).toMilliseconds() / delay_ms;
|
||||
# else
|
||||
PRIVATE->file.seekToBegin();
|
||||
PIString str = PIString::fromAscii(PRIVATE->file.readAll(true));
|
||||
PIString str = PIString::fromAscii(PRIVATE->file.readAll());
|
||||
int si = str.find('(') + 1, fi = 0, cc = 1;
|
||||
for (int i = si; i < str.size_s(); ++i) {
|
||||
if (str[i] == '(') cc++;
|
||||
@@ -250,7 +250,7 @@ void PISystemMonitor::run() {
|
||||
// piCout << sl[0] << sl[12] << sl[13];
|
||||
|
||||
PRIVATE->filem.seekToBegin();
|
||||
str = PIString::fromAscii(PRIVATE->filem.readAll(true));
|
||||
str = PIString::fromAscii(PRIVATE->filem.readAll());
|
||||
sl = str.split(" ");
|
||||
if (sl.size_s() < 6) return;
|
||||
tstat.virtual_memsize = sl[0].toLong() * page_size;
|
||||
@@ -352,12 +352,12 @@ void PISystemMonitor::gatherThread(llong id) {
|
||||
#ifdef MICRO_PIP
|
||||
ts.name = tbid.value(id, "<PIThread>");
|
||||
#else
|
||||
ts.name = tbid.value(id, "<non-PIThread>");
|
||||
ts.name = tbid.value(id, "<non-PIThread>");
|
||||
# ifndef WINDOWS
|
||||
PIFile f(PRIVATE->proc_dir + "task/" + PIString::fromNumber(id) + "/stat");
|
||||
// piCout << f.path();
|
||||
if (!f.open(PIIODevice::ReadOnly)) return;
|
||||
PIString str = PIString::fromAscii(f.readAll(true));
|
||||
PIString str = PIString::fromAscii(f.readAll());
|
||||
int si = str.find('(') + 1, fi = 0, cc = 1;
|
||||
for (int i = si; i < str.size_s(); ++i) {
|
||||
if (str[i] == '(') cc++;
|
||||
|
||||
@@ -1208,7 +1208,7 @@ PIVector<PISerial::DeviceInfo> PISerial::availableDevicesInfo(bool test) {
|
||||
# endif
|
||||
PIFile file_prefixes("/proc/tty/drivers", PIIODevice::ReadOnly);
|
||||
if (file_prefixes.open()) {
|
||||
PIString fc = PIString::fromAscii(file_prefixes.readAll(true)), line, cpref;
|
||||
PIString fc = PIString::fromAscii(file_prefixes.readAll()), line, cpref;
|
||||
PIStringList words;
|
||||
file_prefixes.close();
|
||||
while (!fc.isEmpty()) {
|
||||
@@ -1235,8 +1235,8 @@ PIVector<PISerial::DeviceInfo> PISerial::availableDevicesInfo(bool test) {
|
||||
for (const auto & e: de) { // TODO changes in FileInfo
|
||||
for (const auto & p: prefixes) {
|
||||
if (e.name().startsWith(p)) {
|
||||
di = DeviceInfo();
|
||||
di.path = e.path;
|
||||
di = DeviceInfo();
|
||||
di.path = e.path;
|
||||
# ifdef LINUX
|
||||
ssize_t lsz = readlink(("/sys/class/tty/" + e.name()).dataAscii(), linkbuf, 1024);
|
||||
if (lsz > 0) {
|
||||
|
||||
Reference in New Issue
Block a user