[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[win-pv-devel] [PATCH xeniface 2/4] xenagent: fix compile warnings



Fix two warnings:

e:\xeniface\src\xenagent\service.cpp(684): warning C26439: This kind of 
function 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 <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
---
 src/xenagent/service.cpp        | 2 +-
 src/xenagent/service.h          | 2 +-
 src/xenagent/xenifacedevice.cpp | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

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;
 
-- 
2.13.6


_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/win-pv-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.