From: Marek Marczykowski-Górecki Date: Tue, 10 Jul 2018 14:51:58 +0000 (+0100) Subject: Fix compile warnings X-Git-Tag: 9.0.0-rc1~20 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=9716a887a28f45e82a15ae337615eca5eb2f6202;p=pvdrivers%2Fwin%2Fxeniface.git Fix compile warnings Fix two warnings: e:\xeniface\src\xenagent\service.cpp(684): warning C26439: This kind offunction may not throw. Declare it 'noexcept' (f.6). [E:\xeniface\vs2017\xenagent\xenagent.vcxproj] e:\xeniface\src\xenagent\xenifacedevice.cpp(57): warning C26451: Arithmetic overflow: Using operator '+' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '+' to avoid overflow (io.2). [E:\xeniface\vs2017\xenagent\xenagent.vcxproj] Signed-off-by: Marek Marczykowski-Górecki --- diff --git a/src/xenagent/service.cpp b/src/xenagent/service.cpp index 6b042c4..a8d45fc 100644 --- a/src/xenagent/service.cpp +++ b/src/xenagent/service.cpp @@ -681,7 +681,7 @@ static CXenAgent s_service; #pragma warning(push) #pragma warning(disable:4355) -CXenAgent::CXenAgent() : m_handle(NULL), m_evtlog(NULL), m_xeniface(*this), +CXenAgent::CXenAgent() noexcept : m_handle(NULL), m_evtlog(NULL), m_xeniface(*this), m_conv(*this) { m_status.dwServiceType = SERVICE_WIN32; diff --git a/src/xenagent/service.h b/src/xenagent/service.h index e2e5e5c..8fda4ef 100644 --- a/src/xenagent/service.h +++ b/src/xenagent/service.h @@ -137,7 +137,7 @@ public: // statics static DWORD WINAPI ServiceControlHandlerEx(DWORD, DWORD, LPVOID, LPVOID); public: // ctor/dtor - CXenAgent(); + CXenAgent() noexcept; virtual ~CXenAgent(); public: diff --git a/src/xenagent/xenifacedevice.cpp b/src/xenagent/xenifacedevice.cpp index c254b9a..9c2008d 100644 --- a/src/xenagent/xenifacedevice.cpp +++ b/src/xenagent/xenifacedevice.cpp @@ -54,7 +54,7 @@ bool CXenIfaceDevice::StoreRead(const std::string& path, std::string& value) NULL, 0, &bytes); - buffer = new char[bytes + 1]; + buffer = new char[(size_t)bytes + 1]; if (buffer == NULL) return false;