Use C++ style casts.

This commit is contained in:
Dave Page 2018-12-06 10:36:57 +00:00
parent 312bcbc83f
commit 5cfe0ef115
3 changed files with 5 additions and 5 deletions

View File

@ -67,7 +67,7 @@ void LogWindow::ReadLog()
fseek(log, 0, SEEK_END);
len = ftell(log);
rewind(log);
buffer = (char *)malloc((len + 1) * sizeof(char));
buffer = static_cast<char *>(malloc((len + 1) * sizeof(char)));
for (i = 0; i < len; i++) {
if (fread(buffer + i, 1, 1, log) > 0)

View File

@ -200,7 +200,7 @@ Server::Server(quint16 port, QString key, QString logFileName)
Logger::GetLogger()->Log("Python initialized.");
// Get the current path
PyObject* sysPath = PySys_GetObject((char*)"path");
PyObject* sysPath = PySys_GetObject(const_cast<char *>("path"));
if (sysPath != nullptr)
{
// Add new additional path elements
@ -240,12 +240,12 @@ Server::Server(quint16 port, QString key, QString logFileName)
log = _wfopen(wcLogFileName, (wchar_t *)"w");
#else
log = fopen(m_logFileName.toUtf8().data(), (char *)"w");
log = fopen(m_logFileName.toUtf8().data(), const_cast<char *>("w"));
#endif
if (log != nullptr)
{
int fd = fileno(log);
err = PyFile_FromFd(fd, nullptr, (char *)"w", -1, nullptr, nullptr, nullptr, 0);
err = PyFile_FromFd(fd, nullptr, const_cast<char *>("w"), -1, nullptr, nullptr, nullptr, 0);
}
else
Logger::GetLogger()->Log(QString("Failed to open log file: %1").arg(m_logFileName));

View File

@ -70,7 +70,7 @@ int main(int argc, char * argv[])
// Create a hash of the executable path so we can run copies side-by-side
QString homeDir = QDir::homePath();
unsigned long exeHash = sdbm((unsigned char *)argv[0]);
unsigned long exeHash = sdbm(reinterpret_cast<unsigned char *>(argv[0]));
// Create the address file, that will be used to store the appserver URL for this instance
addrFileName = homeDir + (QString("/.%1.%2.addr").arg(PGA_APP_NAME).arg(exeHash)).remove(" ");