summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--compat/compat.cpp9
-rw-r--r--compat/compat.h4
-rw-r--r--freetrackclient/freetrackclient.c2
-rw-r--r--ftnoir_protocol_ft/ftnoir_protocol_ft.cpp4
-rw-r--r--ftnoir_protocol_ft/ftnoir_protocol_ft.h2
-rw-r--r--ftnoir_tracker_ht/ftnoir_tracker_ht.cpp2
6 files changed, 10 insertions, 13 deletions
diff --git a/compat/compat.cpp b/compat/compat.cpp
index 7b695617..b5d63f2b 100644
--- a/compat/compat.cpp
+++ b/compat/compat.cpp
@@ -4,12 +4,12 @@
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*/
+
+#include <cstring>
#define IN_FTNOIR_COMPAT
#include "compat.h"
-#include <string.h>
#if defined(_WIN32)
-
PortableLockedShm::PortableLockedShm(const char* shmName, const char* mutexName, int mapSize)
{
hMutex = CreateMutexA(NULL, false, mutexName);
@@ -43,8 +43,8 @@ void PortableLockedShm::unlock()
{
(void) ReleaseMutex(hMutex);
}
-
#else
+#pragma GCC diagnostic ignored "-Wunused-result"
PortableLockedShm::PortableLockedShm(const char *shmName, const char* /*mutexName*/, int mapSize) : size(mapSize)
{
char filename[512] = {0};
@@ -57,8 +57,6 @@ PortableLockedShm::PortableLockedShm(const char *shmName, const char* /*mutexNam
PortableLockedShm::~PortableLockedShm()
{
- //(void) shm_unlink(shm_filename);
-
(void) munmap(mem, size);
(void) close(fd);
}
@@ -72,7 +70,6 @@ void PortableLockedShm::unlock()
{
flock(fd, LOCK_UN);
}
-
#endif
bool PortableLockedShm::success()
diff --git a/compat/compat.h b/compat/compat.h
index 0e488752..490d8913 100644
--- a/compat/compat.h
+++ b/compat/compat.h
@@ -38,12 +38,12 @@ public:
void lock();
void unlock();
bool success();
- void* mem;
+ inline void* ptr() { return mem; }
private:
+ void* mem;
#if defined(_WIN32)
HANDLE hMutex, hMapFile;
#else
int fd, size;
- //char shm_filename[NAME_MAX];
#endif
};
diff --git a/freetrackclient/freetrackclient.c b/freetrackclient/freetrackclient.c
index 43694cda..5323bcae 100644
--- a/freetrackclient/freetrackclient.c
+++ b/freetrackclient/freetrackclient.c
@@ -55,7 +55,7 @@ static bool FTCreateMapping(void)
PAGE_READWRITE,
0,
sizeof(FTHeap),
- (LPCSTR) FT_MM_DATA);
+ (LPCSTR) FREETRACK_HEAP);
if (hFTMemMap == NULL)
return (pMemData = NULL), false;
diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp b/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp
index d0cbfa97..8b8be63d 100644
--- a/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp
+++ b/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp
@@ -28,9 +28,9 @@
#include "ftnoir_csv/csv.h"
FTNoIR_Protocol::FTNoIR_Protocol() :
- shm(FT_MM_DATA, FREETRACK_MUTEX, sizeof(FTHeap))
+ shm(FREETRACK_HEAP, FREETRACK_MUTEX, sizeof(FTHeap))
{
- pMemData = (FTHeap*) shm.mem;
+ pMemData = (FTHeap*) shm.ptr();
ProgramName = "";
intGameID = 0;
viewsStart = 0;
diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft.h b/ftnoir_protocol_ft/ftnoir_protocol_ft.h
index d7a792b7..dc534fda 100644
--- a/ftnoir_protocol_ft/ftnoir_protocol_ft.h
+++ b/ftnoir_protocol_ft/ftnoir_protocol_ft.h
@@ -27,7 +27,6 @@
#pragma once
#include "ui_ftnoir_ftcontrols.h"
#include "facetracknoir/plugin-api.hpp"
-#include "fttypes.h"
#include <QMessageBox>
#include <QSettings>
#include <QLibrary>
@@ -39,6 +38,7 @@
#include <QMutexLocker>
#include "compat/compat.h"
#include "facetracknoir/options.h"
+#include "fttypes.h"
using namespace options;
struct settings {
diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp
index 14d5faa1..15bf3a76 100644
--- a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp
+++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp
@@ -138,7 +138,7 @@ void Tracker::load_settings(ht_config_t* config)
Tracker::Tracker() :
lck_shm(HT_SHM_NAME, HT_MUTEX_NAME, sizeof(ht_shm_t)),
- shm(reinterpret_cast<ht_shm_t*>(lck_shm.mem)),
+ shm(reinterpret_cast<ht_shm_t*>(lck_shm.ptr())),
videoWidget(nullptr),
layout(nullptr)
{