summaryrefslogtreecommitdiffstats
path: root/Source/kwsys
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2008-01-08 19:59:57 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2008-01-08 19:59:57 (GMT)
commit50c5d5a3d5b6edc32baf3f6102368aae535262e0 (patch)
tree7665ebbedfd50482f67a01455705ecfe3286d667 /Source/kwsys
parent66fff9d4b72600e69eb31a1b91fd12a41ebac14b (diff)
downloadCMake-50c5d5a3d5b6edc32baf3f6102368aae535262e0.zip
CMake-50c5d5a3d5b6edc32baf3f6102368aae535262e0.tar.gz
CMake-50c5d5a3d5b6edc32baf3f6102368aae535262e0.tar.bz2
ENH: fix leaks and turn on by default
Diffstat (limited to 'Source/kwsys')
-rw-r--r--Source/kwsys/CMakeLists.txt2
-rw-r--r--Source/kwsys/SystemInformation.cxx38
-rw-r--r--Source/kwsys/SystemInformation.hxx.in8
3 files changed, 25 insertions, 23 deletions
diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt
index a2a438c..f58ca05 100644
--- a/Source/kwsys/CMakeLists.txt
+++ b/Source/kwsys/CMakeLists.txt
@@ -137,7 +137,7 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR)
SET(KWSYS_USE_IOStream 1)
SET(KWSYS_USE_DateStamp 1)
SET(KWSYS_USE_String 1)
-# SET(KWSYS_USE_SystemInformation 1)
+ SET(KWSYS_USE_SystemInformation 1)
ENDIF(KWSYS_STANDALONE OR CMake_SOURCE_DIR)
# Setup the large file support default.
diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx
index 2fb80e5..276c88b 100644
--- a/Source/kwsys/SystemInformation.cxx
+++ b/Source/kwsys/SystemInformation.cxx
@@ -17,6 +17,7 @@
#include KWSYS_HEADER(SystemInformation.hxx)
#include KWSYS_HEADER(Process.h)
#include KWSYS_HEADER(ios/iostream)
+#include KWSYS_HEADER(ios/sstream)
#ifndef WIN32
#include <sys/utsname.h> // int uname(struct utsname *buf);
#endif
@@ -171,35 +172,35 @@ const char * SystemInformation::GetVendorID()
}
/** Return the type ID of the CPU */
-const char * SystemInformation::GetTypeID()
+kwsys_stl::string SystemInformation::GetTypeID()
{
- char * temp = new char[32];
- sprintf(temp,"%d",this->ChipID.Type);
- return temp;
+ kwsys_ios::ostringstream str;
+ str << this->ChipID.Type;
+ return str.str();
}
/** Return the family of the CPU present */
-const char * SystemInformation::GetFamilyID()
+kwsys_stl::string SystemInformation::GetFamilyID()
{
- char * temp = new char[32];
- sprintf(temp,"%d",this->ChipID.Family);
- return temp;
+ kwsys_ios::ostringstream str;
+ str << this->ChipID.Family;
+ return str.str();
}
// Return the model of CPU present */
-const char * SystemInformation::GetModelID()
+kwsys_stl::string SystemInformation::GetModelID()
{
- char * temp = new char[32];
- sprintf(temp,"%d",this->ChipID.Model);
- return temp;
+ kwsys_ios::ostringstream str;
+ str << this->ChipID.Model;
+ return str.str();
}
/** Return the stepping code of the CPU present. */
-const char * SystemInformation::GetSteppingCode()
-{
- char * temp = new char[32];
- sprintf(temp,"%d",this->ChipID.Revision);
- return temp;
+kwsys_stl::string SystemInformation::GetSteppingCode()
+{
+ kwsys_ios::ostringstream str;
+ str << this->ChipID.Revision;
+ return str.str();
}
/** Return the stepping code of the CPU present. */
@@ -2649,7 +2650,8 @@ bool SystemInformation::QueryOSInformation()
this->OSRelease = "Unknown";
break;
}
-
+ delete [] operatingSystem;
+ operatingSystem = 0;
// Get the hostname
WORD wVersionRequested;
diff --git a/Source/kwsys/SystemInformation.hxx.in b/Source/kwsys/SystemInformation.hxx.in
index dbb76c7..40d1ea3 100644
--- a/Source/kwsys/SystemInformation.hxx.in
+++ b/Source/kwsys/SystemInformation.hxx.in
@@ -113,10 +113,10 @@ public:
const char * GetVendorString();
const char * GetVendorID();
- const char * GetTypeID();
- const char * GetFamilyID();
- const char * GetModelID();
- const char * GetSteppingCode();
+ kwsys_stl::string GetTypeID();
+ kwsys_stl::string GetFamilyID();
+ kwsys_stl::string GetModelID();
+ kwsys_stl::string GetSteppingCode();
const char * GetExtendedProcessorName();
const char * GetProcessorSerialNumber();
int GetProcessorCacheSize();