diff options
author | Samuel Barney <samjbarney@gmail.com> | 2015-07-29 17:04:03 +0200 |
---|---|---|
committer | Samuel Barney <samjbarney@gmail.com> | 2015-07-29 17:49:30 +0200 |
commit | 804805d35a87c2acc9425d1762ad26b1ba2ec9ac (patch) | |
tree | 13b603c8bbf8177da92ce87f5413fb646d204f3f /src/OSSupport | |
parent | Merge pull request #2376 from mjhanninen/fix-freebsd-build (diff) | |
download | cuberite-804805d35a87c2acc9425d1762ad26b1ba2ec9ac.tar cuberite-804805d35a87c2acc9425d1762ad26b1ba2ec9ac.tar.gz cuberite-804805d35a87c2acc9425d1762ad26b1ba2ec9ac.tar.bz2 cuberite-804805d35a87c2acc9425d1762ad26b1ba2ec9ac.tar.lz cuberite-804805d35a87c2acc9425d1762ad26b1ba2ec9ac.tar.xz cuberite-804805d35a87c2acc9425d1762ad26b1ba2ec9ac.tar.zst cuberite-804805d35a87c2acc9425d1762ad26b1ba2ec9ac.zip |
Diffstat (limited to '')
-rw-r--r-- | src/OSSupport/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/OSSupport/File.cpp | 10 | ||||
-rw-r--r-- | src/OSSupport/GZipFile.cpp | 4 |
3 files changed, 8 insertions, 8 deletions
diff --git a/src/OSSupport/CMakeLists.txt b/src/OSSupport/CMakeLists.txt index df47394ae..ce1d5c530 100644 --- a/src/OSSupport/CMakeLists.txt +++ b/src/OSSupport/CMakeLists.txt @@ -40,7 +40,7 @@ SET (HDRS ) if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - add_flags_cxx("-Wno-error=global-constructors -Wno-error=old-style-cast") + add_flags_cxx("-Wno-error=global-constructors ") endif() if(NOT MSVC) diff --git a/src/OSSupport/File.cpp b/src/OSSupport/File.cpp index 6327b3505..03cddc408 100644 --- a/src/OSSupport/File.cpp +++ b/src/OSSupport/File.cpp @@ -156,7 +156,7 @@ int cFile::Read (void * iBuffer, size_t iNumBytes) return -1; } - return (int)fread(iBuffer, 1, (size_t)iNumBytes, m_File); // fread() returns the portion of Count parameter actually read, so we need to send iNumBytes as Count + return static_cast<int>(fread(iBuffer, 1, static_cast<size_t>(iNumBytes), m_File)); // fread() returns the portion of Count parameter actually read, so we need to send iNumBytes as Count } @@ -172,7 +172,7 @@ int cFile::Write(const void * iBuffer, size_t iNumBytes) return -1; } - int res = (int)fwrite(iBuffer, 1, (size_t)iNumBytes, m_File); // fwrite() returns the portion of Count parameter actually written, so we need to send iNumBytes as Count + int res = static_cast<int>(fwrite(iBuffer, 1, static_cast<size_t>(iNumBytes), m_File)); // fwrite() returns the portion of Count parameter actually written, so we need to send iNumBytes as Count return res; } @@ -236,7 +236,7 @@ long cFile::GetSize(void) const return -1; } long res = Tell(); - if (fseek(m_File, (long)CurPos, SEEK_SET) != 0) + if (fseek(m_File, static_cast<long>(CurPos), SEEK_SET) != 0) { return -1; } @@ -272,7 +272,7 @@ int cFile::ReadRestOfFile(AString & a_Contents) // HACK: This depends on the internal knowledge that AString's data() function returns the internal buffer directly a_Contents.assign(DataSize, '\0'); - return Read((void *)a_Contents.data(), DataSize); + return Read(reinterpret_cast<void *>(const_cast<char *>(a_Contents.data())), DataSize); } @@ -366,7 +366,7 @@ long cFile::GetSize(const AString & a_FileName) struct stat st; if (stat(a_FileName.c_str(), &st) == 0) { - return (int)st.st_size; + return static_cast<int>(st.st_size); } return -1; } diff --git a/src/OSSupport/GZipFile.cpp b/src/OSSupport/GZipFile.cpp index 32d84a0d5..2ddc260e5 100644 --- a/src/OSSupport/GZipFile.cpp +++ b/src/OSSupport/GZipFile.cpp @@ -78,7 +78,7 @@ int cGZipFile::ReadRestOfFile(AString & a_Contents) while ((NumBytesRead = gzread(m_File, Buffer, sizeof(Buffer))) > 0) { TotalBytes += NumBytesRead; - a_Contents.append(Buffer, (size_t)NumBytesRead); + a_Contents.append(Buffer, static_cast<size_t>(NumBytesRead)); } // NumBytesRead is < 0 on error return (NumBytesRead >= 0) ? TotalBytes : NumBytesRead; @@ -102,7 +102,7 @@ bool cGZipFile::Write(const char * a_Contents, int a_Size) return false; } - return (gzwrite(m_File, a_Contents, (unsigned int)a_Size) != 0); + return (gzwrite(m_File, a_Contents, static_cast<unsigned int>(a_Size)) != 0); } |