summaryrefslogtreecommitdiffstats
path: root/Source/kwsys
diff options
context:
space:
mode:
Diffstat (limited to 'Source/kwsys')
-rw-r--r--Source/kwsys/ProcessUNIX.c14
-rw-r--r--Source/kwsys/SystemInformation.cxx14
2 files changed, 15 insertions, 13 deletions
diff --git a/Source/kwsys/ProcessUNIX.c b/Source/kwsys/ProcessUNIX.c
index 2f8914b..4d7fdd8 100644
--- a/Source/kwsys/ProcessUNIX.c
+++ b/Source/kwsys/ProcessUNIX.c
@@ -723,7 +723,8 @@ void kwsysProcess_Execute(kwsysProcess* cp)
if(cp->WorkingDirectory)
{
int r;
- if(!getcwd(cp->RealWorkingDirectory, cp->RealWorkingDirectoryLength))
+ if(!getcwd(cp->RealWorkingDirectory,
+ (size_t)(cp->RealWorkingDirectoryLength)))
{
kwsysProcessCleanup(cp, 1);
return;
@@ -1426,7 +1427,8 @@ static int kwsysProcessInitialize(kwsysProcess* cp)
#else
cp->RealWorkingDirectoryLength = 4096;
#endif
- cp->RealWorkingDirectory = malloc(cp->RealWorkingDirectoryLength);
+ cp->RealWorkingDirectory =
+ malloc((size_t)(cp->RealWorkingDirectoryLength));
if(!cp->RealWorkingDirectory)
{
return 0;
@@ -1736,7 +1738,7 @@ static int kwsysProcessCreate(kwsysProcess* cp, int prIndex,
{
/* Keep trying to read until the operation is not interrupted. */
while(((n = read(si->ErrorPipe[0], cp->ErrorMessage+total,
- KWSYSPE_PIPE_BUFFER_SIZE-total)) < 0) &&
+ (size_t)(KWSYSPE_PIPE_BUFFER_SIZE-total))) < 0) &&
(errno == EINTR));
if(n > 0)
{
@@ -2665,7 +2667,7 @@ static int kwsysProcessAppendByte(char* local,
if((*end - *begin) >= *size)
{
kwsysProcess_ptrdiff_t length = *end - *begin;
- char* newBuffer = (char*)malloc(*size*2);
+ char* newBuffer = (char*)malloc((size_t)(*size*2));
if(!newBuffer)
{
return 0;
@@ -2719,14 +2721,14 @@ static int kwsysProcessAppendArgument(char** local,
}
/* Allocate space for the argument string. */
- **end = (char*)malloc(*arg_end - *arg_begin);
+ **end = (char*)malloc((size_t)(*arg_end - *arg_begin));
if(!**end)
{
return 0;
}
/* Store the argument in the command array. */
- memcpy(**end, *arg_begin, *arg_end - *arg_begin);
+ memcpy(**end, *arg_begin,(size_t)(*arg_end - *arg_begin));
++(*end);
/* Reset the argument to be empty. */
diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx
index 4b4c690..2ed5161 100644
--- a/Source/kwsys/SystemInformation.cxx
+++ b/Source/kwsys/SystemInformation.cxx
@@ -2158,7 +2158,7 @@ int SystemInformationImplementation::RetreiveInformationFromCpuInfoFile()
size_t fileSize = 0;
while(!feof(fd))
{
- buffer += fgetc(fd);
+ buffer += static_cast<unsigned char>(fgetc(fd));
fileSize++;
}
fclose( fd );
@@ -2500,7 +2500,7 @@ unsigned char SystemInformationImplementation::LogicalCPUPerPhysicalCPU(void)
#if USE_ASM_INSTRUCTIONS
if (!this->IsHyperThreadingSupported())
{
- return (unsigned char) 1; // HT not supported
+ return static_cast<unsigned char>(1); // HT not supported
}
__asm
{
@@ -2509,7 +2509,7 @@ unsigned char SystemInformationImplementation::LogicalCPUPerPhysicalCPU(void)
mov Regebx, ebx
}
#endif
- return (unsigned char) ((Regebx & NUM_LOGICAL_BITS) >> 16);
+ return static_cast<unsigned char> ((Regebx & NUM_LOGICAL_BITS) >> 16);
}
/** Works only for windows */
@@ -2565,7 +2565,7 @@ unsigned char SystemInformationImplementation::GetAPICId()
#if USE_ASM_INSTRUCTIONS
if (!this->IsHyperThreadingSupported())
{
- return (unsigned char) -1; // HT not supported
+ return static_cast<unsigned char>(-1); // HT not supported
} // Logical processor = 1
__asm
{
@@ -2574,7 +2574,7 @@ unsigned char SystemInformationImplementation::GetAPICId()
mov Regebx, ebx
}
#endif
- return (unsigned char) ((Regebx & INITIAL_APIC_ID_BITS) >> 24);
+ return static_cast<unsigned char>((Regebx & INITIAL_APIC_ID_BITS) >> 24);
}
/** Count the number of CPUs. Works only on windows. */
@@ -2727,7 +2727,7 @@ bool SystemInformationImplementation::ParseSysCtl()
this->NumberOfLogicalCPU /= this->NumberOfPhysicalCPU;
}
- this->CPUSpeedInMHz = atoi(this->ExtractValueFromSysCtl("hw.cpufrequency:").c_str());
+ this->CPUSpeedInMHz = static_cast<float>(atoi(this->ExtractValueFromSysCtl("hw.cpufrequency:").c_str()));
this->CPUSpeedInMHz /= 1000000;
// Chip family
@@ -2905,7 +2905,7 @@ bool SystemInformationImplementation::QuerySolarisInfo()
this->NumberOfLogicalCPU /= this->NumberOfPhysicalCPU;
}
- this->CPUSpeedInMHz = atoi(this->ParseValueFromKStat("-s clock_MHz").c_str());
+ this->CPUSpeedInMHz = static_cast<float>(atoi(this->ParseValueFromKStat("-s clock_MHz").c_str()));
// Chip family
this->ChipID.Family = 0;