summaryrefslogtreecommitdiffstats
path: root/Source/kwsys/SystemInformation.cxx
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/SystemInformation.cxx
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/SystemInformation.cxx')
-rw-r--r--Source/kwsys/SystemInformation.cxx38
1 files changed, 20 insertions, 18 deletions
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;