diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2013-11-03 21:34:49 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2013-11-03 21:34:49 +0100 |
commit | bbaefce3a90b3c45f23e494f76ed15fa9a00d5e8 (patch) | |
tree | 28ef5677081348be4a3addf8e28028990245cd4b /compat | |
parent | cc9b496e2de68b983dbc5fde27a1379cc9602a35 (diff) |
fix apple build
Diffstat (limited to 'compat')
-rw-r--r-- | compat/compat.cpp | 19 | ||||
-rw-r--r-- | compat/compat.h | 3 |
2 files changed, 8 insertions, 14 deletions
diff --git a/compat/compat.cpp b/compat/compat.cpp index bcdbd17f..7b695617 100644 --- a/compat/compat.cpp +++ b/compat/compat.cpp @@ -6,8 +6,7 @@ */ #define IN_FTNOIR_COMPAT #include "compat.h" -#include <string> -#include <sstream> +#include <string.h> #if defined(_WIN32) @@ -48,17 +47,11 @@ void PortableLockedShm::unlock() #else PortableLockedShm::PortableLockedShm(const char *shmName, const char* /*mutexName*/, int mapSize) : size(mapSize) { - std::string filename; - filename.append("/"); - filename.append(shmName); - //(void) shm_unlink(shm_filename); - - fd = shm_open(filename.c_str(), O_RDWR | O_CREAT, 0600); - if (ftruncate(fd, mapSize) == 0) { ;; } - else { - fprintf(stderr, "oh, bother, ftruncate: %s\n", strerror(errno)); - //mem = (void*) -1; - } + char filename[512] = {0}; + strcpy(filename, "/"); + strcat(filename, shmName); + fd = shm_open(filename, O_RDWR | O_CREAT, 0600); + (void) ftruncate(fd, mapSize); mem = mmap(NULL, mapSize, PROT_READ|PROT_WRITE, MAP_SHARED, fd, (off_t)0); } diff --git a/compat/compat.h b/compat/compat.h index 8c307b14..60395830 100644 --- a/compat/compat.h +++ b/compat/compat.h @@ -7,7 +7,8 @@ #pragma once #if defined(_WIN32) -#include <windows.h> +#include <winbase.h> +#include <winreg.h> #else #include <stdio.h> #include <string.h> |