COMP: Fix warnings on 64-bit Mac OS X build. Patch from issue #3697.

This commit is contained in:
Brad King 2007-11-05 14:34:36 -05:00
parent cfa723d457
commit f410f8578e
9 changed files with 30 additions and 22 deletions

View File

@ -338,7 +338,7 @@ static int copy_ar(CF *cfp, off_t size)
{
static char pad = '\n';
off_t sz = size;
int nr, nw;
size_t nr, nw;
char buf[8*1024];
if (sz == 0)
@ -347,11 +347,11 @@ static int copy_ar(CF *cfp, off_t size)
FILE* from = cfp->rFile;
FILE* to = cfp->wFile;
while (sz &&
(nr = fread(buf, 1, sz < off_t(sizeof(buf)) ? sz : sizeof(buf), from ))
(nr = fread(buf, 1, sz < static_cast<off_t>(sizeof(buf)) ? static_cast<size_t>(sz) : sizeof(buf), from ))
> 0) {
sz -= nr;
for (int off = 0; off < nr; nr -= off, off += nw)
if ((nw = fwrite(buf + off, 1, nr, to)) < 0)
for (size_t off = 0; off < nr; nr -= off, off += nw)
if ((nw = fwrite(buf + off, 1, nr, to)) < nr)
return -1;
}
if (sz)
@ -424,7 +424,7 @@ static int ar_append(const char* archive,const std::vector<std::string>& files)
FILE* aFile = fopen(archive, "wb+");
if (aFile!=NULL) {
fwrite(ARMAG, SARMAG, 1, aFile);
if (fseek(aFile, (off_t)0, SEEK_END) != (off_t)-1) {
if (fseek(aFile, 0, SEEK_END) != -1) {
CF cf;
struct stat sb;
/* Read from disk, write to an archive; pad on write. */

View File

@ -216,8 +216,8 @@ int cmCPackNSISGenerator::InitializeInternal()
<< "Please check " << tmpFile.c_str() << " for errors" << std::endl);
return 0;
}
float nsisVersion = atof(versionRex.match(1).c_str());
float minNSISVersion = 2.09;
double nsisVersion = atof(versionRex.match(1).c_str());
double minNSISVersion = 2.09;
cmCPackLogger(cmCPackLog::LOG_DEBUG, "NSIS Version: "
<< nsisVersion << std::endl);
if ( nsisVersion < minNSISVersion )

View File

@ -30,7 +30,7 @@
//----------------------------------------------------------------------
cmCPackPackageMakerGenerator::cmCPackPackageMakerGenerator()
{
this->PackageMakerVersion = 0;
this->PackageMakerVersion = 0.0;
}
//----------------------------------------------------------------------
@ -196,7 +196,7 @@ int cmCPackPackageMakerGenerator::InitializeInternal()
return 0;
}
this->PackageMakerVersion = atof(rexVersion.match(1).c_str());
if ( this->PackageMakerVersion < 1 )
if ( this->PackageMakerVersion < 1.0 )
{
cmCPackLogger(cmCPackLog::LOG_ERROR, "Require PackageMaker 1.0 or higher"
<< std::endl);

View File

@ -48,7 +48,7 @@ protected:
bool CopyCreateResourceFile(const char* name);
bool CopyResourcePlistFile(const char* name);
float PackageMakerVersion;
double PackageMakerVersion;
};
#endif

View File

@ -1501,15 +1501,15 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary(
float cper = percentBranch + percentFunction;
if(totalBranches > 0)
{
cper /= 2.0;
cper /= 2.0f;
}
percent_coverage += cper;
float cmet = percentFunction + percentBranch;
if(totalBranches > 0)
{
cmet /= 2.0;
cmet /= 2.0f;
}
cmet /= 100.0;
cmet /= 100.0f;
// Hack for conversion of function to loc assume a function
// has 100 lines of code
functionsCalled *=100;

View File

@ -695,7 +695,15 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC(const cmStdString& localprefix,
return false;
}
size_t fileSize = st.st_size;
// off_t can be bigger than size_t. fread takes size_t.
// make sure the file is not too big.
if (st.st_size > (size_t)-1)
{
cmCTestLog(this->CTest, ERROR_MESSAGE, " File too big: "
<< local_file.c_str() << std::endl);
return false;
}
size_t fileSize = static_cast<size_t>(st.st_size);
FILE* fp = fopen(local_file.c_str(), "rb");
if ( !fp )
{

View File

@ -2484,8 +2484,8 @@ void cmake::TruncateOutputLog(const char* fname)
cmSystemTools::RemoveFile(fullPath.c_str());
return;
}
size_t fsize = st.st_size;
const size_t maxFileSize = 50 * 1024;
off_t fsize = st.st_size;
const off_t maxFileSize = 50 * 1024;
if ( fsize < maxFileSize )
{
//TODO: truncate file

View File

@ -1588,17 +1588,16 @@ bool SystemTools::FilesDiffer(const char* source,
// Compare the files a block at a time.
char source_buf[KWSYS_ST_BUFFER];
char dest_buf[KWSYS_ST_BUFFER];
long nleft = statSource.st_size;
off_t nleft = statSource.st_size;
while(nleft > 0)
{
// Read a block from each file.
long nnext = (nleft > KWSYS_ST_BUFFER)? KWSYS_ST_BUFFER : nleft;
kwsys_ios::streamsize nnext = (nleft > KWSYS_ST_BUFFER)? KWSYS_ST_BUFFER : static_cast<kwsys_ios::streamsize>(nleft);
finSource.read(source_buf, nnext);
finDestination.read(dest_buf, nnext);
// If either failed to read assume they are different.
if(static_cast<long>(finSource.gcount()) != nnext ||
static_cast<long>(finDestination.gcount()) != nnext)
if(finSource.gcount() != nnext || finDestination.gcount() != nnext)
{
return true;
}

View File

@ -3384,9 +3384,10 @@ CURLcode ftp_perform(struct connectdata *conn,
}
*connected = conn->bits.tcpconnect;
if(*dophase_done)
if(*dophase_done) {
DEBUGF(infof(conn->data, "DO phase is complete\n"));
}
return result;
}