COMP:Fixed warnings.

This commit is contained in:
Francois Bertel 2008-12-15 17:19:26 -05:00
parent e4325e7d9c
commit ef36d72c89
2 changed files with 15 additions and 13 deletions

View File

@ -723,7 +723,8 @@ void kwsysProcess_Execute(kwsysProcess* cp)
if(cp->WorkingDirectory) if(cp->WorkingDirectory)
{ {
int r; int r;
if(!getcwd(cp->RealWorkingDirectory, cp->RealWorkingDirectoryLength)) if(!getcwd(cp->RealWorkingDirectory,
(size_t)(cp->RealWorkingDirectoryLength)))
{ {
kwsysProcessCleanup(cp, 1); kwsysProcessCleanup(cp, 1);
return; return;
@ -1426,7 +1427,8 @@ static int kwsysProcessInitialize(kwsysProcess* cp)
#else #else
cp->RealWorkingDirectoryLength = 4096; cp->RealWorkingDirectoryLength = 4096;
#endif #endif
cp->RealWorkingDirectory = malloc(cp->RealWorkingDirectoryLength); cp->RealWorkingDirectory =
malloc((size_t)(cp->RealWorkingDirectoryLength));
if(!cp->RealWorkingDirectory) if(!cp->RealWorkingDirectory)
{ {
return 0; return 0;
@ -1736,7 +1738,7 @@ static int kwsysProcessCreate(kwsysProcess* cp, int prIndex,
{ {
/* Keep trying to read until the operation is not interrupted. */ /* Keep trying to read until the operation is not interrupted. */
while(((n = read(si->ErrorPipe[0], cp->ErrorMessage+total, 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)); (errno == EINTR));
if(n > 0) if(n > 0)
{ {
@ -2665,7 +2667,7 @@ static int kwsysProcessAppendByte(char* local,
if((*end - *begin) >= *size) if((*end - *begin) >= *size)
{ {
kwsysProcess_ptrdiff_t length = *end - *begin; kwsysProcess_ptrdiff_t length = *end - *begin;
char* newBuffer = (char*)malloc(*size*2); char* newBuffer = (char*)malloc((size_t)(*size*2));
if(!newBuffer) if(!newBuffer)
{ {
return 0; return 0;
@ -2719,14 +2721,14 @@ static int kwsysProcessAppendArgument(char** local,
} }
/* Allocate space for the argument string. */ /* Allocate space for the argument string. */
**end = (char*)malloc(*arg_end - *arg_begin); **end = (char*)malloc((size_t)(*arg_end - *arg_begin));
if(!**end) if(!**end)
{ {
return 0; return 0;
} }
/* Store the argument in the command array. */ /* 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); ++(*end);
/* Reset the argument to be empty. */ /* Reset the argument to be empty. */

View File

@ -2158,7 +2158,7 @@ int SystemInformationImplementation::RetreiveInformationFromCpuInfoFile()
size_t fileSize = 0; size_t fileSize = 0;
while(!feof(fd)) while(!feof(fd))
{ {
buffer += fgetc(fd); buffer += static_cast<unsigned char>(fgetc(fd));
fileSize++; fileSize++;
} }
fclose( fd ); fclose( fd );
@ -2500,7 +2500,7 @@ unsigned char SystemInformationImplementation::LogicalCPUPerPhysicalCPU(void)
#if USE_ASM_INSTRUCTIONS #if USE_ASM_INSTRUCTIONS
if (!this->IsHyperThreadingSupported()) if (!this->IsHyperThreadingSupported())
{ {
return (unsigned char) 1; // HT not supported return static_cast<unsigned char>(1); // HT not supported
} }
__asm __asm
{ {
@ -2509,7 +2509,7 @@ unsigned char SystemInformationImplementation::LogicalCPUPerPhysicalCPU(void)
mov Regebx, ebx mov Regebx, ebx
} }
#endif #endif
return (unsigned char) ((Regebx & NUM_LOGICAL_BITS) >> 16); return static_cast<unsigned char> ((Regebx & NUM_LOGICAL_BITS) >> 16);
} }
/** Works only for windows */ /** Works only for windows */
@ -2565,7 +2565,7 @@ unsigned char SystemInformationImplementation::GetAPICId()
#if USE_ASM_INSTRUCTIONS #if USE_ASM_INSTRUCTIONS
if (!this->IsHyperThreadingSupported()) if (!this->IsHyperThreadingSupported())
{ {
return (unsigned char) -1; // HT not supported return static_cast<unsigned char>(-1); // HT not supported
} // Logical processor = 1 } // Logical processor = 1
__asm __asm
{ {
@ -2574,7 +2574,7 @@ unsigned char SystemInformationImplementation::GetAPICId()
mov Regebx, ebx mov Regebx, ebx
} }
#endif #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. */ /** Count the number of CPUs. Works only on windows. */
@ -2727,7 +2727,7 @@ bool SystemInformationImplementation::ParseSysCtl()
this->NumberOfLogicalCPU /= this->NumberOfPhysicalCPU; 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; this->CPUSpeedInMHz /= 1000000;
// Chip family // Chip family
@ -2905,7 +2905,7 @@ bool SystemInformationImplementation::QuerySolarisInfo()
this->NumberOfLogicalCPU /= this->NumberOfPhysicalCPU; 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 // Chip family
this->ChipID.Family = 0; this->ChipID.Family = 0;