mirror of
https://github.com/reactos/CMake.git
synced 2024-11-24 20:19:53 +00:00
Replace C-style casts
This commit is contained in:
parent
2ade9a0264
commit
190e3825d4
@ -1,5 +1,6 @@
|
||||
---
|
||||
Checks: "-*,\
|
||||
google-readability-casting,\
|
||||
misc-*,\
|
||||
-misc-incorrect-roundings,\
|
||||
-misc-macro-parentheses,\
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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");
|
||||
|
@ -42,7 +42,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);
|
||||
@ -157,8 +157,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);
|
||||
@ -207,8 +207,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.
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
|
@ -529,7 +529,7 @@ void cmCursesMainForm::UpdateProgress(const char* msg, float prog, void* vp)
|
||||
char tmp[1024];
|
||||
const char* cmsg = tmp;
|
||||
if (prog >= 0) {
|
||||
sprintf(tmp, "%s %i%%", msg, (int)(100 * prog));
|
||||
sprintf(tmp, "%s %i%%", msg, static_cast<int>(100 * prog));
|
||||
} else {
|
||||
cmsg = msg;
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ std::string cmCTest::GetCostDataFile()
|
||||
static size_t HTTPResponseCallback(void* ptr, size_t size, size_t nmemb,
|
||||
void* data)
|
||||
{
|
||||
int realsize = (int)(size * nmemb);
|
||||
int realsize = static_cast<int>(size * nmemb);
|
||||
|
||||
std::string* response = static_cast<std::string*>(data);
|
||||
const char* chPtr = static_cast<char*>(ptr);
|
||||
@ -206,7 +206,7 @@ int cmCTest::HTTPRequest(std::string url, HTTPMethod method,
|
||||
|
||||
// set response options
|
||||
::curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, HTTPResponseCallback);
|
||||
::curl_easy_setopt(curl, CURLOPT_FILE, (void*)&response);
|
||||
::curl_easy_setopt(curl, CURLOPT_FILE, &response);
|
||||
::curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1);
|
||||
|
||||
CURLcode res = ::curl_easy_perform(curl);
|
||||
@ -227,7 +227,7 @@ std::string cmCTest::MakeURLSafe(const std::string& str)
|
||||
if ((ch > 126 || ch < 32 || ch == '&' || ch == '%' || ch == '+' ||
|
||||
ch == '=' || ch == '@') &&
|
||||
ch != 9) {
|
||||
sprintf(buffer, "%02x;", (unsigned int)ch);
|
||||
sprintf(buffer, "%02x;", static_cast<unsigned int>(ch));
|
||||
ost << buffer;
|
||||
} else {
|
||||
ost << ch;
|
||||
@ -1767,7 +1767,7 @@ bool cmCTest::HandleCommandLineArguments(size_t& i,
|
||||
|
||||
if (this->CheckArgument(arg, "--timeout") && i < args.size() - 1) {
|
||||
i++;
|
||||
double timeout = (double)atof(args[i].c_str());
|
||||
double timeout = atof(args[i].c_str());
|
||||
this->GlobalTimeout = timeout;
|
||||
}
|
||||
|
||||
|
@ -175,7 +175,7 @@ public:
|
||||
void RemoveCacheEntryProperty(std::string const& key,
|
||||
std::string const& propName)
|
||||
{
|
||||
this->GetCacheIterator(key.c_str()).SetProperty(propName, (void*)nullptr);
|
||||
this->GetCacheIterator(key.c_str()).SetProperty(propName, nullptr);
|
||||
}
|
||||
|
||||
void AppendCacheEntryProperty(std::string const& key,
|
||||
|
@ -31,7 +31,7 @@ void cmEventBasedConnection::on_read(uv_stream_t* stream, ssize_t nread,
|
||||
if (nread >= 0) {
|
||||
conn->ReadData(std::string(buf->base, buf->base + nread));
|
||||
} else {
|
||||
conn->OnDisconnect((int)nread);
|
||||
conn->OnDisconnect(static_cast<int>(nread));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,7 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources,
|
||||
|
||||
if (!haveDeps) {
|
||||
// Walk the dependency graph starting with the source file.
|
||||
int srcFiles = (int)sources.size();
|
||||
int srcFiles = static_cast<int>(sources.size());
|
||||
this->Encountered.clear();
|
||||
|
||||
for (std::set<std::string>::const_iterator srcIt = sources.begin();
|
||||
|
@ -96,9 +96,9 @@ void cmDependsJavaParserHelper::SafePrintMissing(const char* str, int line,
|
||||
for (cc = 0; cc < strlen(str); cc++) {
|
||||
unsigned char ch = str[cc];
|
||||
if (ch >= 32 && ch <= 126) {
|
||||
std::cout << (char)ch;
|
||||
std::cout << static_cast<char>(ch);
|
||||
} else {
|
||||
std::cout << "<" << (int)ch << ">";
|
||||
std::cout << "<" << static_cast<int>(ch) << ">";
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -166,7 +166,7 @@ void cmDependsJavaParserHelper::AllocateParserType(
|
||||
{
|
||||
pt->str = nullptr;
|
||||
if (len == 0) {
|
||||
len = (int)strlen(str);
|
||||
len = static_cast<int>(strlen(str));
|
||||
}
|
||||
if (len == 0) {
|
||||
return;
|
||||
|
@ -16,7 +16,7 @@ class cmExecutionStatus;
|
||||
|
||||
static bool cmExecuteProcessCommandIsWhitespace(char c)
|
||||
{
|
||||
return (isspace((int)c) || c == '\n' || c == '\r');
|
||||
return (isspace(static_cast<int>(c)) || c == '\n' || c == '\r');
|
||||
}
|
||||
|
||||
void cmExecuteProcessCommandFixText(std::vector<char>& output,
|
||||
|
@ -233,7 +233,7 @@ void cmExportBuildFileGenerator::HandleMissingTarget(
|
||||
dependee->GetLocalGenerator()->GetGlobalGenerator();
|
||||
std::vector<std::string> namespaces = this->FindNamespaces(gg, name);
|
||||
|
||||
int targetOccurrences = (int)namespaces.size();
|
||||
int targetOccurrences = static_cast<int>(namespaces.size());
|
||||
if (targetOccurrences == 1) {
|
||||
std::string missingTarget = namespaces[0];
|
||||
|
||||
|
@ -445,7 +445,7 @@ void cmExportInstallFileGenerator::HandleMissingTarget(
|
||||
const std::string name = dependee->GetName();
|
||||
cmGlobalGenerator* gg = dependee->GetLocalGenerator()->GetGlobalGenerator();
|
||||
std::vector<std::string> namespaces = this->FindNamespaces(gg, name);
|
||||
int targetOccurrences = (int)namespaces.size();
|
||||
int targetOccurrences = static_cast<int>(namespaces.size());
|
||||
if (targetOccurrences == 1) {
|
||||
std::string missingTarget = namespaces[0];
|
||||
|
||||
|
@ -2454,7 +2454,7 @@ namespace {
|
||||
|
||||
size_t cmWriteToFileCallback(void* ptr, size_t size, size_t nmemb, void* data)
|
||||
{
|
||||
int realsize = (int)(size * nmemb);
|
||||
int realsize = static_cast<int>(size * nmemb);
|
||||
cmsys::ofstream* fout = static_cast<cmsys::ofstream*>(data);
|
||||
const char* chPtr = static_cast<char*>(ptr);
|
||||
fout->write(chPtr, realsize);
|
||||
@ -2464,7 +2464,7 @@ size_t cmWriteToFileCallback(void* ptr, size_t size, size_t nmemb, void* data)
|
||||
size_t cmWriteToMemoryCallback(void* ptr, size_t size, size_t nmemb,
|
||||
void* data)
|
||||
{
|
||||
int realsize = (int)(size * nmemb);
|
||||
int realsize = static_cast<int>(size * nmemb);
|
||||
cmFileCommandVectorOfChar* vec =
|
||||
static_cast<cmFileCommandVectorOfChar*>(data);
|
||||
const char* chPtr = static_cast<char*>(ptr);
|
||||
@ -2758,7 +2758,7 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
|
||||
msg += "\"";
|
||||
if (!statusVar.empty()) {
|
||||
std::ostringstream result;
|
||||
result << (int)0 << ";\"" << msg;
|
||||
result << 0 << ";\"" << msg;
|
||||
this->Makefile->AddDefinition(statusVar, result.str().c_str());
|
||||
}
|
||||
return true;
|
||||
@ -2831,10 +2831,10 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
|
||||
|
||||
cmFileCommandVectorOfChar chunkDebug;
|
||||
|
||||
res = ::curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void*)&fout);
|
||||
res = ::curl_easy_setopt(curl, CURLOPT_WRITEDATA, &fout);
|
||||
check_curl_result(res, "DOWNLOAD cannot set write data: ");
|
||||
|
||||
res = ::curl_easy_setopt(curl, CURLOPT_DEBUGDATA, (void*)&chunkDebug);
|
||||
res = ::curl_easy_setopt(curl, CURLOPT_DEBUGDATA, &chunkDebug);
|
||||
check_curl_result(res, "DOWNLOAD cannot set debug data: ");
|
||||
|
||||
res = ::curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
|
||||
@ -2898,7 +2898,8 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
|
||||
|
||||
if (!statusVar.empty()) {
|
||||
std::ostringstream result;
|
||||
result << (int)res << ";\"" << ::curl_easy_strerror(res) << "\"";
|
||||
result << static_cast<int>(res) << ";\"" << ::curl_easy_strerror(res)
|
||||
<< "\"";
|
||||
this->Makefile->AddDefinition(statusVar, result.str().c_str());
|
||||
}
|
||||
|
||||
@ -2924,7 +2925,7 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
|
||||
<< " for file: [" << file << "]" << std::endl
|
||||
<< " expected hash: [" << expectedHash << "]" << std::endl
|
||||
<< " actual hash: [" << actualHash << "]" << std::endl
|
||||
<< " status: [" << (int)res << ";\""
|
||||
<< " status: [" << static_cast<int>(res) << ";\""
|
||||
<< ::curl_easy_strerror(res) << "\"]" << std::endl;
|
||||
|
||||
if (!statusVar.empty() && res == 0) {
|
||||
@ -3080,10 +3081,10 @@ bool cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args)
|
||||
cmFileCommandVectorOfChar chunkResponse;
|
||||
cmFileCommandVectorOfChar chunkDebug;
|
||||
|
||||
res = ::curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void*)&chunkResponse);
|
||||
res = ::curl_easy_setopt(curl, CURLOPT_WRITEDATA, &chunkResponse);
|
||||
check_curl_result(res, "UPLOAD cannot set write data: ");
|
||||
|
||||
res = ::curl_easy_setopt(curl, CURLOPT_DEBUGDATA, (void*)&chunkDebug);
|
||||
res = ::curl_easy_setopt(curl, CURLOPT_DEBUGDATA, &chunkDebug);
|
||||
check_curl_result(res, "UPLOAD cannot set debug data: ");
|
||||
|
||||
res = ::curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
|
||||
@ -3156,7 +3157,8 @@ bool cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args)
|
||||
|
||||
if (!statusVar.empty()) {
|
||||
std::ostringstream result;
|
||||
result << (int)res << ";\"" << ::curl_easy_strerror(res) << "\"";
|
||||
result << static_cast<int>(res) << ";\"" << ::curl_easy_strerror(res)
|
||||
<< "\"";
|
||||
this->Makefile->AddDefinition(statusVar, result.str().c_str());
|
||||
}
|
||||
|
||||
|
@ -121,7 +121,7 @@ int cmFortranParser_Input(cmFortranParser* parser, char* buffer,
|
||||
n = 1;
|
||||
ff.LastCharWasNewline = true;
|
||||
}
|
||||
return (int)n;
|
||||
return static_cast<int>(n);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ std::string GeneratorExpressionContent::EvaluateParameters(
|
||||
}
|
||||
|
||||
if ((numExpected > cmGeneratorExpressionNode::DynamicParameters &&
|
||||
(unsigned int)numExpected != parameters.size())) {
|
||||
static_cast<unsigned int>(numExpected) != parameters.size())) {
|
||||
if (numExpected == 0) {
|
||||
reportError(context, this->GetOriginalExpression(),
|
||||
"$<" + identifier + "> expression requires no parameters.");
|
||||
|
@ -741,7 +741,7 @@ void cmGlobalNinjaGenerator::AddRule(
|
||||
description, comment, depfile, deptype,
|
||||
rspfile, rspcontent, restat, generator);
|
||||
|
||||
this->RuleCmdLength[name] = (int)command.size();
|
||||
this->RuleCmdLength[name] = static_cast<int>(command.size());
|
||||
}
|
||||
|
||||
bool cmGlobalNinjaGenerator::HasRule(const std::string& name)
|
||||
|
@ -182,9 +182,9 @@ bool cmListCommand::HandleGetCommand(std::vector<std::string> const& args)
|
||||
value += sep;
|
||||
sep = ";";
|
||||
if (item < 0) {
|
||||
item = (int)nitem + item;
|
||||
item = static_cast<int>(nitem) + item;
|
||||
}
|
||||
if (item < 0 || nitem <= (size_t)item) {
|
||||
if (item < 0 || nitem <= static_cast<size_t>(item)) {
|
||||
std::ostringstream str;
|
||||
str << "index: " << item << " out of range (-" << nitem << ", "
|
||||
<< nitem - 1 << ")";
|
||||
@ -273,9 +273,9 @@ bool cmListCommand::HandleInsertCommand(std::vector<std::string> const& args)
|
||||
if (!varArgsExpanded.empty()) {
|
||||
size_t nitem = varArgsExpanded.size();
|
||||
if (item < 0) {
|
||||
item = (int)nitem + item;
|
||||
item = static_cast<int>(nitem) + item;
|
||||
}
|
||||
if (item < 0 || nitem <= (size_t)item) {
|
||||
if (item < 0 || nitem <= static_cast<size_t>(item)) {
|
||||
std::ostringstream str;
|
||||
str << "index: " << item << " out of range (-" << varArgsExpanded.size()
|
||||
<< ", "
|
||||
@ -423,9 +423,9 @@ bool cmListCommand::HandleRemoveAtCommand(std::vector<std::string> const& args)
|
||||
for (cc = 2; cc < args.size(); ++cc) {
|
||||
int item = atoi(args[cc].c_str());
|
||||
if (item < 0) {
|
||||
item = (int)nitem + item;
|
||||
item = static_cast<int>(nitem) + item;
|
||||
}
|
||||
if (item < 0 || nitem <= (size_t)item) {
|
||||
if (item < 0 || nitem <= static_cast<size_t>(item)) {
|
||||
std::ostringstream str;
|
||||
str << "index: " << item << " out of range (-" << nitem << ", "
|
||||
<< nitem - 1 << ")";
|
||||
|
@ -120,15 +120,14 @@ bool cmLoadedCommand::InitialPass(std::vector<std::string> const& args,
|
||||
int argc = static_cast<int>(args.size());
|
||||
char** argv = nullptr;
|
||||
if (argc) {
|
||||
argv = (char**)malloc(argc * sizeof(char*));
|
||||
argv = reinterpret_cast<char**>(malloc(argc * sizeof(char*)));
|
||||
}
|
||||
int i;
|
||||
for (i = 0; i < argc; ++i) {
|
||||
argv[i] = strdup(args[i].c_str());
|
||||
}
|
||||
cmLoadedCommand::InstallSignalHandlers(info.Name);
|
||||
int result =
|
||||
info.InitialPass((void*)&info, (void*)this->Makefile, argc, argv);
|
||||
int result = info.InitialPass(&info, this->Makefile, argc, argv);
|
||||
cmLoadedCommand::InstallSignalHandlers(info.Name, 1);
|
||||
cmFreeArguments(argc, argv);
|
||||
|
||||
@ -147,7 +146,7 @@ void cmLoadedCommand::FinalPass()
|
||||
{
|
||||
if (this->info.FinalPass) {
|
||||
cmLoadedCommand::InstallSignalHandlers(info.Name);
|
||||
this->info.FinalPass((void*)&this->info, (void*)this->Makefile);
|
||||
this->info.FinalPass(&this->info, this->Makefile);
|
||||
cmLoadedCommand::InstallSignalHandlers(info.Name, 1);
|
||||
}
|
||||
}
|
||||
@ -156,7 +155,7 @@ cmLoadedCommand::~cmLoadedCommand()
|
||||
{
|
||||
if (this->info.Destructor) {
|
||||
cmLoadedCommand::InstallSignalHandlers(info.Name);
|
||||
this->info.Destructor((void*)&this->info);
|
||||
this->info.Destructor(&this->info);
|
||||
cmLoadedCommand::InstallSignalHandlers(info.Name, 1);
|
||||
}
|
||||
if (this->info.Error) {
|
||||
@ -225,14 +224,13 @@ bool cmLoadCommandCommand::InitialPass(std::vector<std::string> const& args,
|
||||
|
||||
// find the init function
|
||||
std::string initFuncName = args[0] + "Init";
|
||||
CM_INIT_FUNCTION initFunction =
|
||||
(CM_INIT_FUNCTION)cmsys::DynamicLoader::GetSymbolAddress(lib,
|
||||
initFuncName);
|
||||
CM_INIT_FUNCTION initFunction = reinterpret_cast<CM_INIT_FUNCTION>(
|
||||
cmsys::DynamicLoader::GetSymbolAddress(lib, initFuncName));
|
||||
if (!initFunction) {
|
||||
initFuncName = "_";
|
||||
initFuncName += args[0];
|
||||
initFuncName += "Init";
|
||||
initFunction = (CM_INIT_FUNCTION)(
|
||||
initFunction = reinterpret_cast<CM_INIT_FUNCTION>(
|
||||
cmsys::DynamicLoader::GetSymbolAddress(lib, initFuncName));
|
||||
}
|
||||
// if the symbol is found call it to set the name on the
|
||||
|
@ -389,7 +389,7 @@ int cmOutputConverter::Shell__CharNeedsQuotes(char c, int flags)
|
||||
|
||||
int cmOutputConverter::Shell__CharIsMakeVariableName(char c)
|
||||
{
|
||||
return c && (c == '_' || isalpha(((int)c)));
|
||||
return c && (c == '_' || isalpha((static_cast<int>(c))));
|
||||
}
|
||||
|
||||
const char* cmOutputConverter::Shell__SkipMakeVariables(const char* c)
|
||||
|
@ -469,11 +469,13 @@ void cmServerBase::OnServeStart()
|
||||
|
||||
void cmServerBase::StartShutDown()
|
||||
{
|
||||
if (!uv_is_closing((const uv_handle_t*)&this->SIGINTHandler)) {
|
||||
if (!uv_is_closing(
|
||||
reinterpret_cast<const uv_handle_t*>(&this->SIGINTHandler))) {
|
||||
uv_signal_stop(&this->SIGINTHandler);
|
||||
}
|
||||
|
||||
if (!uv_is_closing((const uv_handle_t*)&this->SIGHUPHandler)) {
|
||||
if (!uv_is_closing(
|
||||
reinterpret_cast<const uv_handle_t*>(&this->SIGHUPHandler))) {
|
||||
uv_signal_stop(&this->SIGHUPHandler);
|
||||
}
|
||||
|
||||
|
@ -742,7 +742,7 @@ static Json::Value DumpBacktrace(const cmListFileBacktrace& backtrace)
|
||||
Json::Value entry = Json::objectValue;
|
||||
entry[kPATH_KEY] = backtraceCopy.Top().FilePath;
|
||||
if (backtraceCopy.Top().Line) {
|
||||
entry[kLINE_NUMBER_KEY] = (int)backtraceCopy.Top().Line;
|
||||
entry[kLINE_NUMBER_KEY] = static_cast<int>(backtraceCopy.Top().Line);
|
||||
}
|
||||
if (!backtraceCopy.Top().Name.empty()) {
|
||||
entry[kNAME_KEY] = backtraceCopy.Top().Name;
|
||||
|
@ -224,7 +224,7 @@ void cmState::RemoveCacheEntryProperty(std::string const& key,
|
||||
std::string const& propertyName)
|
||||
{
|
||||
this->CacheManager->GetCacheIterator(key.c_str())
|
||||
.SetProperty(propertyName, (void*)nullptr);
|
||||
.SetProperty(propertyName, nullptr);
|
||||
}
|
||||
|
||||
cmStateSnapshot cmState::Reset()
|
||||
|
@ -818,7 +818,7 @@ bool cmStringCommand::HandleRandomCommand(std::vector<std::string> const& args)
|
||||
const char* alphaPtr = alphabet.c_str();
|
||||
int cc;
|
||||
for (cc = 0; cc < length; cc++) {
|
||||
int idx = (int)(sizeofAlphabet * rand() / (RAND_MAX + 1.0));
|
||||
int idx = static_cast<int>(sizeofAlphabet * rand() / (RAND_MAX + 1.0));
|
||||
result.push_back(*(alphaPtr + idx));
|
||||
}
|
||||
result.push_back(0);
|
||||
|
@ -1519,21 +1519,21 @@ void list_item_verbose(FILE* out, struct archive_entry* entry)
|
||||
/* Use uname if it's present, else uid. */
|
||||
p = archive_entry_uname(entry);
|
||||
if ((p == nullptr) || (*p == '\0')) {
|
||||
sprintf(tmp, "%lu ", (unsigned long)archive_entry_uid(entry));
|
||||
sprintf(tmp, "%lu ", static_cast<unsigned long>(archive_entry_uid(entry)));
|
||||
p = tmp;
|
||||
}
|
||||
w = strlen(p);
|
||||
if (w > u_width) {
|
||||
u_width = w;
|
||||
}
|
||||
fprintf(out, "%-*s ", (int)u_width, p);
|
||||
fprintf(out, "%-*s ", static_cast<int>(u_width), p);
|
||||
/* Use gname if it's present, else gid. */
|
||||
p = archive_entry_gname(entry);
|
||||
if (p != nullptr && p[0] != '\0') {
|
||||
fprintf(out, "%s", p);
|
||||
w = strlen(p);
|
||||
} else {
|
||||
sprintf(tmp, "%lu", (unsigned long)archive_entry_gid(entry));
|
||||
sprintf(tmp, "%lu", static_cast<unsigned long>(archive_entry_gid(entry)));
|
||||
w = strlen(tmp);
|
||||
fprintf(out, "%s", tmp);
|
||||
}
|
||||
@ -1545,8 +1545,9 @@ void list_item_verbose(FILE* out, struct archive_entry* entry)
|
||||
*/
|
||||
if (archive_entry_filetype(entry) == AE_IFCHR ||
|
||||
archive_entry_filetype(entry) == AE_IFBLK) {
|
||||
sprintf(tmp, "%lu,%lu", (unsigned long)archive_entry_rdevmajor(entry),
|
||||
(unsigned long)archive_entry_rdevminor(entry));
|
||||
unsigned long rdevmajor = archive_entry_rdevmajor(entry);
|
||||
unsigned long rdevminor = archive_entry_rdevminor(entry);
|
||||
sprintf(tmp, "%lu,%lu", rdevmajor, rdevminor);
|
||||
} else {
|
||||
/*
|
||||
* Note the use of platform-dependent macros to format
|
||||
@ -1554,12 +1555,12 @@ void list_item_verbose(FILE* out, struct archive_entry* entry)
|
||||
* corresponding type for the cast.
|
||||
*/
|
||||
sprintf(tmp, BSDTAR_FILESIZE_PRINTF,
|
||||
(BSDTAR_FILESIZE_TYPE)archive_entry_size(entry));
|
||||
static_cast<BSDTAR_FILESIZE_TYPE>(archive_entry_size(entry)));
|
||||
}
|
||||
if (w + strlen(tmp) >= gs_width) {
|
||||
gs_width = w + strlen(tmp) + 1;
|
||||
}
|
||||
fprintf(out, "%*s", (int)(gs_width - w), tmp);
|
||||
fprintf(out, "%*s", static_cast<int>(gs_width - w), tmp);
|
||||
|
||||
/* Format the time using 'ls -l' conventions. */
|
||||
tim = archive_entry_mtime(entry);
|
||||
|
@ -56,7 +56,7 @@ std::string cmTimestamp::CreateTimestampFromTimeT(time_t timeT,
|
||||
struct tm timeStruct;
|
||||
memset(&timeStruct, 0, sizeof(timeStruct));
|
||||
|
||||
struct tm* ptr = (struct tm*)nullptr;
|
||||
struct tm* ptr = nullptr;
|
||||
if (utcFlag) {
|
||||
ptr = gmtime(&timeT);
|
||||
} else {
|
||||
|
@ -26,7 +26,7 @@ cmXMLParser::~cmXMLParser()
|
||||
|
||||
int cmXMLParser::Parse(const char* string)
|
||||
{
|
||||
return (int)this->InitializeParser() &&
|
||||
return this->InitializeParser() &&
|
||||
this->ParseChunk(string, strlen(string)) && this->CleanupParser();
|
||||
}
|
||||
|
||||
|
@ -103,7 +103,7 @@ static int do_build(int ac, char const* const* av);
|
||||
|
||||
static cmMakefile* cmakemainGetMakefile(void* clientdata)
|
||||
{
|
||||
cmake* cm = (cmake*)clientdata;
|
||||
cmake* cm = reinterpret_cast<cmake*>(clientdata);
|
||||
if (cm && cm->GetDebugOutput()) {
|
||||
cmGlobalGenerator* gg = cm->GetGlobalGenerator();
|
||||
if (gg) {
|
||||
@ -304,8 +304,8 @@ int do_cmake(int ac, char const* const* av)
|
||||
cmake cm(role);
|
||||
cm.SetHomeDirectory("");
|
||||
cm.SetHomeOutputDirectory("");
|
||||
cmSystemTools::SetMessageCallback(cmakemainMessageCallback, (void*)&cm);
|
||||
cm.SetProgressCallback(cmakemainProgressCallback, (void*)&cm);
|
||||
cmSystemTools::SetMessageCallback(cmakemainMessageCallback, &cm);
|
||||
cm.SetProgressCallback(cmakemainProgressCallback, &cm);
|
||||
cm.SetWorkingMode(workingMode);
|
||||
|
||||
int res = cm.Run(args, view_only);
|
||||
@ -420,8 +420,8 @@ static int do_build(int ac, char const* const* av)
|
||||
}
|
||||
|
||||
cmake cm(cmake::RoleInternal);
|
||||
cmSystemTools::SetMessageCallback(cmakemainMessageCallback, (void*)&cm);
|
||||
cm.SetProgressCallback(cmakemainProgressCallback, (void*)&cm);
|
||||
cmSystemTools::SetMessageCallback(cmakemainMessageCallback, &cm);
|
||||
cm.SetProgressCallback(cmakemainProgressCallback, &cm);
|
||||
return cm.Build(dir, target, config, nativeOptions, clean);
|
||||
#endif
|
||||
}
|
||||
|
@ -8,8 +8,9 @@ typedef char test_utf8_char[5];
|
||||
static void test_utf8_char_print(test_utf8_char const c)
|
||||
{
|
||||
unsigned char const* d = reinterpret_cast<unsigned char const*>(c);
|
||||
printf("[0x%02X,0x%02X,0x%02X,0x%02X]", (int)d[0], (int)d[1], (int)d[2],
|
||||
(int)d[3]);
|
||||
printf("[0x%02X,0x%02X,0x%02X,0x%02X]", static_cast<int>(d[0]),
|
||||
static_cast<int>(d[1]), static_cast<int>(d[2]),
|
||||
static_cast<int>(d[3]));
|
||||
}
|
||||
|
||||
struct test_utf8_entry
|
||||
|
Loading…
Reference in New Issue
Block a user