gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] [SCM] Gnash branch, master, updated. 8921362c3181647d649f


From: Benjamin Wolsey
Subject: [Gnash-commit] [SCM] Gnash branch, master, updated. 8921362c3181647d649f739c8e18cde403dbc9b2
Date: Tue, 04 Jan 2011 16:57:48 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnash".

The branch, master has been updated
       via  8921362c3181647d649f739c8e18cde403dbc9b2 (commit)
       via  06d38ce5e8b854b426ceddd4396415420277545a (commit)
       via  71e9b6d1ec5c23597417815a063cb470cd55e94a (commit)
       via  9084eaa893cd671df2c40346d00841969e2449ef (commit)
       via  fa5c20f555e464cf5a2ab80ca8f8e1f1692b04f8 (commit)
      from  6d86dd8cb9d567d8a6cedac301850c7349fe0ced (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit//commit/?id=8921362c3181647d649f739c8e18cde403dbc9b2


commit 8921362c3181647d649f739c8e18cde403dbc9b2
Author: Benjamin Wolsey <address@hidden>
Date:   Tue Jan 4 17:34:24 2011 +0100

    Add window return.

diff --git a/libbase/SharedMem.cpp b/libbase/SharedMem.cpp
index c01ca4e..f73776d 100644
--- a/libbase/SharedMem.cpp
+++ b/libbase/SharedMem.cpp
@@ -154,7 +154,9 @@ SharedMem::attach()
     log_debug("Using shared memory key %s",
             boost::io::group(std::hex, std::showbase, _shmkey));
 
-#ifndef _WIN32
+#ifdef _WIN32
+    return false;
+#else
 
     // First get semaphore.
     

http://git.savannah.gnu.org/cgit//commit/?id=06d38ce5e8b854b426ceddd4396415420277545a


commit 06d38ce5e8b854b426ceddd4396415420277545a
Author: Benjamin Wolsey <address@hidden>
Date:   Tue Jan 4 16:02:19 2011 +0100

    Fix warning.

diff --git a/gui/gnash.cpp b/gui/gnash.cpp
index 5498eaa..4407e94 100644
--- a/gui/gnash.cpp
+++ b/gui/gnash.cpp
@@ -46,6 +46,7 @@
 #include "GnashException.h"
 #include "revno.h"
 #include "MediaHandler.h"
+#include "utility.h"
 
 using std::endl;
 using std::cout;
@@ -322,6 +323,10 @@ setupSoundAndRendering(gnash::Player& p, int i)
 po::options_description
 getDebuggingOptions(gnash::Player& p)
 {
+#ifndef GNASH_FPS_DEBUG
+    UNUSED(p);
+#endif
+
     using gnash::Player;
     using gnash::LogFile;
     using gnash::RcInitFile;
@@ -356,7 +361,6 @@ getDebuggingOptions(gnash::Player& p)
         _("Print FPS every num seconds"))
 #endif 
 
-
     ;
 
     return desc;

http://git.savannah.gnu.org/cgit//commit/?id=71e9b6d1ec5c23597417815a063cb470cd55e94a


commit 71e9b6d1ec5c23597417815a063cb470cd55e94a
Author: Benjamin Wolsey <address@hidden>
Date:   Tue Jan 4 16:01:28 2011 +0100

    Change UNUSED macro to work on references and other non-assignable
    cases.

diff --git a/libbase/utility.h b/libbase/utility.h
index f2e1d3d..8364bf0 100644
--- a/libbase/utility.h
+++ b/libbase/utility.h
@@ -153,9 +153,9 @@ inline unsigned long int /* pthread_t */ get_thread_id(void)
 } // namespace gnash
 
 // Handy macro to quiet compiler warnings about unused parameters/variables.
-#define UNUSED(x) (x) = (x)
+#define UNUSED(x) static_cast<void>((x))
 
-#endif // _GNASH_UTILITY_H
+#endif 
 
 
 // Local Variables:

http://git.savannah.gnu.org/cgit//commit/?id=9084eaa893cd671df2c40346d00841969e2449ef


commit 9084eaa893cd671df2c40346d00841969e2449ef
Author: Benjamin Wolsey <address@hidden>
Date:   Tue Jan 4 14:00:31 2011 +0100

    Simplify ifdefs.

diff --git a/libbase/SharedMem.cpp b/libbase/SharedMem.cpp
index d51412a..c01ca4e 100644
--- a/libbase/SharedMem.cpp
+++ b/libbase/SharedMem.cpp
@@ -26,18 +26,9 @@
 #include <vector>
 #include <cerrno>
 #include <cstring>
-#include <sys/types.h>
-#if !defined(HAVE_WINSOCK_H) && !defined(__riscos__) && !defined(__OS2__) && 
!defined(HAIKU_HOST) && !defined(ANDROID)
-# include <sys/shm.h>
-# include <sys/sem.h>
-# include <sys/ipc.h>
-#elif !defined(__riscos__) && !defined(__OS2__) && !defined(ANDROID)
-# include <windows.h>
-# include <process.h>
-# include <io.h>
-#endif
 
-#ifdef ANDROID
+#if defined(ANDROID)
+# include <sys/types.h>
 # include <linux/shm.h>
 # include <linux/sem.h>
 extern int shmctl (int __shmid, int __cmd, struct shmid_ds *__buf);
@@ -47,6 +38,15 @@ extern int shmdt (__const void *__shmaddr);
 extern void *shmat (int __shmid, __const void *__shmaddr, int __shmflg);
 extern int shmget (key_t __key, size_t __size, int __shmflg);
 extern int semctl (int __semid, int __semnum, int __cmd, ...);
+#elif defined(WIN32)
+# include <windows.h>
+# include <process.h>
+# include <io.h>
+#elif !defined(__riscos__) && !defined(__OS2__) && !defined(HAIKU_HOST)
+# include <sys/types.h>
+# include <sys/shm.h>
+# include <sys/sem.h>
+# include <sys/ipc.h>
 #endif
 
 #include "log.h"

http://git.savannah.gnu.org/cgit//commit/?id=fa5c20f555e464cf5a2ab80ca8f8e1f1692b04f8


commit fa5c20f555e464cf5a2ab80ca8f8e1f1692b04f8
Author: Benjamin Wolsey <address@hidden>
Date:   Tue Jan 4 13:29:03 2011 +0100

    Const correct and simplify ifdefs.

diff --git a/libbase/SharedMem.cpp b/libbase/SharedMem.cpp
index 5687121..d51412a 100644
--- a/libbase/SharedMem.cpp
+++ b/libbase/SharedMem.cpp
@@ -90,6 +90,7 @@ SharedMem::~SharedMem()
         log_error("Error during stat of shared memory segment: %s",
                 std::strerror(err));
     }
+
 #ifndef __amigaos4__
     else {
         // Note that this isn't completely reliable.
@@ -99,17 +100,18 @@ SharedMem::~SharedMem()
         }
     }
 #endif
+
 #else
     // Windows code here.
 #endif
 }
 
 bool
-SharedMem::lock()
+SharedMem::lock() const
 {
 #ifndef _WIN32
     struct sembuf sb = { 0, -1, SEM_UNDO };
-    int ret = semop(_semid, &sb, 1);
+    const int ret = ::semop(_semid, &sb, 1);
     return ret >= 0;
 #else
     // Windows code here.
@@ -118,11 +120,11 @@ SharedMem::lock()
 }
 
 bool
-SharedMem::unlock()
+SharedMem::unlock() const
 {
 #ifndef _WIN32
     struct sembuf sb = { 0, 1, SEM_UNDO };
-    int ret = semop(_semid, &sb, 1);
+    const int ret = ::semop(_semid, &sb, 1);
     return ret >= 0;
 #else
     // Windows code here
@@ -133,7 +135,9 @@ SharedMem::unlock()
 bool
 SharedMem::attach()
 {
-#if ENABLE_SHARED_MEM
+#if !ENABLE_SHARED_MEM
+# error "You need SYSV Shared memory support to use this option"
+#endif
     
     // Don't try to attach twice.
     if (_addr) return true;
@@ -154,6 +158,9 @@ SharedMem::attach()
 
     // First get semaphore.
     
+    // Check if it exists already.
+    _semid = ::semget(_shmkey, 1, 0600);
+
 #ifndef __amigaos4__
     // Struct for semctl
     union semun {
@@ -163,15 +170,12 @@ SharedMem::attach()
     };
 #endif
 
-    // Check if it exists already.
-    _semid = semget(_shmkey, 1, 0600);
-    
     semun s;
 
     // If it does not exist, create it and set its value to 1.
     if (_semid < 0) {
 
-        _semid = semget(_shmkey, 1, IPC_CREAT | 0600);
+        _semid = ::semget(_shmkey, 1, IPC_CREAT | 0600);
         
         if (_semid < 0) {
             log_error("Failed to get semaphore for shared memory!");
@@ -179,7 +183,7 @@ SharedMem::attach()
         }    
 
         s.val = 1;
-        int ret = semctl(_semid, 0, SETVAL, s);
+        const int ret = ::semctl(_semid, 0, SETVAL, s);
         if (ret < 0) {
             log_error("Failed to set semaphore value");
             return false;
@@ -188,7 +192,7 @@ SharedMem::attach()
     
     // The 4th argument is neither necessary nor used, but we pass it
     // anyway for fun.
-    int semval = semctl(_semid, 0, GETVAL, s);
+    const int semval = ::semctl(_semid, 0, GETVAL, s);
 
     if (semval != 1) {
         log_error("Need semaphore value of 1 for locking. Cannot "
@@ -199,11 +203,11 @@ SharedMem::attach()
     Lock lock(*this);
 
     // Then attach shared memory. See if it exists.
-    _shmid = shmget(_shmkey, _size, 0600);
+    _shmid = ::shmget(_shmkey, _size, 0600);
 
     // If not create it.
     if (_shmid < 0) {
-        _shmid = shmget(_shmkey, _size, IPC_CREAT | 0660);
+        _shmid = ::shmget(_shmkey, _size, IPC_CREAT | 0660);
     }
 
     if (_shmid < 0) {
@@ -211,7 +215,7 @@ SharedMem::attach()
         return false;
     }
 
-    _addr = static_cast<iterator>(shmat(_shmid, 0, 0));
+    _addr = static_cast<iterator>(::shmat(_shmid, 0, 0));
 
     if (!_addr) {
         log_error("Unable to attach shared memory: %s",
@@ -219,30 +223,8 @@ SharedMem::attach()
         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 = static_cast<iterator>(MapViewOfFile(_shmhandle, 
FILE_MAP_ALL_ACCESS,
-            0, 0, _size));
-
-    if (!_addr) {
-        log_debug("WARNING: MapViewOfFile() failed: %ld\n", GetLastError());
-        return false;
-    }
-#endif
-
     assert(_addr);
     return true;
-
-
-#else
-# error "You need SYSV Shared memory support to use this option"
 #endif
 }
 
diff --git a/libbase/SharedMem.h b/libbase/SharedMem.h
index 6218c83..1b66fdf 100644
--- a/libbase/SharedMem.h
+++ b/libbase/SharedMem.h
@@ -56,8 +56,6 @@ const int MAP_INHERIT = 0;
 const int MAP_HASSEMAPHORE = 0;
 #endif
 
-const int MAX_SHM_NAME_SIZE = 48;
-
 class SharedMem
 {
 public:
@@ -99,13 +97,13 @@ public:
     class Lock
     {
     public:
-        Lock(SharedMem& s) : _s(s), _locked(s.lock()) {}
+        Lock(const SharedMem& s) : _s(s), _locked(s.lock()) {}
         ~Lock() { if (_locked) _s.unlock(); }
         bool locked() const {
             return _locked;
         }
     private:
-        SharedMem& _s;
+        const SharedMem& _s;
         bool _locked;
     };
 
@@ -114,12 +112,12 @@ private:
     /// Get a semaphore lock if possible
     //
     /// @return     true if successful, false if not.
-    DSOEXPORT bool lock();
+    DSOEXPORT bool lock() const;
     
     /// Release a semaphore lock if possible
     //
     /// @return     true if successful, false if not.
-    DSOEXPORT bool unlock();
+    DSOEXPORT bool unlock() const;
 
     iterator _addr;
 

-----------------------------------------------------------------------

Summary of changes:
 gui/gnash.cpp         |    6 +++-
 libbase/SharedMem.cpp |   80 +++++++++++++++++++-----------------------------
 libbase/SharedMem.h   |   10 ++----
 libbase/utility.h     |    4 +-
 4 files changed, 43 insertions(+), 57 deletions(-)


hooks/post-receive
-- 
Gnash



reply via email to

[Prev in Thread] Current Thread [Next in Thread]