summaryrefslogtreecommitdiffhomepage
path: root/compat
diff options
context:
space:
mode:
Diffstat (limited to 'compat')
-rw-r--r--compat/compat.cpp19
-rw-r--r--compat/compat.h3
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>