rendered paste bodyDate: Mon Mar 1 15:17:18 2010 +0100
build: fix compile error 2
src/linuxsystem.cpp: In member function bool LinuxSystem::parseCpuInfo():
src/linuxsystem.cpp:197:72: error: atoi was not declared in this scope
src/linuxsystem.cpp:201:71: error: atoi was not declared in this scope
src/linuxsystem.cpp:204:77: error: atoi was not declared in this scope
src/linuxsystem.cpp:207:71: error: atoi was not declared in this scope
---
src/linuxsystem.cpp | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/linuxsystem.cpp b/src/linuxsystem.cpp
index b90b8bf..aeede1a 100644
--- a/src/linuxsystem.cpp
+++ b/src/linuxsystem.cpp
@@ -25,6 +25,7 @@
#include "linuxsystem.h"
#include "platform.h"
#include <sstream>
+#include <cstdlib>
#if !defined(PLATFORM_LINUX)
#error Wrong platform
@@ -194,17 +195,17 @@ bool LinuxSystem::parseCpuInfo()
m_logicalCount += 1;
}
if (regexec(&physicalidRE, buffer.c_str(), 2, match, 0) == 0) {
- int id = atoi(buffer.substr(match[1].rm_so, match[1].rm_eo).c_str());
+ int id = strtol(buffer.substr(match[1].rm_so, match[1].rm_eo).c_str(), NULL, 0);
physicalid.insert(id);
}
if (regexec(&mhzRE, buffer.c_str(), 2, match, 0) == 0) {
- m_mhz = atoi(buffer.substr(match[1].rm_so, match[1].rm_eo).c_str());
+ m_mhz = strtol(buffer.substr(match[1].rm_so, match[1].rm_eo).c_str(), NULL, 0);
}
if (regexec(&cacheRE, buffer.c_str(), 2, match, 0) == 0) {
- m_cacheSize = atoi(buffer.substr(match[1].rm_so, match[1].rm_eo).c_str());
+ m_cacheSize = strtol(buffer.substr(match[1].rm_so, match[1].rm_eo).c_str(), NULL, 0);
}
if (regexec(&clockRE, buffer.c_str(), 2, match, 0) == 0) {
- m_mhz = atoi(buffer.substr(match[1].rm_so, match[1].rm_eo).c_str());
+ m_mhz = strtol(buffer.substr(match[1].rm_so, match[1].rm_eo).c_str(), NULL, 0);
}
if (regexec(&cpuRE, buffer.c_str(), 2, match, 0) == 0) {
m_cpu = buffer.substr(match[1].rm_so, match[1].rm_eo);
--