From 18015486179f7f716fc2182f45e7c6fc5ba34950 Mon Sep 17 00:00:00 2001 From: Andy Cedilnik <andy.cedilnik@kitware.com> Date: Wed, 12 Jul 2006 09:20:44 -0400 Subject: [PATCH] COMP: Remove warnings --- CommandLineArguments.cxx | 2 +- Glob.cxx | 2 +- Registry.cxx | 6 +++--- SystemTools.cxx | 13 +++++++------ 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/CommandLineArguments.cxx b/CommandLineArguments.cxx index 153a6ec..0ef0330 100644 --- a/CommandLineArguments.cxx +++ b/CommandLineArguments.cxx @@ -513,7 +513,7 @@ const char* CommandLineArguments::GetArgv0() //---------------------------------------------------------------------------- unsigned int CommandLineArguments::GetLastArgument() { - return (unsigned int)this->Internals->LastArgument + 1; + return static_cast<unsigned int>(this->Internals->LastArgument + 1); } //---------------------------------------------------------------------------- diff --git a/Glob.cxx b/Glob.cxx index 17739a0..afd93c0 100644 --- a/Glob.cxx +++ b/Glob.cxx @@ -338,7 +338,7 @@ bool Glob::FindFiles(const kwsys_stl::string& inexpr) { if ( cc > 0 && expr[cc] == '/' && expr[cc-1] != '\\' ) { - last_slash = (int)cc; + last_slash = static_cast<int>(cc); } if ( cc > 0 && (expr[cc] == '[' || expr[cc] == '?' || expr[cc] == '*') && diff --git a/Registry.cxx b/Registry.cxx index 0773065..e9748dd 100644 --- a/Registry.cxx +++ b/Registry.cxx @@ -704,7 +704,7 @@ void RegistryHelper::SetSubKey(const char* sk) //---------------------------------------------------------------------------- char *RegistryHelper::Strip(char *str) { - int cc; + size_t cc; 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<(int)len; cc++ ) + for( cc=0; cc < len; cc++ ) { if ( !isspace( *nstr ) ) { @@ -721,7 +721,7 @@ char *RegistryHelper::Strip(char *str) } nstr ++; } - for( cc=int(strlen(nstr)-1); cc>=0; cc-- ) + for( cc= strlen(nstr)-1; cc>=0; cc-- ) { if ( !isspace( nstr[cc] ) ) { diff --git a/SystemTools.cxx b/SystemTools.cxx index 2813864..6b67f84 100644 --- a/SystemTools.cxx +++ b/SystemTools.cxx @@ -237,10 +237,10 @@ SystemTools::GetTime(void) struct timeval t; #ifdef GETTIMEOFDAY_NO_TZ if (gettimeofday(&t) == 0) - return (double)t.tv_sec + t.tv_usec*0.000001; + return static_cast<double>(t.tv_sec) + t.tv_usec*0.000001; #else /* !GETTIMEOFDAY_NO_TZ */ - if (gettimeofday(&t, (struct timezone *)NULL) == 0) - return (double)t.tv_sec + t.tv_usec*0.000001; + if (gettimeofday(&t, static_cast<struct timezone *>(NULL)) == 0) + return static_cast<double>(t.tv_sec) + t.tv_usec*0.000001; #endif /* !GETTIMEOFDAY_NO_TZ */ } #endif /* !HAVE_GETTIMEOFDAY */ @@ -248,11 +248,12 @@ SystemTools::GetTime(void) #if defined(HAVE_FTIME) struct TIMEB t; ::FTIME(&t); - return (double)t.time + (double)t.millitm * (double)0.001; + return static_cast<double>(t.time) + + static_cast<double>(t.millitm) * static_cast<double>(0.001); #else /* !HAVE_FTIME */ time_t secs; time(&secs); - return (double)secs; + return static_cast<double>(secs); #endif /* !HAVE_FTIME */ } } @@ -1246,7 +1247,7 @@ int SystemTools::EstimateFormatLength(const char *format, va_list ap) } } - return (int)length; + return static_cast<int>(length); } kwsys_stl::string SystemTools::EscapeChars( -- GitLab