ENH: add support for win64 for visual studio 2005 ide and nmake, also fix warnings produced by building for win64

This commit is contained in:
Bill Hoffman 2006-03-30 13:49:56 -05:00
parent 08b14163ee
commit 5a2668b326
49 changed files with 270 additions and 103 deletions

View File

@ -140,9 +140,36 @@ IF(CMAKE_GENERATOR MATCHES "NMake Makefiles")
MESSAGE(STATUS "Check if this is a free VC compiler - no")
SET(CMAKE_USING_VC_FREE_TOOLS 0)
ENDIF(CMAKE_COMPILER_RETURN)
MAKE_DIRECTORY("${CMAKE_BINARY_DIR}/CMakeFiles/CMakeTmp3")
MESSAGE(STATUS "Check for CL win64")
EXEC_PROGRAM(${CMAKE_C_COMPILER} ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeTmp3
ARGS /nologo /link /machine:i386
\"${testForFreeVCFile}\"
OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT
RETURN_VALUE CMAKE_COMPILER_RETURN
)
# if there was an error assume it is a 64bit system
IF(CMAKE_COMPILER_RETURN)
FILE(APPEND
${CMAKE_BINARY_DIR}/CMakeFiles/CMakeOutput.log
"Determining if this is a 64 bit system passed:\n"
"${CMAKE_COMPILER_OUTPUT}\n\n")
MESSAGE(STATUS "Check if this is a 64 bit system - yes")
SET(CMAKE_CL_64 1)
ELSE(CMAKE_COMPILER_RETURN)
FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeOutput.log
"Determining if this is a 32 bit system passed:\n"
"${CMAKE_COMPILER_OUTPUT}\n\n")
MESSAGE(STATUS "Check if this is 32 bit system - yes")
SET(CMAKE_CL_64 0)
ENDIF(CMAKE_COMPILER_RETURN)
ENDIF(NOT CMAKE_VC_COMPILER_TESTS_RUN)
ENDIF(CMAKE_GENERATOR MATCHES "NMake Makefiles")
IF(CMAKE_FORCE_WIN64)
SET(CMAKE_CL_64 1)
ENDIF(CMAKE_FORCE_WIN64)
# default to Debug builds
IF(CMAKE_COMPILER_2005)
@ -213,7 +240,11 @@ MARK_AS_ADVANCED(CMAKE_STANDARD_LIBRARIES)
# executable linker flags
SET (CMAKE_LINK_DEF_FILE_FLAG "/DEF:")
SET (CMAKE_EXE_LINKER_FLAGS_INIT "/STACK:10000000 /machine:I386 /INCREMENTAL:YES")
IF(CMAKE_CL_64)
SET (CMAKE_EXE_LINKER_FLAGS_INIT "/STACK:10000000 /machine:x64 /INCREMENTAL:YES")
ELSE(CMAKE_CL_64)
SET (CMAKE_EXE_LINKER_FLAGS_INIT "/STACK:10000000 /machine:I386 /INCREMENTAL:YES")
ENDIF(CMAKE_CL_64)
IF (CMAKE_COMPILER_SUPPORTS_PDBTYPE)
SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug /pdbtype:sept")
SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug /pdbtype:sept")

View File

@ -2,3 +2,4 @@ SET(CMAKE_VC_COMPILER_TESTS_RUN 1)
SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE @CMAKE_COMPILER_SUPPORTS_PDBTYPE@)
SET(CMAKE_COMPILER_2005 @CMAKE_COMPILER_2005@)
SET(CMAKE_USING_VC_FREE_TOOLS @CMAKE_USING_VC_FREE_TOOLS@)
SET(CMAKE_CL_64 @CMAKE_CL_64@)

View File

@ -198,6 +198,8 @@ IF (WIN32)
cmGlobalVisualStudio7Generator.h
cmGlobalVisualStudio8Generator.cxx
cmGlobalVisualStudio8Generator.h
cmGlobalVisualStudio8Win64Generator.cxx
cmGlobalVisualStudio8Win64Generator.h
cmGlobalWatcomWMakeGenerator.cxx
cmLocalVisualStudio6Generator.cxx
cmLocalVisualStudio6Generator.h

View File

@ -38,7 +38,7 @@ cmCTestHandlerCommand::cmCTestHandlerCommand()
bool cmCTestHandlerCommand::InitialPass(
std::vector<std::string> const& args)
{
if ( !this->ProcessArguments(args, this->Last, &*this->Arguments.begin(),
if ( !this->ProcessArguments(args, (unsigned int)this->Last, &*this->Arguments.begin(),
this->Values) )
{
return false;

View File

@ -211,9 +211,9 @@ void cmCTestMemCheckHandler::GenerateDartOutput(std::ostream& os)
os << "\t</TestList>\n";
cmCTestLog(this->CTest, HANDLER_OUTPUT,
"-- Processing memory checking output: ");
unsigned int total = this->TestResults.size();
unsigned int step = total / 10;
unsigned int current = 0;
size_t total = this->TestResults.size();
size_t step = total / 10;
size_t current = 0;
for ( cc = 0; cc < this->TestResults.size(); cc ++ )
{
cmCTestTestResult *result = &this->TestResults[cc];

View File

@ -39,7 +39,7 @@ static size_t
cmCTestSubmitHandlerWriteMemoryCallback(void *ptr, size_t size, size_t nmemb,
void *data)
{
register int realsize = size * nmemb;
register int realsize = (int)(size * nmemb);
cmCTestSubmitHandlerVectorOfChar *vec
= static_cast<cmCTestSubmitHandlerVectorOfChar*>(data);

View File

@ -119,7 +119,7 @@ char* cmCommandArgumentParserHelper::CombineUnions(char* in1, char* in2)
{
return in1;
}
int len = strlen(in1) + strlen(in2) + 1;
size_t len = strlen(in1) + strlen(in2) + 1;
char* out = new char [ len ];
strcpy(out, in1);
strcat(out, in2);
@ -133,7 +133,7 @@ void cmCommandArgumentParserHelper::AllocateParserType(cmCommandArgumentParserHe
pt->str = 0;
if ( len == 0 )
{
len = strlen(str);
len = (int)strlen(str);
}
if ( len == 0 )
{

View File

@ -143,7 +143,7 @@ void cmDependsJavaParserHelper::Print(const char* place, const char* str)
void cmDependsJavaParserHelper::CombineUnions(char** out, const char* in1, char** in2,
const char* sep)
{
int len = 1;
size_t len = 1;
if ( in1 )
{
len += strlen(in1);
@ -202,7 +202,7 @@ void cmDependsJavaParserHelper::AllocateParserType(cmDependsJavaParserHelper::Pa
pt->str = 0;
if ( len == 0 )
{
len = strlen(str);
len = (int)strlen(str);
}
if ( len == 0 )
{

View File

@ -32,7 +32,7 @@ bool cmExecuteProcessCommand::InitialPass(std::vector<std::string> const& args)
std::vector< std::vector<const char*> > cmds;
std::string arguments;
bool doing_command = false;
unsigned int command_index = 0;
size_t command_index = 0;
bool output_quiet = false;
bool error_quiet = false;
std::string timeout_string;

View File

@ -1207,8 +1207,8 @@ void cmGlobalGenerator::SetupTests()
}
// Add run_test only if any tests are foun
long total_tests = 0;
unsigned int i;
size_t total_tests = 0;
size_t i;
for (i = 0; i < this->LocalGenerators.size(); ++i)
{
total_tests += this->LocalGenerators[i]->GetMakefile()->GetTests()->size();

View File

@ -26,6 +26,7 @@ cmGlobalVisualStudio8Generator::cmGlobalVisualStudio8Generator()
{
this->FindMakeProgramFile = "CMakeVS8FindMake.cmake";
this->ProjectConfigurationSectionName = "ProjectConfigurationPlatforms";
this->PlatformName = "Win32";
}
@ -206,7 +207,8 @@ cmGlobalVisualStudio8Generator
for(std::vector<std::string>::iterator i = this->Configurations.begin();
i != this->Configurations.end(); ++i)
{
fout << "\t\t" << *i << "|Win32 = " << *i << "|Win32\n";
fout << "\t\t" << *i << "|" << this->PlatformName << " = " << *i << "|"
<< this->PlatformName << "\n";
}
fout << "\tEndGlobalSection\n";
}
@ -221,10 +223,12 @@ cmGlobalVisualStudio8Generator
for(std::vector<std::string>::iterator i = this->Configurations.begin();
i != this->Configurations.end(); ++i)
{
fout << "\t\t{" << guid << "}." << *i << "|Win32.ActiveCfg = " << *i << "|Win32\n";
fout << "\t\t{" << guid << "}." << *i << "|" << this->PlatformName << ".ActiveCfg = "
<< *i << "|" << this->PlatformName << "\n";
if (in_all_build)
{
fout << "\t\t{" << guid << "}." << *i << "|Win32.Build.0 = " << *i << "|Win32\n";
fout << "\t\t{" << guid << "}." << *i << "|" << this->PlatformName << ".Build.0 = "
<< *i << "|" << this->PlatformName << "\n";
}
}
}

View File

@ -55,5 +55,6 @@ protected:
virtual void WriteSolutionConfigurations(std::ostream& fout);
virtual void WriteProjectConfigurations(std::ostream& fout,
const char* name, bool in_all);
std::string PlatformName; // Win32 or x64
};
#endif

View File

@ -0,0 +1,53 @@
/*=========================================================================
Program: CMake - Cross-Platform Makefile Generator
Module: $RCSfile$
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "windows.h" // this must be first to define GetCurrentDirectory
#include "cmGlobalVisualStudio8Win64Generator.h"
#include "cmLocalVisualStudio7Generator.h"
#include "cmMakefile.h"
#include "cmake.h"
cmGlobalVisualStudio8Win64Generator::cmGlobalVisualStudio8Win64Generator()
{
this->PlatformName = "x64";
}
///! Create a local generator appropriate to this Global Generator
cmLocalGenerator *cmGlobalVisualStudio8Win64Generator::CreateLocalGenerator()
{
cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator;
lg->SetVersion8();
lg->SetPlatformName(this->PlatformName.c_str());
lg->SetGlobalGenerator(this);
return lg;
}
//----------------------------------------------------------------------------
void cmGlobalVisualStudio8Win64Generator::GetDocumentation(cmDocumentationEntry& entry) const
{
entry.name = this->GetName();
entry.brief = "Generates Visual Studio .NET 2005 Win64 project files.";
entry.full = "";
}
void cmGlobalVisualStudio8Win64Generator::EnableLanguage(std::vector<std::string>const & lang,
cmMakefile *mf)
{
mf->AddDefinition("CMAKE_FORCE_WIN64", "TRUE");
cmGlobalVisualStudio8Generator::EnableLanguage(lang, mf);
}

View File

@ -0,0 +1,52 @@
/*=========================================================================
Program: CMake - Cross-Platform Makefile Generator
Module: $RCSfile$
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef cmGlobalVisualStudio8Win64Generator_h
#define cmGlobalVisualStudio8Win64Generator_h
#include "cmGlobalVisualStudio8Generator.h"
/** \class cmGlobalVisualStudio8Win64Generator
* \brief Write a Unix makefiles.
*
* cmGlobalVisualStudio8Win64Generator manages UNIX build process for a tree
*/
class cmGlobalVisualStudio8Win64Generator : public cmGlobalVisualStudio8Generator
{
public:
cmGlobalVisualStudio8Win64Generator();
static cmGlobalGenerator* New() { return new cmGlobalVisualStudio8Win64Generator; }
///! Get the name for the generator.
virtual const char* GetName() const {
return cmGlobalVisualStudio8Win64Generator::GetActualName();}
static const char* GetActualName() {return "Visual Studio 8 2005 Win64";}
/** Get the documentation entry for this generator. */
virtual void GetDocumentation(cmDocumentationEntry& entry) const;
///! create the correct local generator
virtual cmLocalGenerator *CreateLocalGenerator();
/**
* Try to determine system infomation such as shared library
* extension, pthreads, byte order etc.
*/
virtual void EnableLanguage(std::vector<std::string>const& languages,
cmMakefile *);
};
#endif

View File

@ -278,7 +278,7 @@ bool cmIfCommand::IsTrue(const std::vector<std::string> &args,
// is a variable defined
if (*arg == "DEFINED" && argP1 != newArgs.end())
{
unsigned int argP1len = argP1->size();
size_t argP1len = argP1->size();
if(argP1len > 4 && argP1->substr(0, 4) == "ENV{" &&
argP1->operator[](argP1len-1) == '}')
{

View File

@ -145,12 +145,12 @@ bool cmListCommand::HandleGetCommand(std::vector<std::string> const& args)
{
value += ";";
}
int nitem = varArgsExpanded.size();
size_t nitem = varArgsExpanded.size();
if ( item < 0 )
{
item = nitem + item;
item = (int)nitem + item;
}
if ( item < 0 || nitem <= item )
if ( item < 0 || nitem <= (size_t)item )
{
cmOStringStream str;
str << "index: " << item << " out of range (-" << varArgsExpanded.size() << ", " << varArgsExpanded.size()-1 << ")";
@ -213,12 +213,12 @@ bool cmListCommand::HandleInsertCommand(std::vector<std::string> const& args)
int item = atoi(args[2].c_str());
int nitem = varArgsExpanded.size();
size_t nitem = varArgsExpanded.size();
if ( item < 0 )
{
item = nitem + item;
item = (int)nitem + item;
}
if ( item < 0 || nitem <= item )
if ( item < 0 || nitem <= (size_t)item )
{
cmOStringStream str;
str << "index: " << item << " out of range (-" << varArgsExpanded.size() << ", " << varArgsExpanded.size()-1 << ")";
@ -314,12 +314,12 @@ bool cmListCommand::HandleRemoveItemCommand(std::vector<std::string> const& args
for ( cc = 2; cc < args.size(); ++ cc )
{
int item = atoi(args[cc].c_str());
int nitem = varArgsExpanded.size();
size_t nitem = varArgsExpanded.size();
if ( item < 0 )
{
item = nitem + item;
item = (int)nitem + item;
}
if ( item < 0 || nitem <= item )
if ( item < 0 || nitem <= (size_t)item )
{
cmOStringStream str;
str << "index: " << item << " out of range (-" << varArgsExpanded.size() << ", " << varArgsExpanded.size()-1 << ")";

View File

@ -25,6 +25,7 @@
cmLocalVisualStudio7Generator::cmLocalVisualStudio7Generator()
{
this->Version = 7;
this->PlatformName = "Win32";
}
cmLocalVisualStudio7Generator::~cmLocalVisualStudio7Generator()
@ -343,7 +344,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
mfcFlag = "0";
}
fout << "\t\t<Configuration\n"
<< "\t\t\tName=\"" << configName << "|Win32\"\n"
<< "\t\t\tName=\"" << configName << "|" << this->PlatformName << "\"\n"
<< "\t\t\tOutputDirectory=\"" << configName << "\"\n";
// This is an internal type to Visual Studio, it seems that:
// 4 == static library
@ -1043,7 +1044,7 @@ void cmLocalVisualStudio7Generator::WriteGroup(const cmSourceGroup *sg, cmTarget
i != configs->end(); ++i)
{
fout << "\t\t\t\t<FileConfiguration\n"
<< "\t\t\t\t\tName=\"" << *i << "|Win32\">\n"
<< "\t\t\t\t\tName=\"" << *i << "|" << this->PlatformName << "\">\n"
<< "\t\t\t\t\t<Tool\n"
<< "\t\t\t\t\tName=\"" << aCompilerTool << "\"\n";
if(compileFlags.size())
@ -1093,7 +1094,7 @@ WriteCustomRule(std::ostream& fout,
for(i = configs->begin(); i != configs->end(); ++i)
{
fout << "\t\t\t\t<FileConfiguration\n";
fout << "\t\t\t\t\tName=\"" << *i << "|Win32\">\n";
fout << "\t\t\t\t\tName=\"" << *i << "|" << this->PlatformName << "\">\n";
if(compileFlags)
{
fout << "\t\t\t\t\t<Tool\n"
@ -1270,7 +1271,7 @@ cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout,
<< "\tSccLocalPath=\"\"\n"
<< "\tKeyword=\"" << keyword << "\">\n"
<< "\t<Platforms>\n"
<< "\t\t<Platform\n\t\t\tName=\"Win32\"/>\n"
<< "\t\t<Platform\n\t\t\tName=\"" << this->PlatformName << "\"/>\n"
<< "\t</Platforms>\n";
}

View File

@ -62,6 +62,7 @@ public:
}
void SetVersion71() {this->Version = 71;}
void SetVersion8() {this->Version = 8;}
void SetPlatformName(const char* n) { this->PlatformName = n;}
virtual void ConfigureFinalPass();
private:
void FillFlagMapFromCommandFlags(std::map<cmStdString, cmStdString>& flagMap,
@ -119,6 +120,7 @@ private:
std::string ExecutableOutputPath;
std::string ModuleDefinitionFile;
int Version;
std::string PlatformName; // Win32 or x64
};
#endif

View File

@ -38,8 +38,8 @@ cmXMLParser::~cmXMLParser()
//----------------------------------------------------------------------------
int cmXMLParser::Parse(const char* string)
{
return this->InitializeParser() &&
this->ParseChunk(string, strlen(string)) &&
return (int)this->InitializeParser() &&
this->ParseChunk(string, (unsigned int)strlen(string)) &&
this->CleanupParser();
}

View File

@ -49,6 +49,7 @@
# include "cmGlobalVisualStudio7Generator.h"
# include "cmGlobalVisualStudio71Generator.h"
# include "cmGlobalVisualStudio8Generator.h"
# include "cmGlobalVisualStudio8Win64Generator.h"
# include "cmGlobalBorlandMakefileGenerator.h"
# include "cmGlobalNMakeMakefileGenerator.h"
# include "cmGlobalWatcomWMakeGenerator.h"
@ -1675,6 +1676,8 @@ void cmake::AddDefaultGenerators()
&cmGlobalVisualStudio71Generator::New;
this->Generators[cmGlobalVisualStudio8Generator::GetActualName()] =
&cmGlobalVisualStudio8Generator::New;
this->Generators[cmGlobalVisualStudio8Win64Generator::GetActualName()] =
&cmGlobalVisualStudio8Win64Generator::New;
this->Generators[cmGlobalBorlandMakefileGenerator::GetActualName()] =
&cmGlobalBorlandMakefileGenerator::New;
this->Generators[cmGlobalNMakeMakefileGenerator::GetActualName()] =

View File

@ -513,7 +513,7 @@ const char* CommandLineArguments::GetArgv0()
//----------------------------------------------------------------------------
unsigned int CommandLineArguments::GetLastArgument()
{
return this->Internals->LastArgument + 1;
return (unsigned int)this->Internals->LastArgument + 1;
}
//----------------------------------------------------------------------------
@ -620,7 +620,7 @@ void CommandLineArguments::GenerateHelp()
str << buffer;
}
const char* ptr = this->Internals->Callbacks[mpit->first].Help;
int len = strlen(ptr);
size_t len = strlen(ptr);
int cnt = 0;
while ( len > 0)
{

View File

@ -338,7 +338,7 @@ bool Glob::FindFiles(const kwsys_stl::string& inexpr)
{
if ( cc > 0 && expr[cc] == '/' && expr[cc-1] != '\\' )
{
last_slash = cc;
last_slash = (int)cc;
}
if ( cc > 0 &&
(expr[cc] == '[' || expr[cc] == '?' || expr[cc] == '*') &&
@ -371,7 +371,7 @@ bool Glob::FindFiles(const kwsys_stl::string& inexpr)
}
}
}
skip = cc + 1;
skip = int(cc + 1);
}
else
#endif

View File

@ -2141,7 +2141,7 @@ void kwsysProcessCleanup(kwsysProcess* cp, int error)
void kwsysProcessCleanErrorMessage(kwsysProcess* cp)
{
/* Remove trailing period and newline, if any. */
int length = strlen(cp->ErrorMessage);
size_t length = strlen(cp->ErrorMessage);
if(cp->ErrorMessage[length-1] == '\n')
{
cp->ErrorMessage[length-1] = 0;

View File

@ -705,7 +705,7 @@ void RegistryHelper::SetSubKey(const char* sk)
char *RegistryHelper::Strip(char *str)
{
int cc;
int len;
size_t len;
char *nstr;
if ( !str )
{
@ -713,7 +713,7 @@ char *RegistryHelper::Strip(char *str)
}
len = strlen(str);
nstr = str;
for( cc=0; cc<len; cc++ )
for( cc=0; cc<(int)len; cc++ )
{
if ( !isspace( *nstr ) )
{
@ -721,7 +721,7 @@ char *RegistryHelper::Strip(char *str)
}
nstr ++;
}
for( cc=(strlen(nstr)-1); cc>=0; cc-- )
for( cc=int(strlen(nstr)-1); cc>=0; cc-- )
{
if ( !isspace( nstr[cc] ) )
{

View File

@ -1166,7 +1166,7 @@ int SystemTools::EstimateFormatLength(const char *format, va_list ap)
// Start with the length of the format string itself.
int length = strlen(format);
size_t length = strlen(format);
// Increase the length for every argument in the format.
@ -1219,7 +1219,7 @@ int SystemTools::EstimateFormatLength(const char *format, va_list ap)
}
}
return length;
return (int)length;
}
kwsys_stl::string SystemTools::EscapeChars(
@ -2581,7 +2581,7 @@ int OldWindowsGetLongPath(kwsys_stl::string const& shortPath,
{
longPath = shortPath;
}
return longPath.size();
return (int)longPath.size();
}

View File

@ -392,7 +392,7 @@ static const unsigned long _stl_prime_list[_stl_num_primes] =
1610612741ul, 3221225473ul, 4294967291ul
};
inline unsigned long _stl_next_prime(unsigned long __n)
inline size_t _stl_next_prime(size_t __n)
{
const unsigned long* __first = _stl_prime_list;
const unsigned long* __last = _stl_prime_list + (int)_stl_num_primes;

View File

@ -86,6 +86,9 @@ int TestDynamicLoader(const char* libname, const char* symbol, int r1, int r2, i
int main(int argc, char *argv[])
{
#if defined(_WIN32)
SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);
#endif
int res;
if( argc == 3 )
{

View File

@ -255,10 +255,18 @@ CHECK_INCLUDE_FILE_CONCAT("sys/utsname.h" HAVE_SYS_UTSNAME_H)
CHECK_TYPE_SIZE(size_t SIZEOF_SIZE_T)
CHECK_TYPE_SIZE(ssize_t SIZEOF_SSIZE_T)
CHECK_TYPE_SIZE("long long" SIZEOF_LONG_LONG)
CHECK_TYPE_SIZE("long" SIZEOF_LONG)
CHECK_TYPE_SIZE("__int64" SIZEOF___INT64)
CHECK_TYPE_SIZE("long double" SIZEOF_LONG_DOUBLE)
IF(NOT HAVE_SIZEOF_SSIZE_T)
SET(ssize_t int)
IF(SIZEOF_LONG EQUAL SIZEOF_SIZE_T)
SET(ssize_t long)
ENDIF(SIZEOF_LONG EQUAL SIZEOF_SIZE_T)
IF(NOT ssize_t AND SIZEOF___INT64 EQUAL SIZEOF_SIZE_T)
SET(ssize_t __int64)
ENDIF(NOT ssize_t AND SIZEOF___INT64 EQUAL SIZEOF_SIZE_T)
ENDIF(NOT HAVE_SIZEOF_SSIZE_T)
IF(HAVE_SIZEOF_LONG_LONG)
SET(HAVE_LONGLONG 1)
ENDIF(HAVE_SIZEOF_LONG_LONG)

View File

@ -1105,7 +1105,7 @@ int yynerrs;
if (yyss + yystacksize - 1 <= yyssp)
{
/* Get the current used size of the three stacks, in elements. */
YYSIZE_T yysize = yyssp - yyss + 1;
YYSIZE_T yysize = (YYSIZE_T)(yyssp - yyss + 1);
#ifdef yyoverflow
{
@ -1281,7 +1281,7 @@ yyreduce:
break;
case 5:
#line 251 "getdate.y"
//#line 251 "getdate.y"
{
context->yyHaveZone++;
}

View File

@ -113,11 +113,11 @@ inet_pton4(const char *src, unsigned char *dst)
const char *pch;
if ((pch = strchr(digits, ch)) != NULL) {
u_int new = *tp * 10 + (pch - digits);
size_t new = *tp * 10 + (pch - digits);
if (new > 255)
return (0);
*tp = new;
*tp = (unsigned char)new;
if (! saw_digit) {
if (++octets > 4)
return (0);

View File

@ -343,6 +343,6 @@ void Curl_md5it(unsigned char *outbuffer, /* 16 bytes */
{
MD5_CTX ctx;
MD5_Init(&ctx);
MD5_Update(&ctx, input, strlen((char *)input));
MD5_Update(&ctx, input, (unsigned int)strlen((char *)input));
MD5_Final(outbuffer, &ctx);
}

View File

@ -619,10 +619,10 @@ static int dprintf_formatf(
char alt;
/* Width of a field. */
long width;
ssize_t width;
/* Precision of a field. */
long prec;
ssize_t prec;
/* Decimal integer is negative. */
char is_neg;

View File

@ -169,7 +169,6 @@ ELSE(HAVE_SIZEOF_OFF_T)
SET (HAVE_OFF_T 0)
SET (off_t "long")
ENDIF(HAVE_SIZEOF_OFF_T)
CHECK_TYPE_SIZE("size_t" SIZEOF_SIZE_T)
IF(HAVE_SIZEOF_SIZE_T)
SET (HAVE_SIZE_T 1)
@ -183,7 +182,14 @@ IF(HAVE_SIZEOF_SSIZE_T)
SET (HAVE_SSIZE_T 1)
ELSE(HAVE_SIZEOF_SSIZE_T)
SET (HAVE_SSIZE_T 0)
SET (ssize_t "int")
CHECK_TYPE_SIZE("long" SIZEOF_LONG)
CHECK_TYPE_SIZE("__int64" SIZEOF___INT64)
IF(SIZEOF_LONG EQUAL SIZEOF_SIZE_T)
SET(ssize_t "long")
ENDIF(SIZEOF_LONG EQUAL SIZEOF_SIZE_T)
IF(NOT ssize_t AND SIZEOF___INT64 EQUAL SIZEOF_SIZE_T)
SET(ssize_t "__int64")
ENDIF(NOT ssize_t AND SIZEOF___INT64 EQUAL SIZEOF_SIZE_T)
ENDIF(HAVE_SIZEOF_SSIZE_T)
CHECK_TYPE_SIZE("uid_t" SIZEOF_UID_T)

View File

@ -217,7 +217,7 @@ tar_append_file(TAR *t, char *realname, char *savename)
int
tar_append_eof(TAR *t)
{
int i, j;
ssize_t i, j;
char block[T_BLOCKSIZE];
memset(&block, 0, T_BLOCKSIZE);
@ -242,7 +242,7 @@ tar_append_regfile(TAR *t, char *realname)
{
char block[T_BLOCKSIZE];
int filefd;
int i, j;
ssize_t i, j;
size_t size;
#if defined( _WIN32 ) || defined(__CYGWIN__)
@ -278,7 +278,7 @@ tar_append_regfile(TAR *t, char *realname)
if (i > 0)
{
j = read(filefd, &block, i);
j = (size_t)read(filefd, &block, (unsigned int)i);
if (j == -1)
return -1;
memset(&(block[i]), 0, T_BLOCKSIZE - i);

View File

@ -27,7 +27,7 @@
int
th_read_internal(TAR *t)
{
int i;
ssize_t i;
int num_zero_blocks = 0;
#ifdef DEBUG
@ -82,7 +82,7 @@ th_read_internal(TAR *t)
#ifdef DEBUG
printf("<== th_read_internal(): returning %d\n", i);
#endif
return i;
return (int)i;
}
@ -90,7 +90,7 @@ th_read_internal(TAR *t)
int
th_read(TAR *t)
{
int i, j;
ssize_t i, j;
size_t sz;
char *ptr;
@ -247,7 +247,7 @@ th_read(TAR *t)
int
th_write(TAR *t)
{
int i, j;
ssize_t i, j;
char type2;
size_t sz, sz2;
char *ptr;

View File

@ -316,7 +316,7 @@ static void dopr (char *buffer, size_t maxlen, const char *format, va_list args)
case 's':
strvalue = va_arg (args, char *);
if (max < 0)
max = maxlen; /* ie, no max */
max = (int)maxlen; /* ie, no max */
fmtstr (buffer, &currlen, maxlen, strvalue, flags, min, max);
break;
case 'p':
@ -328,19 +328,19 @@ static void dopr (char *buffer, size_t maxlen, const char *format, va_list args)
{
short int *num;
num = va_arg (args, short int *);
*num = currlen;
*num = (int)currlen;
}
else if (cflags == DP_C_LONG)
{
long int *num;
num = va_arg (args, long int *);
*num = currlen;
*num = (int)currlen;
}
else
{
int *num;
num = va_arg (args, int *);
*num = currlen;
*num = (int)currlen;
}
break;
case '%':
@ -713,7 +713,7 @@ int mutt_snprintf (va_alist) va_dcl
(void) mutt_vsnprintf(str, count, fmt, ap);
#endif
VA_END;
return(strlen(str));
return((int)strlen(str));
}
#ifdef TEST_SNPRINTF

View File

@ -224,7 +224,7 @@ tar_extract_regfile(TAR *t, char *realname)
uid_t uid;
gid_t gid;
int fdout;
int i, k;
ssize_t i, k;
char buf[T_BLOCKSIZE];
char *filename;
char *pathname = 0;
@ -334,7 +334,7 @@ tar_extract_regfile(TAR *t, char *realname)
/* write block to output file */
if (write(fdout, buf,
((i > T_BLOCKSIZE) ? T_BLOCKSIZE : i)) == -1)
((i > T_BLOCKSIZE) ? T_BLOCKSIZE : (unsigned int)i)) == -1)
{
if (pathname)
{
@ -375,7 +375,7 @@ tar_extract_regfile(TAR *t, char *realname)
int
tar_skip_regfile(TAR *t)
{
int i, k;
ssize_t i, k;
size_t size;
char buf[T_BLOCKSIZE];

View File

@ -56,12 +56,12 @@ static int libtar_close(void* call_data)
static ssize_t libtar_read(void* call_data, void* buf, size_t count)
{
struct libtar_fd_file* lf = (struct libtar_fd_file*)call_data;
return read(lf->fd, buf, count);
return (ssize_t)read(lf->fd, buf, (unsigned int)count);
}
static ssize_t libtar_write(void* call_data, const void* buf, size_t count)
{
struct libtar_fd_file* lf = (struct libtar_fd_file*)call_data;
return write(lf->fd, buf, count);
return (ssize_t) write(lf->fd, buf, (unsigned int)count);
}
static tartype_t default_type = { libtar_open, libtar_close, libtar_read, libtar_write, &libtar_fd_file_pointer };

View File

@ -118,7 +118,7 @@ th_print_long_ls(TAR *t)
mtime = th_get_mtime(t);
mtm = localtime(&mtime);
#ifdef HAVE_STRFTIME
strftime(timebuf, sizeof(timebuf), "%h %e %H:%M %Y", mtm);
strftime(timebuf, sizeof(timebuf), "%b %d %H:%M %Y", mtm);
printf("%s", timebuf);
#else
printf("%.3s %2d %2d:%02d %4d",

View File

@ -22,7 +22,7 @@ xmlrpc_abort_if_array_bad(xmlrpc_value * const arrayP) {
else if (arrayP->_type != XMLRPC_TYPE_ARRAY)
abort();
else {
unsigned int const arraySize =
size_t const arraySize =
XMLRPC_MEMBLOCK_SIZE(xmlrpc_value*, &arrayP->_block);
xmlrpc_value ** const contents =
XMLRPC_MEMBLOCK_CONTENTS(xmlrpc_value*, &arrayP->_block);
@ -51,7 +51,7 @@ xmlrpc_destroyArrayContents(xmlrpc_value * const arrayP) {
Dispose of the contents of an array (but not the array value itself).
The value is not valid after this.
-----------------------------------------------------------------------------*/
unsigned int const arraySize =
size_t const arraySize =
XMLRPC_MEMBLOCK_SIZE(xmlrpc_value*, &arrayP->_block);
xmlrpc_value ** const contents =
XMLRPC_MEMBLOCK_CONTENTS(xmlrpc_value*, &arrayP->_block);
@ -83,7 +83,7 @@ xmlrpc_array_size(xmlrpc_env * const env,
XMLRPC_ASSERT_VALUE_OK(array);
XMLRPC_TYPE_CHECK(env, array, XMLRPC_TYPE_ARRAY);
retval = XMLRPC_TYPED_MEM_BLOCK_SIZE(xmlrpc_value*, &array->_block);
retval = (int)XMLRPC_TYPED_MEM_BLOCK_SIZE(xmlrpc_value*, &array->_block);
cleanup:
if (env->fault_occurred)

View File

@ -269,7 +269,7 @@ call_info_new(xmlrpc_env * const envP,
if (!envP->fault_occurred) {
xmlrpc_traceXml("XML-RPC CALL",
XMLRPC_MEMBLOCK_CONTENTS(char, callXmlP),
XMLRPC_MEMBLOCK_SIZE(char, callXmlP));
(unsigned int)XMLRPC_MEMBLOCK_SIZE(char, callXmlP));
callInfoP->serialized_xml = callXmlP;
@ -312,7 +312,7 @@ clientCallServerParams(xmlrpc_env * const envP,
if (!envP->fault_occurred) {
xmlrpc_traceXml("XML-RPC RESPONSE",
XMLRPC_MEMBLOCK_CONTENTS(char, respXmlP),
XMLRPC_MEMBLOCK_SIZE(char, respXmlP));
(unsigned int)XMLRPC_MEMBLOCK_SIZE(char, respXmlP));
*resultPP = xmlrpc_parse_response(
envP,

View File

@ -254,12 +254,12 @@ xmlrpc_read_string(xmlrpc_env * const envP,
-----------------------------------------------------------------------------*/
validateType(envP, valueP, XMLRPC_TYPE_STRING);
if (!envP->fault_occurred) {
unsigned int const size =
size_t const size =
XMLRPC_MEMBLOCK_SIZE(char, &valueP->_block);
const char * const contents =
XMLRPC_MEMBLOCK_CONTENTS(char, &valueP->_block);
verifyNoNulls(envP, contents, size);
verifyNoNulls(envP, contents, (unsigned int)size);
if (!envP->fault_occurred) {
char * stringValue;
@ -289,7 +289,7 @@ xmlrpc_read_string_lp(xmlrpc_env * const envP,
validateType(envP, valueP, XMLRPC_TYPE_STRING);
if (!envP->fault_occurred) {
unsigned int const size =
size_t const size =
XMLRPC_MEMBLOCK_SIZE(char, &valueP->_block);
const char * const contents =
XMLRPC_MEMBLOCK_CONTENTS(char, &valueP->_block);
@ -304,7 +304,7 @@ xmlrpc_read_string_lp(xmlrpc_env * const envP,
else {
memcpy(stringValue, contents, size);
*stringValueP = stringValue;
*lengthP = size;
*lengthP = (unsigned int)size;
}
}
}
@ -449,7 +449,7 @@ getString(xmlrpc_env * const envP,
xmlrpc_value ** const valPP) {
const char * str;
unsigned int len;
size_t len;
str = (const char*) va_arg(*args, char*);
if (**formatP == '#') {
@ -458,7 +458,7 @@ getString(xmlrpc_env * const envP,
} else
len = strlen(str);
mkString(envP, str, len, valPP);
mkString(envP, str, (unsigned int)len, valPP);
}
@ -1143,7 +1143,7 @@ parsevalue(xmlrpc_env * const envP,
(*format)++;
*sizeptr = len;
} else
verifyNoNulls(envP, contents, len);
verifyNoNulls(envP, contents, (unsigned int)len);
*strptr = contents;
}
break;
@ -1173,7 +1173,7 @@ parsevalue(xmlrpc_env * const envP,
(*format)++;
*sizeptr = len;
} else
verifyNoNullsW(envP, wcontents, len);
verifyNoNullsW(envP, wcontents, (unsigned int)len);
*wcsptr = wcontents;
}
}

View File

@ -139,7 +139,7 @@ void xml_element_free (xml_element *elem)
/* Deallocate all of our children recursively. */
children = &elem->_children;
contents = XMLRPC_TYPED_MEM_BLOCK_CONTENTS(xml_element*, children);
size = XMLRPC_TYPED_MEM_BLOCK_SIZE(xml_element*, children);
size = (int)XMLRPC_TYPED_MEM_BLOCK_SIZE(xml_element*, children);
for (i = 0; i < size; i++)
xml_element_free(contents[i]);

View File

@ -248,7 +248,7 @@ static xmlrpc_value *
convert_value(xmlrpc_env *env, unsigned *depth, xml_element *elem)
{
xml_element *child;
int child_count;
size_t child_count;
char *cdata, *child_name;
size_t cdata_size, ascii_len;
xmlrpc_mem_block *decoded;
@ -356,7 +356,7 @@ convert_array(xmlrpc_env *env, unsigned *depth, xml_element *elem)
{
xml_element *data, **values, *value;
xmlrpc_value *array, *item;
int size, i;
size_t size, i;
XMLRPC_ASSERT_ENV_OK(env);
XMLRPC_ASSERT(elem != NULL);
@ -413,7 +413,7 @@ convert_struct(xmlrpc_env *env, unsigned *depth, xml_element *elem)
{
xmlrpc_value *strct, *key, *value;
xml_element **members, *member, *name_elem, *value_elem;
int size, i;
size_t size, i;
char *cdata;
size_t cdata_size;
@ -490,7 +490,7 @@ static xmlrpc_value *
convert_params(xmlrpc_env *env, unsigned *depth, xml_element *elem)
{
xmlrpc_value *array, *item;
int size, i;
size_t size, i;
xml_element **params, *param, *value;
XMLRPC_ASSERT_ENV_OK(env);
@ -546,7 +546,7 @@ parseCallXml(xmlrpc_env * const envP,
xmlrpc_env env;
xmlrpc_env_init(&env);
*callElemP = xml_parse(&env, xmlData, xmlLen);
*callElemP = xml_parse(&env, xmlData, (int)xmlLen);
if (env.fault_occurred)
xmlrpc_env_set_fault_formatted(
envP, env.fault_code, "Call is not valid XML. %s",
@ -697,7 +697,7 @@ xmlrpc_parse_response(xmlrpc_env *env,
depth = 0;
/* Parse our XML data. */
response = xml_parse(env, xml_data, xml_len);
response = xml_parse(env, xml_data, (int)xml_len);
XMLRPC_FAIL_IF_FAULT(env);
/* Pick apart and verify our structure. */

View File

@ -367,7 +367,7 @@ xmlrpc_registry_process_call(xmlrpc_env * const envP,
XMLRPC_ASSERT_ENV_OK(envP);
XMLRPC_ASSERT_PTR_OK(xml_data);
xmlrpc_traceXml("XML-RPC CALL", xml_data, xml_len);
xmlrpc_traceXml("XML-RPC CALL", xml_data, (unsigned int)xml_len);
/* Allocate our output buffer.
** If this fails, we need to die in a special fashion. */
@ -412,7 +412,7 @@ xmlrpc_registry_process_call(xmlrpc_env * const envP,
else
xmlrpc_traceXml("XML-RPC RESPONSE",
XMLRPC_MEMBLOCK_CONTENTS(char, output),
XMLRPC_MEMBLOCK_SIZE(char, output));
(unsigned int)XMLRPC_MEMBLOCK_SIZE(char, output));
}
return output;
}
@ -507,7 +507,7 @@ system_multicall(xmlrpc_env *env,
size = xmlrpc_array_size(env, methlist);
XMLRPC_ASSERT_ENV_OK(env);
for (i = 0; i < size; i++) {
methinfo = xmlrpc_array_get_item(env, methlist, i);
methinfo = xmlrpc_array_get_item(env, methlist, (int)i);
XMLRPC_ASSERT_ENV_OK(env);
/* Call our method. */
@ -588,7 +588,7 @@ system_listMethods(xmlrpc_env *env,
size = xmlrpc_struct_size(env, registry->_methods);
XMLRPC_FAIL_IF_FAULT(env);
for (i = 0; i < size; i++) {
xmlrpc_struct_get_key_and_value(env, registry->_methods, i,
xmlrpc_struct_get_key_and_value(env, registry->_methods, (int)i,
&method_name, &method_info);
XMLRPC_FAIL_IF_FAULT(env);
xmlrpc_array_append_item(env, method_names, method_name);

View File

@ -295,7 +295,7 @@ xmlrpc_serialize_struct(xmlrpc_env *env,
size = xmlrpc_struct_size(env, strct);
XMLRPC_FAIL_IF_FAULT(env);
for (i = 0; i < size; i++) {
xmlrpc_struct_get_key_and_value(env, strct, i, &key, &value);
xmlrpc_struct_get_key_and_value(env, strct, (int)i, &key, &value);
XMLRPC_FAIL_IF_FAULT(env);
format_out(env, output, "<member><name>");
XMLRPC_FAIL_IF_FAULT(env);
@ -379,7 +379,7 @@ xmlrpc_serialize_value(xmlrpc_env *env,
size = xmlrpc_array_size(env, value);
XMLRPC_FAIL_IF_FAULT(env);
for (i = 0; i < size; i++) {
item = xmlrpc_array_get_item(env, value, i);
item = xmlrpc_array_get_item(env, value, (int)i);
XMLRPC_FAIL_IF_FAULT(env);
xmlrpc_serialize_value(env, output, item);
XMLRPC_FAIL_IF_FAULT(env);
@ -469,7 +469,7 @@ xmlrpc_serialize_params(xmlrpc_env *env,
for (i = 0; i < size; i++) {
format_out(env, output, "<param>");
XMLRPC_FAIL_IF_FAULT(env);
item = xmlrpc_array_get_item(env, param_array, i);
item = xmlrpc_array_get_item(env, param_array, (int)i);
XMLRPC_FAIL_IF_FAULT(env);
xmlrpc_serialize_value(env, output, item);
XMLRPC_FAIL_IF_FAULT(env);

View File

@ -120,7 +120,7 @@ xmlrpc_struct_size(xmlrpc_env* env, xmlrpc_value* strct)
XMLRPC_ASSERT_VALUE_OK(strct);
XMLRPC_TYPE_CHECK(env, strct, XMLRPC_TYPE_STRUCT);
retval = XMLRPC_MEMBLOCK_SIZE(_struct_member, &strct->_block);
retval = (int)XMLRPC_MEMBLOCK_SIZE(_struct_member, &strct->_block);
cleanup:
if (env->fault_occurred)
@ -186,7 +186,7 @@ find_member(xmlrpc_value * const strctP,
keystr = XMLRPC_MEMBLOCK_CONTENTS(char, &keyval->_block);
keystr_size = XMLRPC_MEMBLOCK_SIZE(char, &keyval->_block)-1;
if (key_len == keystr_size && memcmp(key, keystr, key_len) == 0)
return i;
return (int)i;
}
}
return -1;

View File

@ -19,7 +19,7 @@ xmlrpc_makePrintable(const char * const input) {
get the storage.
-----------------------------------------------------------------------------*/
char * output;
const unsigned int inputLength = strlen(input);
const size_t inputLength = strlen(input);
output = malloc(inputLength*4+1);

View File

@ -326,7 +326,7 @@ xmlrpc_mem_block_append(xmlrpc_env * const env,
void * const data,
size_t const len)
{
int size;
size_t size;
XMLRPC_ASSERT_ENV_OK(env);
XMLRPC_ASSERT(block != NULL);