diff --git a/DExtraHandler.cpp b/DExtraHandler.cpp index b9bbacf..68fbd1a 100644 --- a/DExtraHandler.cpp +++ b/DExtraHandler.cpp @@ -945,7 +945,7 @@ bool CDExtraHandler::stateChange() return stateChange; } -void CDExtraHandler::writeStatus(ofstream& file) +void CDExtraHandler::writeStatus(std::ofstream& file) { for (unsigned int i = 0U; i < m_maxReflectors; i++) { CDExtraHandler* reflector = m_reflectors[i]; diff --git a/DPlusHandler.cpp b/DPlusHandler.cpp index 76bbe51..aa78395 100644 --- a/DPlusHandler.cpp +++ b/DPlusHandler.cpp @@ -909,7 +909,7 @@ bool CDPlusHandler::stateChange() return stateChange; } -void CDPlusHandler::writeStatus(ofstream& file) +void CDPlusHandler::writeStatus(std::ofstream& file) { for (unsigned int i = 0U; i < m_maxReflectors; i++) { CDPlusHandler* reflector = m_reflectors[i]; diff --git a/MutexLocker.h b/MutexLocker.h deleted file mode 100644 index 1e98b56..0000000 --- a/MutexLocker.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2021 by Geoffrey Merck F4FXL / KC3FRA - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef MUTEXLOCKER_H -#define MUTEXLOCKER_H - -#include -#include - -using namespace std; - -class CMutexLocker -{ -public: - CMutexLocker(recursive_mutex * mutex) : - m_mutex(mutex) - { - assert(mutex != NULL); - - m_mutex->lock(); - } - - ~CMutexLocker() - { - m_mutex->unlock(); - } -private: - recursive_mutex * m_mutex; -}; - -#endif \ No newline at end of file diff --git a/README.md b/README.md index 0f5a320..f11c4f9 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,8 @@ - [4. Contributing](#4-contributing) - [4.1. Work Flow](#41-work-flow) - [5. Version History](#5-version-history) - - [5.1. v0.1](#51-v01) + - [5.1. v0.x](#51-v0x) + - [5.2. v0.1](#52-v01) # 1. Introduction This is a port of G4KLX Jonathan Naylor's [ircddbGateway](https://github.com/g4klx/ircDDBGateway). It is wxWidgets free and has minimal dependencies to boost (header libs only), libconfig++ and libcurl @@ -74,5 +75,7 @@ sudo systemctl stop dstargateway.service I Use [Git flow](https://danielkummer.github.io/git-flow-cheatsheet/) as my workflow. PR are welcome and shall be done against the develop branch and follow the Git Flow branch naming rules. # 5. Version History -## 5.1. v0.1 +## 5.1. v0.x +- Code sanitization +## 5.2. v0.1 First working version \ No newline at end of file diff --git a/RingBuffer.h b/RingBuffer.h index 143864e..3182382 100644 --- a/RingBuffer.h +++ b/RingBuffer.h @@ -22,8 +22,7 @@ #include #include - -#include "MutexLocker.h" +#include template class CRingBuffer { public: @@ -48,7 +47,7 @@ public: void addData(const T data) { - CMutexLocker locker(&m_mutex); + std::lock_guard locker(m_mutex); m_buffer[m_iPtr++] = data; @@ -58,7 +57,7 @@ public: T getData() { - CMutexLocker locker(&m_mutex); + std::lock_guard locker(m_mutex); if (m_iPtr == m_oPtr) return NULL; @@ -73,7 +72,7 @@ public: void clear() { - CMutexLocker locker(&m_mutex); + std::lock_guard locker(m_mutex); m_iPtr = 0U; m_oPtr = 0U; @@ -83,14 +82,14 @@ public: bool empty() { - CMutexLocker locker(&m_mutex); + std::lock_guard locker(m_mutex); return m_iPtr == m_oPtr; } T peek() { - CMutexLocker locker(&m_mutex); + std::lock_guard locker(m_mutex); if (m_iPtr == m_oPtr) return NULL; @@ -103,7 +102,7 @@ private: T* m_buffer; volatile unsigned int m_iPtr; volatile unsigned int m_oPtr; - recursive_mutex m_mutex; + std::recursive_mutex m_mutex; }; #endif \ No newline at end of file