[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash/libbase rc.h shm.cpp
From: |
Dossy Shiobara |
Subject: |
[Gnash-commit] gnash/libbase rc.h shm.cpp |
Date: |
Sat, 22 Mar 2008 02:33:38 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Dossy Shiobara <dossy> 08/03/22 02:33:38
Modified files:
libbase : rc.h shm.cpp
Log message:
Win32 lacks sys/shm.h, so define key_t on Win32 as
boost::uint32_t.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/rc.h?cvsroot=gnash&r1=1.48&r2=1.49
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/shm.cpp?cvsroot=gnash&r1=1.6&r2=1.7
Patches:
Index: rc.h
===================================================================
RCS file: /sources/gnash/gnash/libbase/rc.h,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -b -r1.48 -r1.49
--- rc.h 10 Mar 2008 08:19:40 -0000 1.48
+++ rc.h 22 Mar 2008 02:33:38 -0000 1.49
@@ -28,9 +28,14 @@
#include <string>
#include <vector>
#include <iostream>
-#include <sys/shm.h> // for key_t
#include <boost/cstdint.hpp>
+#ifndef _WIN32
+#include <sys/shm.h>
+#else
+typedef boost::uint32_t key_t;
+#endif // _WIN32
+
namespace gnash {
class DSOEXPORT RcInitFile
Index: shm.cpp
===================================================================
RCS file: /sources/gnash/gnash/libbase/shm.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- shm.cpp 19 Feb 2008 19:20:50 -0000 1.6
+++ shm.cpp 22 Mar 2008 02:33:38 -0000 1.7
@@ -88,8 +88,7 @@
{
// GNASH_REPORT_FUNCTION;
-#if defined(USE_SYSV_SHM) && defined(HAVE_SHMGET)
- const int shmflg = 0660 | IPC_CREAT;
+#if (defined(USE_SYSV_SHM) && defined(HAVE_SHMGET)) || defined(_WIN32)
// this is the magic size of shared memory segments used by the other
flash player;
_size = 64528;
// this is the magic shared memory key used by the other player.
@@ -105,6 +104,10 @@
_shmkey = 0xdd3adabd;
}
+#ifndef _WIN32
+ {
+ const int shmflg = 0660 | IPC_CREAT;
+
_shmfd = shmget(_shmkey, _size, shmflg);
if (_shmfd < 0 && errno == EEXIST) {
// Get the shared memory id for this segment
@@ -115,6 +118,21 @@
log_debug("WARNING: shmat() failed: %s\n", strerror(errno));
return false;
}
+ }
+#else
+ _shmhandle = CreateFileMapping((HANDLE) 0xFFFFFFFF, NULL,
+ PAGE_READWRITE, 0, _size, NULL);
+ if (_shmhandle == NULL) {
+ log_debug("WARNING: CreateFileMapping failed: %ld\n", GetLastError());
+ return false;
+ }
+ _addr = (char *) MapViewOfFile(_shmhandle, FILE_MAP_ALL_ACCESS,
+ 0, 0, _size);
+ if (_addr == NULL) {
+ log_debug("WARNING: MapViewOfFile() failed: %ld\n", GetLastError());
+ return false;
+ }
+#endif
return true;
#else
@@ -220,6 +238,7 @@
_shmfd = shm_open(filespec, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR);
#else
# ifdef USE_SYSV_SHM
+# ifdef HAVE_SHMGET
// Get the shared memory id for this segment
_shmfd = shmget(_shmkey, _size, 0);
# else
@@ -230,7 +249,10 @@
PAGE_READWRITE, 0,
_size, filespec);
# endif
-#endif
+# endif
+# else
+# error "You need SYSV Shared memory support to use this option"
+# endif
#endif
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash/libbase rc.h shm.cpp,
Dossy Shiobara <=