From 4f9dd7277b8d2f1f56071f753081451d361bb7e2 Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Wed, 7 Jun 2017 04:09:26 -0700 Subject: msvc: disable unused symbol warning in Core/Common/Crypto/ec.cpp --- Source/Core/Common/Crypto/ec.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'Source/Core/Common') diff --git a/Source/Core/Common/Crypto/ec.cpp b/Source/Core/Common/Crypto/ec.cpp index 9dca32878b..5fe7e9bb2b 100644 --- a/Source/Core/Common/Crypto/ec.cpp +++ b/Source/Core/Common/Crypto/ec.cpp @@ -15,6 +15,11 @@ #include "Common/Crypto/bn.h" #include "Common/Crypto/ec.h" +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable : 4505) +#endif + // y**2 + x*y = x**3 + x + b UNUSED static const u8 ec_b[30] = {0x00, 0x66, 0x64, 0x7e, 0xde, 0x6c, 0x33, 0x2c, 0x7f, 0x8c, 0x09, 0x23, 0xbb, 0x58, 0x21, 0x3b, 0x33, 0x3b, 0x20, 0xe9, @@ -404,3 +409,7 @@ void ec_priv_to_pub(const u8* k, u8* Q) { point_mul(Q, k, ec_G); } + +#ifdef _MSC_VER +#pragma warning(pop) +#endif -- cgit v1.2.3 From f7f1d5d2ca1e5de5eda350a7af3bd46519bde2f8 Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Wed, 7 Jun 2017 04:10:23 -0700 Subject: msvc: disable meaningless constant truncation warnings in SDCardUtil --- Source/Core/Common/SDCardUtil.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'Source/Core/Common') diff --git a/Source/Core/Common/SDCardUtil.cpp b/Source/Core/Common/SDCardUtil.cpp index 1bb09878b6..9e72990747 100644 --- a/Source/Core/Common/SDCardUtil.cpp +++ b/Source/Core/Common/SDCardUtil.cpp @@ -49,6 +49,11 @@ #include // for unlink() #endif +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable : 4310) +#endif + /* Believe me, you *don't* want to change these constants !! */ #define BYTES_PER_SECTOR 512 #define RESERVED_SECTORS 32 @@ -289,3 +294,7 @@ FailWrite: ERROR_LOG(COMMON, "unlink(%s) failed: %s", filename.c_str(), GetLastErrorMsg().c_str()); return false; } + +#ifdef _MSC_VER +#pragma warning(pop) +#endif -- cgit v1.2.3 From e1a3e41bf33bf6a366760ede17c2e3bd2b106116 Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Wed, 7 Jun 2017 04:16:02 -0700 Subject: fix various instances of -1 being assigned to unsigned types --- Source/Core/Common/FileUtil.cpp | 2 +- Source/Core/Common/MathUtil.h | 2 +- Source/Core/Common/Profiler.cpp | 6 +++--- Source/Core/Common/Thread.cpp | 9 +++------ 4 files changed, 8 insertions(+), 11 deletions(-) (limited to 'Source/Core/Common') diff --git a/Source/Core/Common/FileUtil.cpp b/Source/Core/Common/FileUtil.cpp index ebab9e9c48..2ae063673f 100644 --- a/Source/Core/Common/FileUtil.cpp +++ b/Source/Core/Common/FileUtil.cpp @@ -986,7 +986,7 @@ u64 IOFile::Tell() const if (IsOpen()) return ftello(m_file); else - return -1; + return UINT64_MAX; } bool IOFile::Flush() diff --git a/Source/Core/Common/MathUtil.h b/Source/Core/Common/MathUtil.h index 7e48e38d80..becaf09792 100644 --- a/Source/Core/Common/MathUtil.h +++ b/Source/Core/Common/MathUtil.h @@ -198,7 +198,7 @@ inline int IntLog2(u64 val) return 63 - __builtin_clzll(val); #elif defined(_MSC_VER) - unsigned long result = -1; + unsigned long result = ULONG_MAX; _BitScanReverse64(&result, val); return result; diff --git a/Source/Core/Common/Profiler.cpp b/Source/Core/Common/Profiler.cpp index fdc356a164..0be14073bd 100644 --- a/Source/Core/Common/Profiler.cpp +++ b/Source/Core/Common/Profiler.cpp @@ -29,8 +29,8 @@ std::string Profiler::s_lazy_result = ""; int Profiler::s_lazy_delay = 0; Profiler::Profiler(const std::string& name) - : m_name(name), m_usecs(0), m_usecs_min(-1), m_usecs_max(0), m_usecs_quad(0), m_calls(0), - m_depth(0) + : m_name(name), m_usecs(0), m_usecs_min(UINT64_MAX), m_usecs_max(0), m_usecs_quad(0), + m_calls(0), m_depth(0) { m_time = Common::Timer::GetTimeUs(); s_max_length = std::max(s_max_length, u32(m_name.length())); @@ -154,7 +154,7 @@ std::string Profiler::Read() buffer << std::setw(PROFILER_FIELD_LENGTH) << std::right << m_usecs_max; m_usecs = 0; - m_usecs_min = -1; + m_usecs_min = UINT64_MAX; m_usecs_max = 0; m_usecs_quad = 0; m_calls = 0; diff --git a/Source/Core/Common/Thread.cpp b/Source/Core/Common/Thread.cpp index 190653ee31..fa81314795 100644 --- a/Source/Core/Common/Thread.cpp +++ b/Source/Core/Common/Thread.cpp @@ -62,11 +62,8 @@ void SwitchCurrentThread() } // Sets the debugger-visible name of the current thread. -// Uses undocumented (actually, it is now documented) trick. -// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsdebug/html/vxtsksettingthreadname.asp - -// This is implemented much nicer in upcoming msvc++, see: -// http://msdn.microsoft.com/en-us/library/xcb2z8hs(VS.100).aspx +// Uses trick documented in: +// https://docs.microsoft.com/en-us/visualstudio/debugger/how-to-set-a-thread-name-in-native-code void SetCurrentThreadName(const char* szThreadName) { static const DWORD MS_VC_EXCEPTION = 0x406D1388; @@ -83,7 +80,7 @@ void SetCurrentThreadName(const char* szThreadName) info.dwType = 0x1000; info.szName = szThreadName; - info.dwThreadID = -1; // dwThreadID; + info.dwThreadID = static_cast(-1); info.dwFlags = 0; __try -- cgit v1.2.3 From 9357cee2ef96fbe345a82ac2f6af7c715d1e6027 Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Wed, 7 Jun 2017 04:42:41 -0700 Subject: do not assign in conditional statements --- Source/Core/Common/FileUtil.cpp | 4 ++-- Source/Core/Common/GL/GLInterface/WGL.cpp | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'Source/Core/Common') diff --git a/Source/Core/Common/FileUtil.cpp b/Source/Core/Common/FileUtil.cpp index 2ae063673f..203ddbac4b 100644 --- a/Source/Core/Common/FileUtil.cpp +++ b/Source/Core/Common/FileUtil.cpp @@ -631,9 +631,9 @@ void CopyDir(const std::string& source_path, const std::string& dest_path) // Returns the current directory std::string GetCurrentDir() { - char* dir; // Get the current working directory (getcwd uses malloc) - if (!(dir = __getcwd(nullptr, 0))) + char* dir = __getcwd(nullptr, 0); + if (!dir) { ERROR_LOG(COMMON, "GetCurrentDirectory failed: %s", GetLastErrorMsg().c_str()); return nullptr; diff --git a/Source/Core/Common/GL/GLInterface/WGL.cpp b/Source/Core/Common/GL/GLInterface/WGL.cpp index 57c46cb42b..3e500f5866 100644 --- a/Source/Core/Common/GL/GLInterface/WGL.cpp +++ b/Source/Core/Common/GL/GLInterface/WGL.cpp @@ -248,8 +248,8 @@ bool cInterfaceWGL::Create(void* window_handle, bool core) return false; } - int pixel_format; - if (!(pixel_format = ChoosePixelFormat(m_dc, &pfd))) + int pixel_format = ChoosePixelFormat(m_dc, &pfd); + if (!pixel_format) { PanicAlert("(2) Can't find a suitable PixelFormat."); return false; @@ -261,7 +261,8 @@ bool cInterfaceWGL::Create(void* window_handle, bool core) return false; } - if (!(m_rc = wglCreateContext(m_dc))) + m_rc = wglCreateContext(m_dc); + if (!m_rc) { PanicAlert("(4) Can't create an OpenGL rendering context."); return false; -- cgit v1.2.3 From fd166032abec349b9fae7240830133bf7e0c77b5 Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Wed, 7 Jun 2017 15:25:13 -0700 Subject: msbuild: obey some warnings about missing virtual destructors --- Source/Core/Common/Config/Section.h | 1 + 1 file changed, 1 insertion(+) (limited to 'Source/Core/Common') diff --git a/Source/Core/Common/Config/Section.h b/Source/Core/Common/Config/Section.h index 8b36ce157e..0a4662d156 100644 --- a/Source/Core/Common/Config/Section.h +++ b/Source/Core/Common/Config/Section.h @@ -27,6 +27,7 @@ class Section public: Section(LayerType layer, System system, const std::string& name); + virtual ~Section() = default; virtual bool Exists(const std::string& key) const; bool Delete(const std::string& key); -- cgit v1.2.3