diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2008-02-01 16:30:08 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2008-02-01 16:30:08 (GMT) |
commit | 9b55f81522a92523504327e6b1cc79c5f81bdad3 (patch) | |
tree | 14eaca431131e13794c1c8315531bf4916bfee1b /Source | |
parent | 32409bb8e3ae410e54484c94f899b26235a25092 (diff) | |
download | CMake-9b55f81522a92523504327e6b1cc79c5f81bdad3.zip CMake-9b55f81522a92523504327e6b1cc79c5f81bdad3.tar.gz CMake-9b55f81522a92523504327e6b1cc79c5f81bdad3.tar.bz2 |
ENH: fix some warnings and 64 bit build windows
Diffstat (limited to 'Source')
-rw-r--r-- | Source/kwsys/SystemInformation.cxx | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx index 9a7160a..9d35d76 100644 --- a/Source/kwsys/SystemInformation.cxx +++ b/Source/kwsys/SystemInformation.cxx @@ -2124,13 +2124,13 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity() /** Extract a value from the CPUInfo file */ kwsys_stl::string SystemInformationImplementation::ExtractValueFromCpuInfoFile(kwsys_stl::string buffer,const char* word,int init) { - long int pos = buffer.find(word,init); - if(pos != -1) + size_t pos = buffer.find(word,init); + if(pos != buffer.npos) { this->CurrentPositionInFile = pos; pos = buffer.find(":",pos); - long int pos2 = buffer.find("\n",pos); - if(pos!=-1 && pos2!=-1) + size_t pos2 = buffer.find("\n",pos); + if(pos!=buffer.npos && pos2!=buffer.npos) { return buffer.substr(pos+2,pos2-pos-2); } @@ -2164,8 +2164,8 @@ int SystemInformationImplementation::RetreiveInformationFromCpuInfoFile() buffer.resize(fileSize-2); // Number of CPUs - long int pos = buffer.find("processor\t"); - while(pos != -1) + size_t pos = buffer.find("processor\t"); + while(pos != buffer.npos) { this->NumberOfLogicalCPU++; this->NumberOfPhysicalCPU++; @@ -2575,8 +2575,11 @@ int SystemInformationImplementation::CPUCount() if (this->NumberOfLogicalCPU >= 1) // >1 Doesn't mean HT is enabled in the BIOS { HANDLE hCurrentProcessHandle; - DWORD dwProcessAffinity; - DWORD dwSystemAffinity; +#ifndef _WIN64 +# define DWORD_PTR DWORD +#endif + DWORD_PTR dwProcessAffinity; + DWORD_PTR dwSystemAffinity; DWORD dwAffinityMask; // Calculate the appropriate shifts and mask based on the @@ -2723,12 +2726,12 @@ bool SystemInformationImplementation::ParseSysCtl() /** Extract a value from sysctl command */ kwsys_stl::string SystemInformationImplementation::ExtractValueFromSysCtl(const char* word) { - long int pos = this->SysCtlBuffer.find(word); - if(pos != -1) + size_t pos = this->SysCtlBuffer.find(word); + if(pos != this->SysCtlBuffer.npos) { pos = this->SysCtlBuffer.find(": ",pos); - long int pos2 = this->SysCtlBuffer.find("\n",pos); - if(pos!=-1 && pos2!=-1) + size_t pos2 = this->SysCtlBuffer.find("\n",pos); + if(pos!=this->SysCtlBuffer.npos && pos2!=this->SysCtlBuffer.npos) { return this->SysCtlBuffer.substr(pos+2,pos2-pos-2); } @@ -2807,14 +2810,14 @@ kwsys_stl::string SystemInformationImplementation::ParseValueFromKStat(const cha kwsys_stl::string command = arguments; long int start = -1; - long int pos = command.find(' ',0); - while(pos!=-1) + size_t pos = command.find(' ',0); + while(pos!=command.npos) { bool inQuotes = false; // Check if we are between quotes - long int b0 = command.find('"',0); - long int b1 = command.find('"',b0+1); - while(b0 != -1 && b1 != -1 && b1>b0) + size_t b0 = command.find('"',0); + size_t b1 = command.find('"',b0+1); + while(b0 != command.npos && b1 != command.npos && b1>b0) { if(pos>b0 && pos<b1) { @@ -2830,7 +2833,7 @@ kwsys_stl::string SystemInformationImplementation::ParseValueFromKStat(const cha kwsys_stl::string arg = command.substr(start+1,pos-start-1); // Remove the quotes if any - long int quotes = arg.find('"'); + size_t quotes = arg.find('"'); while(quotes != -1) { arg.erase(quotes,1); |