From 0fa481dabf620181c852f43923a3c4b049294ab4 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sun, 20 Dec 2015 16:59:00 +0100 Subject: Fix numeric limits and uninitialised warnings. --- src/semaphore.cc | 6 ++++-- src/semaphore.h | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/semaphore.cc b/src/semaphore.cc index 47ce8e0..3f5781f 100644 --- a/src/semaphore.cc +++ b/src/semaphore.cc @@ -28,6 +28,8 @@ #include +#include + #ifdef WIN32 #include #else @@ -53,7 +55,7 @@ Semaphore::Semaphore(const char *name) #ifdef WIN32 prv->semaphore = CreateSemaphore(NULL, // default security attributes 0, // initial count - 2147483647, // maximum count (Max LONG) + std::numeric_limits::max(), NULL); // unnamed semaphore #else sem_init(&prv->semaphore, 0, 0); @@ -70,7 +72,7 @@ Semaphore::~Semaphore() sem_destroy(&prv->semaphore); #endif - if(prv) delete prv; + delete prv; } void Semaphore::post() diff --git a/src/semaphore.h b/src/semaphore.h index 7e39f5a..ed284de 100644 --- a/src/semaphore.h +++ b/src/semaphore.h @@ -38,8 +38,8 @@ public: void wait(); private: - struct semaphore_private_t *prv; - const char *name; + struct semaphore_private_t *prv{nullptr}; + const char *name{nullptr}; }; #endif/*__PRACRO_SEMAPHORE_H__*/ -- cgit v1.2.3