diff options
author | Daniel Pfeifer <daniel@pfeifer-mail.de> | 2017-08-30 10:37:36 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2017-08-30 10:38:00 (GMT) |
commit | 7ddd43183dadba9c42094540f3371dd38054bc12 (patch) | |
tree | 7f048ea2e1a75569eb5472c238389acfc768995e /Source/CTest | |
parent | 5cac887297e58efe9553d7aa2bca9139f84bf094 (diff) | |
parent | 190e3825d44d4f846d37e1ec7372f5829a5b6b3e (diff) | |
download | CMake-7ddd43183dadba9c42094540f3371dd38054bc12.zip CMake-7ddd43183dadba9c42094540f3371dd38054bc12.tar.gz CMake-7ddd43183dadba9c42094540f3371dd38054bc12.tar.bz2 |
Merge topic 'cstyle-casts'
190e3825 Replace C-style casts
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1176
Diffstat (limited to 'Source/CTest')
-rw-r--r-- | Source/CTest/cmCTestBuildAndTestHandler.cxx | 6 | ||||
-rw-r--r-- | Source/CTest/cmCTestBuildCommand.cxx | 2 | ||||
-rw-r--r-- | Source/CTest/cmCTestCurl.cxx | 10 | ||||
-rw-r--r-- | Source/CTest/cmCTestGIT.cxx | 4 | ||||
-rw-r--r-- | Source/CTest/cmCTestMemCheckHandler.cxx | 4 | ||||
-rw-r--r-- | Source/CTest/cmCTestSubmitHandler.cxx | 27 | ||||
-rw-r--r-- | Source/CTest/cmCTestTestHandler.cxx | 6 |
7 files changed, 30 insertions, 29 deletions
diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx index 466fc78..b6c25b8 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.cxx +++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx @@ -115,21 +115,21 @@ int cmCTestBuildAndTestHandler::RunCMake(std::string* outstring, void CMakeMessageCallback(const char* m, const char* /*unused*/, bool& /*unused*/, void* s) { - std::string* out = (std::string*)s; + std::string* out = reinterpret_cast<std::string*>(s); *out += m; *out += "\n"; } void CMakeProgressCallback(const char* msg, float /*unused*/, void* s) { - std::string* out = (std::string*)s; + std::string* out = reinterpret_cast<std::string*>(s); *out += msg; *out += "\n"; } void CMakeOutputCallback(const char* m, size_t len, void* s) { - std::string* out = (std::string*)s; + std::string* out = reinterpret_cast<std::string*>(s); out->append(m, len); } diff --git a/Source/CTest/cmCTestBuildCommand.cxx b/Source/CTest/cmCTestBuildCommand.cxx index 074f085..ce27da1 100644 --- a/Source/CTest/cmCTestBuildCommand.cxx +++ b/Source/CTest/cmCTestBuildCommand.cxx @@ -43,7 +43,7 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler() this->SetError("internal CTest error. Cannot instantiate build handler"); return nullptr; } - this->Handler = (cmCTestBuildHandler*)handler; + this->Handler = static_cast<cmCTestBuildHandler*>(handler); const char* ctestBuildCommand = this->Makefile->GetDefinition("CTEST_BUILD_COMMAND"); diff --git a/Source/CTest/cmCTestCurl.cxx b/Source/CTest/cmCTestCurl.cxx index 492232b..b175d44 100644 --- a/Source/CTest/cmCTestCurl.cxx +++ b/Source/CTest/cmCTestCurl.cxx @@ -41,7 +41,7 @@ namespace { size_t curlWriteMemoryCallback(void* ptr, size_t size, size_t nmemb, void* data) { - int realsize = (int)(size * nmemb); + int realsize = static_cast<int>(size * nmemb); std::vector<char>* vec = static_cast<std::vector<char>*>(data); const char* chPtr = static_cast<char*>(ptr); @@ -156,8 +156,8 @@ bool cmCTestCurl::UploadFile(std::string const& local_file, ::curl_easy_setopt(this->Curl, CURLOPT_HTTPHEADER, headers); std::vector<char> responseData; std::vector<char> debugData; - ::curl_easy_setopt(this->Curl, CURLOPT_FILE, (void*)&responseData); - ::curl_easy_setopt(this->Curl, CURLOPT_DEBUGDATA, (void*)&debugData); + ::curl_easy_setopt(this->Curl, CURLOPT_FILE, &responseData); + ::curl_easy_setopt(this->Curl, CURLOPT_DEBUGDATA, &debugData); ::curl_easy_setopt(this->Curl, CURLOPT_FAILONERROR, 1); // Now run off and do what you've been told! ::curl_easy_perform(this->Curl); @@ -206,8 +206,8 @@ bool cmCTestCurl::HttpRequest(std::string const& url, ::curl_easy_setopt(this->Curl, CURLOPT_DEBUGFUNCTION, curlDebugCallback); std::vector<char> responseData; std::vector<char> debugData; - ::curl_easy_setopt(this->Curl, CURLOPT_FILE, (void*)&responseData); - ::curl_easy_setopt(this->Curl, CURLOPT_DEBUGDATA, (void*)&debugData); + ::curl_easy_setopt(this->Curl, CURLOPT_FILE, &responseData); + ::curl_easy_setopt(this->Curl, CURLOPT_DEBUGDATA, &debugData); ::curl_easy_setopt(this->Curl, CURLOPT_FAILONERROR, 1); // Add headers if any were specified. diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx index 8c27045..ed8d932 100644 --- a/Source/CTest/cmCTestGIT.cxx +++ b/Source/CTest/cmCTestGIT.cxx @@ -510,8 +510,8 @@ private: const char* email_last = *c ? c++ : c; person.EMail.assign(email_first, email_last - email_first); - person.Time = strtoul(c, (char**)&c, 10); - person.TimeZone = strtol(c, (char**)&c, 10); + person.Time = strtoul(c, const_cast<char**>(&c), 10); + person.TimeZone = strtol(c, const_cast<char**>(&c), 10); } bool ProcessLine() CM_OVERRIDE diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index 848e505..7d11550 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -33,7 +33,7 @@ static CatToErrorType cmCTestMemCheckBoundsChecker[] = { static void xmlReportError(int line, const char* msg, void* data) { - cmCTest* ctest = (cmCTest*)data; + cmCTest* ctest = reinterpret_cast<cmCTest*>(data); cmCTestLog(ctest, ERROR_MESSAGE, "Error parsing XML in stream at line " << line << ": " << msg << std::endl); } @@ -45,7 +45,7 @@ public: cmBoundsCheckerParser(cmCTest* c) { this->CTest = c; - this->SetErrorCallback(xmlReportError, (void*)c); + this->SetErrorCallback(xmlReportError, c); } void StartElement(const std::string& name, const char** atts) CM_OVERRIDE { diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index 5c67816..b7d0d1f 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -100,7 +100,7 @@ private: static size_t cmCTestSubmitHandlerWriteMemoryCallback(void* ptr, size_t size, size_t nmemb, void* data) { - int realsize = (int)(size * nmemb); + int realsize = static_cast<int>(size * nmemb); cmCTestSubmitHandlerVectorOfChar* vec = static_cast<cmCTestSubmitHandlerVectorOfChar*>(data); @@ -239,8 +239,8 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const std::string& localprefix, /* we pass our 'chunk' struct to the callback function */ cmCTestSubmitHandlerVectorOfChar chunk; cmCTestSubmitHandlerVectorOfChar chunkDebug; - ::curl_easy_setopt(curl, CURLOPT_FILE, (void*)&chunk); - ::curl_easy_setopt(curl, CURLOPT_DEBUGDATA, (void*)&chunkDebug); + ::curl_easy_setopt(curl, CURLOPT_FILE, &chunk); + ::curl_easy_setopt(curl, CURLOPT_DEBUGDATA, &chunkDebug); // Now run off and do what you've been told! res = ::curl_easy_perform(curl); @@ -413,7 +413,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, case ' ': case '=': case '%': - sprintf(hexCh, "%%%02X", (int)c); + sprintf(hexCh, "%%%02X", static_cast<int>(c)); ofile.append(hexCh); break; default: @@ -471,8 +471,8 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, /* we pass our 'chunk' struct to the callback function */ cmCTestSubmitHandlerVectorOfChar chunk; cmCTestSubmitHandlerVectorOfChar chunkDebug; - ::curl_easy_setopt(curl, CURLOPT_FILE, (void*)&chunk); - ::curl_easy_setopt(curl, CURLOPT_DEBUGDATA, (void*)&chunkDebug); + ::curl_easy_setopt(curl, CURLOPT_FILE, &chunk); + ::curl_easy_setopt(curl, CURLOPT_DEBUGDATA, &chunkDebug); // Now run off and do what you've been told! res = ::curl_easy_perform(curl); @@ -667,8 +667,8 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP(const std::set<std::string>& files, /* we pass our 'chunk' struct to the callback function */ cmCTestSubmitHandlerVectorOfChar chunk; cmCTestSubmitHandlerVectorOfChar chunkDebug; - ::curl_easy_setopt(curl, CURLOPT_FILE, (void*)&chunk); - ::curl_easy_setopt(curl, CURLOPT_DEBUGDATA, (void*)&chunkDebug); + ::curl_easy_setopt(curl, CURLOPT_FILE, &chunk); + ::curl_easy_setopt(curl, CURLOPT_DEBUGDATA, &chunkDebug); std::string rfile = remoteprefix + cmSystemTools::GetFilenameName(*file); std::string ofile; @@ -686,7 +686,7 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP(const std::set<std::string>& files, case ' ': case '=': case '%': - sprintf(hexCh, "%%%02X", (int)c); + sprintf(hexCh, "%%%02X", static_cast<int>(c)); ofile.append(hexCh); break; default: @@ -948,8 +948,9 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC( char remoteCommand[] = "Submit.put"; char* pRealURL = const_cast<char*>(realURL.c_str()); - result = xmlrpc_client_call(&env, pRealURL, remoteCommand, "(6)", - fileBuffer, (xmlrpc_int32)fileSize); + result = + xmlrpc_client_call(&env, pRealURL, remoteCommand, "(6)", fileBuffer, + static_cast<xmlrpc_int32>(fileSize)); delete[] fileBuffer; @@ -1082,8 +1083,8 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file, << "site=" << curl.Escape(this->CTest->GetCTestConfiguration("Site")) << "&" << "track=" << curl.Escape(this->CTest->GetTestModelString()) << "&" - << "starttime=" << (int)cmSystemTools::GetTime() << "&" - << "endtime=" << (int)cmSystemTools::GetTime() << "&" + << "starttime=" << static_cast<int>(cmSystemTools::GetTime()) << "&" + << "endtime=" << static_cast<int>(cmSystemTools::GetTime()) << "&" << "datafilesmd5[0]=" << md5sum << "&" << "type=" << curl.Escape(typeString); std::string fields = str.str(); diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 91c2fdc..57075c7 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -544,7 +544,7 @@ int cmCTestTestHandler::ProcessHandler() } char realBuf[1024]; - sprintf(realBuf, "%6.2f sec", (double)(clock_finish - clock_start)); + sprintf(realBuf, "%6.2f sec", clock_finish - clock_start); cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "\nTotal Test time (real) = " << realBuf << "\n", this->Quiet); @@ -851,7 +851,7 @@ void cmCTestTestHandler::ComputeTestList() } // expand the test list based on the union flag if (this->UseUnion) { - this->ExpandTestsToRunInformation((int)tmsize); + this->ExpandTestsToRunInformation(static_cast<int>(tmsize)); } else { this->ExpandTestsToRunInformation(inREcnt); } @@ -1327,7 +1327,7 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<std::string>& passed, bool randomSchedule = this->CTest->GetScheduleType() == "Random"; if (randomSchedule) { - srand((unsigned)time(nullptr)); + srand(static_cast<unsigned>(time(nullptr))); } for (ListOfTests::iterator it = this->TestList.begin(); |