ENH: remove several compiler warnings

This commit is contained in:
Bill Hoffman 2002-03-13 10:25:11 -05:00
parent 83a0759e47
commit 809b32fe59
25 changed files with 96 additions and 67 deletions

View File

@ -25,6 +25,22 @@ cmCacheManager.cxx
cmCableClassSet.cxx
cmSourceGroup.cxx
cmListFileCache.cxx
cmake.h
cmakewizard.h
cmMakeDepend.h
cmMakefile.h
cmMakefileGenerator.h
cmRegularExpression.h
cmSourceFile.h
cmSystemTools.h
cmDirectory.h
cmCommands.h
cmTarget.h
cmCustomCommand.h
cmCacheManager.h
cmCableClassSet.h
cmSourceGroup.h
cmListFileCache.h
)
# configure the .h file
@ -37,10 +53,20 @@ INCLUDE_DIRECTORIES(${CMake_BINARY_DIR}/Source)
ADD_DEFINITIONS(-DCMAKE_BUILD_WITH_CMAKE)
IF (WIN32)
SOURCE_FILES(SRCS cmDSWWriter.cxx cmDSPWriter.cxx cmMSProjectGenerator.cxx)
SOURCE_FILES(SRCS cmBorlandMakefileGenerator.cxx)
SOURCE_FILES(SRCS cmNMakeMakefileGenerator.cxx)
SOURCE_FILES(SRCS cmMSDotNETGenerator.cxx)
SOURCE_FILES(SRCS
cmDSWWriter.cxx
cmDSPWriter.cxx
cmMSProjectGenerator.cxx
cmBorlandMakefileGenerator.cxx
cmNMakeMakefileGenerator.cxx
cmMSDotNETGenerator.cxx
cmDSWWriter.cxx
cmDSPWriter.h
cmMSProjectGenerator.h
cmBorlandMakefileGenerator.h
cmNMakeMakefileGenerator.h
cmMSDotNETGenerator.h
)
IF(NOT UNIX)
IF( NOT BORLAND )
LINK_LIBRARIES( rpcrt4.lib )
@ -57,7 +83,7 @@ IF (UNIX)
ENDIF (CURSES_LIBRARY)
ENDIF (UNIX)
SOURCE_FILES(SRCS cmUnixMakefileGenerator.cxx)
SOURCE_FILES(SRCS cmUnixMakefileGenerator.cxx cmUnixMakefileGenerator.h)
# create a library used by the command line and the GUI

View File

@ -35,8 +35,8 @@ bool cmAuxSourceDirectoryCommand::InitialPass(std::vector<std::string> const& ar
cmDirectory dir;
if(dir.Load(tdir.c_str()))
{
int numfiles = dir.GetNumberOfFiles();
for(int i =0; i < numfiles; ++i)
size_t numfiles = dir.GetNumberOfFiles();
for(size_t i =0; i < numfiles; ++i)
{
std::string file = dir.GetFile(i);
// Split the filename into base and extension

View File

@ -86,7 +86,7 @@ void cmCableClassSet::AddSource(const char* name)
/**
* Get the size of the internal CableClassMap used to store the set.
*/
unsigned int cmCableClassSet::Size() const
size_t cmCableClassSet::Size() const
{
return m_CableClassMap.size();
}

View File

@ -70,7 +70,7 @@ public:
void AddClass(const char*, cmCableClass*);
void AddSource(const char* name);
unsigned int Size() const;
size_t Size() const;
CableClassMap::const_iterator Begin() const;
CableClassMap::const_iterator End() const;

View File

@ -39,7 +39,7 @@ cmDirectory
::Load(const char* name)
{
char* buf;
int n = strlen(name);
size_t n = strlen(name);
if ( name[n - 1] == '/' )
{
buf = new char[n + 1 + 1];
@ -53,7 +53,7 @@ cmDirectory
struct _finddata_t data; // data of current file
// Now put them into the file array
long srchHandle = _findfirst(buf, &data);
size_t srchHandle = _findfirst(buf, &data);
delete [] buf;
if ( srchHandle == -1 )
@ -109,7 +109,7 @@ cmDirectory
*/
const char*
cmDirectory
::GetFile(unsigned int index)
::GetFile(size_t index)
{
if ( index >= m_Files.size() )
{

View File

@ -42,12 +42,12 @@ public:
/**
* Return the number of files in the current directory.
*/
std::vector<std::string>::size_type GetNumberOfFiles() { return m_Files.size();}
size_t GetNumberOfFiles() { return m_Files.size();}
/**
* Return the file at the given index, the indexing is 0 based
*/
const char* GetFile(unsigned int index);
const char* GetFile(size_t );
private:
std::vector<std::string> m_Files; // Array of Files

View File

@ -101,14 +101,14 @@ void cmFLTKWrapUICommand::FinalPass()
{
// first we add the rules for all the .fl to .h and .cxx files
int lastHeadersClass = m_GeneratedHeadersClasses.size();
size_t lastHeadersClass = m_GeneratedHeadersClasses.size();
std::string fluid_exe = "${FLTK_FLUID_EXE}";
std::string outputGUIDirectory = m_Makefile->GetCurrentOutputDirectory();
// Generate code for all the .fl files
for(int classNum = 0; classNum < lastHeadersClass; classNum++)
for(size_t classNum = 0; classNum < lastHeadersClass; classNum++)
{
// set up .fl to .h and .cxx command
std::string hres = outputGUIDirectory;

View File

@ -30,7 +30,7 @@ bool cmFindFileCommand::InitialPass(std::vector<std::string> const& argsIn)
}
std::string helpString = "Where can the ";
helpString += argsIn[1] + " file be found";
unsigned int size = argsIn.size();
size_t size = argsIn.size();
std::vector<std::string> args;
for(unsigned int j = 0; j < size; ++j)
{

View File

@ -26,7 +26,7 @@ bool cmFindLibraryCommand::InitialPass(std::vector<std::string> const& argsIn)
return false;
}
std::string helpString;
unsigned int size = argsIn.size();
size_t size = argsIn.size();
std::vector<std::string> args;
for(unsigned int j = 0; j < size; ++j)
{

View File

@ -31,7 +31,7 @@ bool cmFindPathCommand::InitialPass(std::vector<std::string> const& argsIn)
std::string helpString = "What is the path where the file ";
helpString += argsIn[1] + " can be found";
std::vector<std::string> args;
unsigned int size = argsIn.size();
size_t size = argsIn.size();
for(unsigned int j = 0; j < size; ++j)
{
if(argsIn[j] != "DOC")

View File

@ -29,7 +29,7 @@ bool cmFindProgramCommand::InitialPass(std::vector<std::string> const& argsIn)
return false;
}
std::string doc = "Path to a program.";
unsigned int size = argsIn.size();
size_t size = argsIn.size();
std::vector<std::string> args;
for(unsigned int j = 0; j < size; ++j)
{

View File

@ -360,7 +360,7 @@ void cmMSDotNETGenerator::WriteProject(std::ostream& fout,
const char* dspname,
const char* dir,
cmMSDotNETGenerator*,
const cmTarget& target
const cmTarget&
)
{
std::string d = cmSystemTools::ConvertToOutputPath(dir);
@ -377,7 +377,7 @@ void cmMSDotNETGenerator::WriteProject(std::ostream& fout,
// the libraries it uses are also done here
void cmMSDotNETGenerator::WriteProjectDepends(std::ostream& fout,
const char* dspname,
const char* dir,
const char* ,
cmMSDotNETGenerator*,
const cmTarget& target
)
@ -441,10 +441,10 @@ void cmMSDotNETGenerator::WriteProjectConfigurations(std::ostream& fout, const c
// Write a dsp file into the SLN file,
// Note, that dependencies from executables to
// the libraries it uses are also done here
void cmMSDotNETGenerator::WriteExternalProject(std::ostream& fout,
const char* name,
const char* location,
const std::vector<std::string>& dependencies)
void cmMSDotNETGenerator::WriteExternalProject(std::ostream& ,
const char* ,
const char* ,
const std::vector<std::string>& )
{
cmSystemTools::Error("WriteExternalProject not implemented");
// fout << "#########################################################"
@ -907,9 +907,9 @@ void cmMSDotNETGenerator::OutputModuleDefinitionFile(std::ostream& fout,
}
void cmMSDotNETGenerator::OutputLibraryDirectories(std::ostream& fout,
const char* configName,
const char* libName,
const cmTarget &target)
const char*,
const char*,
const cmTarget &)
{
bool hasone = false;
if(m_LibraryOutputPath.size())
@ -1197,7 +1197,7 @@ void cmMSDotNETGenerator::WriteCustomRule(std::ostream& fout,
void cmMSDotNETGenerator::WriteVCProjBeginGroup(std::ostream& fout,
const char* group,
const char* filter)
const char* )
{
fout << "\t\t<Filter\n"
<< "\t\t\tName=\"" << group << "\"\n"
@ -1288,7 +1288,7 @@ void cmMSDotNETGenerator::OutputTargetRules(std::ostream& fout,
}
void cmMSDotNETGenerator::WriteProjectStart(std::ostream& fout, const char *libName,
const cmTarget &target,
const cmTarget &,
std::vector<cmSourceGroup> &)
{
fout << "<?xml version=\"1.0\" encoding = \"Windows-1252\"?>\n"

View File

@ -322,8 +322,8 @@ bool cmMakefile::ReadListFile(const char* filename, const char* external)
}
// add this list file to the list of dependencies
m_ListFiles.push_back( filenametoread);
const int numberFunctions = lf->m_Functions.size();
for(int i =0; i < numberFunctions; ++i)
const size_t numberFunctions = lf->m_Functions.size();
for(size_t i =0; i < numberFunctions; ++i)
{
cmListFileFunction& curFunction = lf->m_Functions[i];
if(!this->IsFunctionBlocked(curFunction.m_Name.c_str(),

View File

@ -54,7 +54,7 @@ std::string cmNMakeMakefileGenerator::ShortPath(const char* path)
// if there are spaces then call GetShortPathName to get rid of them
char *buffer = new char[strlen(path)+1];
if(GetShortPathName(path, buffer,
strlen(path)+1) != 0)
static_cast<int>(strlen(path)+1)) != 0)
{
ret = buffer;
}

View File

@ -89,7 +89,7 @@ void cmQTWrapCPPCommand::FinalPass()
{
// first we add the rules for all the .h to Moc files
int lastClass = m_WrapClasses.size();
size_t lastClass = m_WrapClasses.size();
std::vector<std::string> depends;
std::string moc_exe = "${QT_MOC_EXE}";
@ -105,7 +105,7 @@ void cmQTWrapCPPCommand::FinalPass()
moc_list=moc_list+GENERATED_QT_FILES_value;
}
for(int classNum = 0; classNum < lastClass; classNum++)
for(size_t classNum = 0; classNum < lastClass; classNum++)
{
// Add output to build list
m_Makefile->AddSource(m_WrapClasses[classNum],m_SourceList.c_str());

View File

@ -111,7 +111,7 @@ void cmQTWrapUICommand::FinalPass()
{
// first we add the rules for all the .ui to .h and .cxx files
int lastHeadersClass = m_WrapHeadersClasses.size();
size_t lastHeadersClass = m_WrapHeadersClasses.size();
std::vector<std::string> depends;
std::string uic_exe = "${QT_UIC_EXE}";
std::string moc_exe = "${QT_MOC_EXE}";
@ -128,7 +128,7 @@ void cmQTWrapUICommand::FinalPass()
ui_list=ui_list+GENERATED_QT_FILES_value;
}
for(int classNum = 0; classNum < lastHeadersClass; classNum++)
for(size_t classNum = 0; classNum < lastHeadersClass; classNum++)
{
// set up .ui to .h and .cxx command

View File

@ -376,7 +376,7 @@ void cmRegularExpression::compile (const char* exp) {
for (; scan != NULL; scan = regnext(scan))
if (OP(scan) == EXACTLY && strlen(OPERAND(scan)) >= len) {
longest = OPERAND(scan);
len = strlen(OPERAND(scan));
len = int(strlen(OPERAND(scan)));
}
this->regmust = longest;
this->regmlen = len;
@ -675,7 +675,7 @@ static char* regatom (int *flagp) {
register char ender;
regparse--;
len = strcspn(regparse, META);
len = int(strcspn(regparse, META));
if (len <= 0) {
//RAISE Error, SYM(cmRegularExpression), SYM(Internal_Error),
printf ("cmRegularExpression::compile(): Internal error.\n");
@ -784,9 +784,9 @@ static void regtail (char* p, const char* val) {
}
if (OP(scan) == BACK)
offset = (const char*)scan - val;
offset = int(scan - val);
else
offset = val - scan;
offset = int(val - scan);
*(scan + 1) = (offset >> 8) & 0377;
*(scan + 2) = offset & 0377;
}
@ -969,7 +969,7 @@ static int regmatch (const char* prog) {
// Inline the first character, for speed.
if (*opnd != *reginput)
return (0);
len = strlen(opnd);
len = int(strlen(opnd));
if (len > 1 && strncmp(opnd, reginput, len) != 0)
return (0);
reginput += len;
@ -1128,7 +1128,7 @@ static int regrepeat (const char* p) {
opnd = OPERAND(p);
switch (OP(p)) {
case ANY:
count = strlen(scan);
count = int(strlen(scan));
scan += count;
break;
case EXACTLY:

View File

@ -122,8 +122,10 @@ void cmSourceGroup::Print() const
std::cout << "FullCommand: " << j->first.c_str() << "\n";
std::cout << "Command: " << j->second.m_Command.c_str() << "\n";
std::cout << "Arguments: " << j->second.m_Arguments.c_str() << "\n";
std::cout << "Command Outputs " << j->second.m_Outputs.size() << "\n";
std::cout << "Command Depends " << j->second.m_Depends.size() << "\n";
std::cout << "Command Outputs "
<< static_cast<int>(j->second.m_Outputs.size()) << "\n";
std::cout << "Command Depends "
<< static_cast<int>(j->second.m_Depends.size()) << "\n";
}
}
}

View File

@ -637,7 +637,7 @@ void cmSystemTools::GetArguments(std::string& line,
while(!done)
{
std::string arg;
unsigned int endpos;
std::string::size_type endpos;
bool foundQuoted = quotedArgument.find(line.c_str());
bool foundNormal = normalArgument.find(line.c_str());
@ -1427,7 +1427,8 @@ void cmSystemTools::Glob(const char *directory, const char *regexp,
if (d.Load(directory))
{
unsigned int i, numf;
size_t numf;
unsigned int i;
numf = d.GetNumberOfFiles();
for (i = 0; i < numf; i++)
{

View File

@ -174,10 +174,10 @@ cmVTKMakeInstantiatorCommand
m_Makefile->AddSource(file, outSourceList.c_str());
}
unsigned int numClasses = m_Classes.size();
unsigned int numFullBlocks = numClasses / groupSize;
unsigned int lastBlockSize = numClasses % groupSize;
unsigned int numBlocks = numFullBlocks + ((lastBlockSize>0)? 1:0);
size_t numClasses = m_Classes.size();
size_t numFullBlocks = numClasses / groupSize;
size_t lastBlockSize = numClasses % groupSize;
size_t numBlocks = numFullBlocks + ((lastBlockSize>0)? 1:0);
// Generate the files with the ::New() calls to each class. These
// are done in groups to keep the translation unit size smaller.

View File

@ -78,7 +78,7 @@ bool cmVTKWrapJavaCommand::InitialPass(std::vector<std::string> const& args)
void cmVTKWrapJavaCommand::FinalPass()
{
// first we add the rules for all the .h to Java.cxx files
int lastClass = m_WrapClasses.size();
size_t lastClass = m_WrapClasses.size();
std::vector<std::string> depends;
std::vector<std::string> depends2;
std::vector<std::string> alldepends;
@ -98,7 +98,7 @@ void cmVTKWrapJavaCommand::FinalPass()
depends.push_back(hints);
depends2.push_back(hints);
}
for(int classNum = 0; classNum < lastClass; classNum++)
for(size_t classNum = 0; classNum < lastClass; classNum++)
{
m_Makefile->AddSource(m_WrapClasses[classNum],m_SourceList.c_str());

View File

@ -78,7 +78,7 @@ bool cmVTKWrapPythonCommand::InitialPass(std::vector<std::string> const& args)
void cmVTKWrapPythonCommand::FinalPass()
{
// first we add the rules for all the .h to Python.cxx files
int lastClass = m_WrapClasses.size();
size_t lastClass = m_WrapClasses.size();
std::vector<std::string> depends;
std::string wpython = "${VTK_WRAP_PYTHON_EXE}";
std::string hints = "${VTK_WRAP_HINTS}";
@ -105,7 +105,7 @@ void cmVTKWrapPythonCommand::FinalPass()
{
depends.push_back(hints);
}
for(int classNum = 0; classNum < lastClass; classNum++)
for(size_t classNum = 0; classNum < lastClass; classNum++)
{
m_Makefile->AddSource(m_WrapClasses[classNum],m_SourceList.c_str());
std::string res = m_Makefile->GetCurrentOutputDirectory();
@ -129,8 +129,8 @@ void cmVTKWrapPythonCommand::FinalPass()
bool cmVTKWrapPythonCommand::CreateInitFile(std::string& res)
{
std::vector<std::string> classes;
int lastClass = m_WrapHeaders.size();
int classNum;
size_t lastClass = m_WrapHeaders.size();
size_t classNum;
for(classNum = 0; classNum < lastClass; classNum++)
{
std::string cls = m_WrapHeaders[classNum];

View File

@ -110,7 +110,7 @@ bool cmVTKWrapTclCommand::InitialPass(std::vector<std::string> const& args)
void cmVTKWrapTclCommand::FinalPass()
{
// first we add the rules for all the .h to Tcl.cxx files
int lastClass = m_WrapClasses.size();
size_t lastClass = m_WrapClasses.size();
std::vector<std::string> depends;
std::string wtcl = "${VTK_WRAP_TCL_EXE}";
std::string hints = "${VTK_WRAP_HINTS}";
@ -137,7 +137,7 @@ void cmVTKWrapTclCommand::FinalPass()
{
depends.push_back(hints);
}
for(int classNum = 0; classNum < lastClass; classNum++)
for(size_t classNum = 0; classNum < lastClass; classNum++)
{
m_Makefile->AddSource(m_WrapClasses[classNum],m_SourceList.c_str());
std::vector<std::string> args;
@ -165,8 +165,8 @@ bool cmVTKWrapTclCommand::CreateInitFile(std::string& res)
std::string kitName = cmSystemTools::Capitalized(m_LibraryName);
std::vector<std::string> classes;
int lastClass = m_WrapHeaders.size();
int classNum;
size_t lastClass = m_WrapHeaders.size();
size_t classNum;
for(classNum = 0; classNum < lastClass; classNum++)
{
if (!m_WrapClasses[classNum].IsAnAbstractClass())

View File

@ -142,7 +142,7 @@ int main (int argc, char *argv[])
{
char *buffer = new char[makeCommand.size()+1];
if(GetShortPathName(makeCommand.c_str(), buffer,
makeCommand.size()+1) != 0)
int(makeCommand.size()+1)) != 0)
{
makeCommand = buffer;
}
@ -161,7 +161,7 @@ int main (int argc, char *argv[])
{
char *buffer = new char[makeCommand.size()+1];
if(GetShortPathName(makeCommand.c_str(), buffer,
makeCommand.size()+1) != 0)
int(makeCommand.size()+1)) != 0)
{
makeCommand = buffer;
}

View File

@ -292,7 +292,7 @@ int main (int argc, char *argv[])
// call process directory
inst.ProcessDirectory(passed, failed);
total = passed + failed.size();
total = passed + int(failed.size());
if (total == 0)
{
@ -300,7 +300,7 @@ int main (int argc, char *argv[])
}
else
{
float percent = passed * 100.0 / total;
float percent = passed * 100.0f / total;
fprintf(stderr,"%.0f%% tests passed, %i tests failed out of %i\n",
percent, failed.size(), total);
if (failed.size())
@ -314,5 +314,5 @@ int main (int argc, char *argv[])
}
}
return failed.size();
return int(failed.size());
}