]> xenbits.xensource.com Git - people/pauldu/xeniface.git/commitdiff
Fix compile warnings
authorMarek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Tue, 10 Jul 2018 14:51:58 +0000 (15:51 +0100)
committerPaul Durrant <paul.durrant@citrix.com>
Tue, 10 Jul 2018 14:51:58 +0000 (15:51 +0100)
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 <marmarek@invisiblethingslab.com>
src/xenagent/service.cpp
src/xenagent/service.h
src/xenagent/xenifacedevice.cpp

index 6b042c446d9d4a8ca073fa252a5fe203838b8862..a8d45fc30c9e47f0d2c78baa22cfbab887f22490 100644 (file)
@@ -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;
index e2e5e5c601a75ba851757ad9f7254ff623051bb6..8fda4ef9fbb79f2c8617991706410270e51bb17f 100644 (file)
@@ -137,7 +137,7 @@ public: // statics
     static DWORD WINAPI ServiceControlHandlerEx(DWORD, DWORD, LPVOID, LPVOID);
 
 public: // ctor/dtor
-    CXenAgent();
+    CXenAgent() noexcept;
     virtual ~CXenAgent();
 
 public:
index c254b9a9cf8444bbcce6b5c75f19d0c1c50f0190..9c2008d47658e3d25f350c9c9f34368991783856 100644 (file)
@@ -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;