Remaining changes needed for building libpdb on Windows (except for adding the extra...
authorJohn Emmas <johne53@tiscali.co.uk>
Wed, 17 Jul 2013 07:08:46 +0000 (08:08 +0100)
committerJohn Emmas <johne53@tiscali.co.uk>
Wed, 17 Jul 2013 07:08:46 +0000 (08:08 +0100)
15 files changed:
libs/pbd/base_ui.cc
libs/pbd/file_utils.cc
libs/pbd/mountpoint.cc
libs/pbd/pbd/base_ui.h
libs/pbd/pbd/ringbuffer.h
libs/pbd/pbd/semaphore.h
libs/pbd/pbd/semutils.h
libs/pbd/resource.cc
libs/pbd/search_path.cc
libs/pbd/semutils.cc
libs/pbd/test/filesystem_test.cc
libs/pbd/test/test_common.cc
libs/pbd/transmitter.cc
libs/pbd/uuid.cc
libs/pbd/xml++.cc

index 4bd3d235141ee933c9bfc94f67583f32094865a4..3a4257ebdd9a9ecaf9bfc1109277543588e73427 100644 (file)
@@ -51,13 +51,13 @@ BaseUI::BaseUI (const string& str)
        : m_context(MainContext::get_default())
        , run_loop_thread (0)
        , _name (str)
-#ifndef WIN32
+#ifndef PLATFORM_WINDOWS
        , request_channel (true)
 #endif
 {
        base_ui_instance = this;
 
-#ifndef WIN32
+#ifndef PLATFORM_WINDOWS
        request_channel.ios()->connect (sigc::mem_fun (*this, &BaseUI::request_handler));
 #endif
 
@@ -124,7 +124,7 @@ BaseUI::quit ()
        }
 }
 
-#ifdef WIN32
+#ifdef PLATFORM_WINDOWS
 gboolean
 BaseUI::_request_handler (gpointer data)
 {
@@ -172,7 +172,7 @@ void
 BaseUI::signal_new_request ()
 {
        DEBUG_TRACE (DEBUG::EventLoop, "BaseUI::signal_new_request\n");
-#ifdef WIN32
+#ifdef PLATFORM_WINDOWS
        // handled in timeout, how to signal...?
 #else
        request_channel.wakeup ();
@@ -186,7 +186,7 @@ void
 BaseUI::attach_request_source ()
 {
        DEBUG_TRACE (DEBUG::EventLoop, "BaseUI::attach_request_source\n");
-#ifdef WIN32
+#ifdef PLATFORM_WINDOWS
        GSource* request_source = g_timeout_source_new(200);
        g_source_set_callback (request_source, &BaseUI::_request_handler, this, NULL);
        g_source_attach (request_source, m_context->gobj());
index 311a3948efd132d29bd97cba67bde7ee787a7706..03c3ea853c18655a3322735d2bd6159f86911f88 100644 (file)
@@ -192,9 +192,9 @@ get_absolute_path (const std::string & p)
 bool
 equivalent_paths (const std::string& a, const std::string& b)
 {
-       struct stat bA;
+       GStatBuf bA;
        int const rA = g_stat (a.c_str(), &bA);
-       struct stat bB;
+       GStatBuf bB;
        int const rB = g_stat (b.c_str(), &bB);
 
        return (rA == 0 && rB == 0 && bA.st_dev == bB.st_dev && bA.st_ino == bB.st_ino);
@@ -225,7 +225,7 @@ exists_and_writable (const std::string & p)
           make us unwritable.
        */
 
-       struct stat statbuf;
+       GStatBuf statbuf;
 
        if (g_stat (p.c_str(), &statbuf) != 0) {
                /* doesn't exist - not writable */
index 9c05f05ad6b5b096dbde71898094fc4363372351..65f011c745efa0de2f005366d3de4214985073ee 100644 (file)
@@ -94,7 +94,7 @@ mountpoint (string path)
        return best;
 }
 
-#elif defined(WIN32)
+#elif defined(PLATFORM_WINDOWS)
 
 string
 mountpoint (string path)
index 686af485e6fd50e0deaf566a375d69c35b8e4e57..d947a06b34046a93e8530d7f92ce4ffdb4d24efc 100644 (file)
@@ -92,7 +92,7 @@ class BaseUI : public sigc::trackable, public PBD::EventLoop
 
        virtual void thread_init () {};
 
-#ifdef WIN32
+#ifdef PLATFORM_WINDOWS
        static gboolean _request_handler (gpointer);
        bool request_handler ();
 #else
@@ -114,7 +114,7 @@ class BaseUI : public sigc::trackable, public PBD::EventLoop
        std::string _name; 
        BaseUI* base_ui_instance;
 
-#ifndef WIN32
+#ifndef PLATFORM_WINDOWS
        CrossThreadChannel request_channel;
 #endif
        
index f14fa7185184356d154f40da1a134446d0200bb0..a1a615154261037885d2d48ab659b74be9bddda0 100644 (file)
@@ -198,7 +198,7 @@ RingBuffer<T>::write (T const *src, guint cnt)
 }
 
 template<class T> void
-RingBuffer<T>::get_read_vector (RingBuffer<T>::rw_vector *vec)
+RingBuffer<T>::get_read_vector (typename RingBuffer<T>::rw_vector *vec)
 
 {
        guint free_cnt;
@@ -238,7 +238,7 @@ RingBuffer<T>::get_read_vector (RingBuffer<T>::rw_vector *vec)
 }
 
 template<class T> void
-RingBuffer<T>::get_write_vector (RingBuffer<T>::rw_vector *vec)
+RingBuffer<T>::get_write_vector (typename RingBuffer<T>::rw_vector *vec)
 
 {
        guint free_cnt;
index 81c4057e6a2d1910bec4edb102598d75d90e3f01..5f0a2df2c0023a9304e39c97edfa371b6560b835 100644 (file)
@@ -69,7 +69,7 @@ public:
 private:
 #if defined(__APPLE__)
        semaphore_t _sem;  // sem_t is a worthless broken mess on OSX
-#elif defined(_WIN32)
+#elif defined(PLATFORM_WINDOWS)
        HANDLE _sem;  // types are overrated anyway
 #else
        sem_t _sem;
@@ -114,7 +114,7 @@ Semaphore::try_wait()
        return semaphore_timedwait(_sem, zero) == KERN_SUCCESS;
 }
 
-#elif defined(_WIN32)
+#elif defined(PLATFORM_WINDOWS)
 
 inline
 Semaphore::Semaphore(unsigned initial)
@@ -151,7 +151,7 @@ Semaphore::try_wait()
        return WaitForSingleObject(_sem, 0) == WAIT_OBJECT_0;
 }
 
-#else  /* !defined(__APPLE__) && !defined(_WIN32) */
+#else  /* !defined(__APPLE__) && !defined(PLATFORM_WINDOWS) */
 
 Semaphore::Semaphore(unsigned initial)
 {
index 0e8bed0512678c20026efd95be668e2f44cc0c3f..af5c201b8557a1617c2653ab23fe8edb554e74dd 100644 (file)
@@ -19,7 +19,7 @@
 #ifndef __pbd_semutils_h__
 #define __pbd_semutils_h__
 
-#ifdef WIN32
+#ifdef PLATFORM_WINDOWS
 #include <windows.h>
 #else
 #include <semaphore.h>
@@ -29,7 +29,7 @@ namespace PBD {
 
 class ProcessSemaphore {
   private:
-#ifdef WIN32
+#ifdef PLATFORM_WINDOWS
        HANDLE _sem;
 
 #elif __APPLE__
@@ -44,7 +44,7 @@ class ProcessSemaphore {
        ProcessSemaphore (const char* name, int val);
        ~ProcessSemaphore ();
 
-#ifdef WIN32
+#ifdef PLATFORM_WINDOWS
 
        int signal ();
        int wait ();
index 5ee6f6dc88292f7fcdcfa6292a95287366edab39..9d6f8b17465a25dc019f376871bf53774667fb13 100644 (file)
@@ -33,7 +33,7 @@ get_resource_limit (ResourceType resource, ResourceLimit& limit)
 {
        if (resource == OpenFiles)
        {
-#ifdef WIN32
+#ifdef PLATFORM_WINDOWS
                limit.current_limit = _getmaxstdio();
                limit.max_limit = 2048;
                return true;
@@ -55,7 +55,7 @@ set_resource_limit (ResourceType resource, const ResourceLimit& limit)
 {
        if (resource == OpenFiles)
        {
-#ifdef WIN32
+#ifdef PLATFORM_WINDOWS
                // no soft and hard limits on windows
                rlimit_t new_max = _setmaxstdio(limit.current_limit);
 
index 3f7be5aa56d7c2d1aa0db51b088724f81675666a..e56e22fee391a3f4c0d1c35be0178371b8c7ab05 100644 (file)
@@ -27,7 +27,7 @@ using namespace std;
 
 namespace {
 
-#ifdef WIN32
+#ifdef PLATFORM_WINDOWS
 const char * const path_delimiter = ";";
 #else
 const char * const path_delimiter = ":";
index e5df2e5c442348082d22a820af2c6959c6415a03..e5e5898218aad97b34cf259a326b55a668f8fecb 100644 (file)
@@ -23,7 +23,7 @@ using namespace PBD;
 
 ProcessSemaphore::ProcessSemaphore (const char* name, int val)
 {
-#ifdef WIN32
+#ifdef PLATFORM_WINDOWS
        if ((_sem = CreateSemaphore(NULL, val, 32767, name)) == NULL) {
                throw failed_constructor ();
        }
@@ -48,14 +48,14 @@ ProcessSemaphore::ProcessSemaphore (const char* name, int val)
 
 ProcessSemaphore::~ProcessSemaphore ()
 {
-#ifdef WIN32
+#ifdef PLATFORM_WINDOWS
        CloseHandle(_sem);
 #elif __APPLE__
        sem_close (ptr_to_sem());
 #endif
 }
 
-#ifdef WIN32
+#ifdef PLATFORM_WINDOWS
 
 int
 ProcessSemaphore::signal ()
index 0cbe5baf32badce127294f6cad986b978895260a..458105d1779286fd3364b6d2de28a19cb42b292a 100644 (file)
@@ -10,7 +10,7 @@ CPPUNIT_TEST_SUITE_REGISTRATION (FilesystemTest);
 void
 FilesystemTest::testPathIsWithin ()
 {
-#ifndef WIN32
+#ifndef PLATFORM_WINDOWS
        system ("rm -r foo");
        CPPUNIT_ASSERT (g_mkdir_with_parents ("foo/bar/baz", 0755) == 0);
 
index 16da3ed2a8f6c06ab7683363f3af7c0fd426284e..397a69ad8c4c515dbf4038a33d4e557b4db4724e 100644 (file)
@@ -28,7 +28,7 @@
 PBD::SearchPath
 test_search_path ()
 {
-#ifdef WIN32
+#ifdef PLATFORM_WINDOWS
        std::string wsp(g_win32_get_package_installation_directory_of_module(NULL));
        return Glib::build_filename (wsp,  "pbd_testdata");
 #else
index a172ac457db757768c29c8f90745822de293211d..e4266d34d7d6787d8afa37c177ed94662bdfca9c 100644 (file)
@@ -84,14 +84,20 @@ Transmitter::deliver ()
        /* do the right thing if this should not return */
        
        if (does_not_return()) {
-#ifndef WIN32
+#ifndef PLATFORM_WINDOWS
+// TODO !!!! Commented out temporarily (for Windows)
                sigset_t mask;
                
                sigemptyset (&mask);
                sigsuspend (&mask);
-#endif
                /*NOTREACHED*/
                exit (1);
+/* JE - From what I can tell, the above code suspends
+ * program execution until (any) signal occurs. Not
+ * sure at the moment what this achieves, unless it
+ * provides some time for the user to see the message.
+ */
+#endif
        } 
 }
 
index 1a988b9820324ed55e4f40fca1fd6cd742a91d98..8b55ab338169b3b263d0bbefaf76e03e221ea47a 100644 (file)
 
 #include "pbd/uuid.h"
 
-using namespace PBD;
-
-UUID&
-UUID::operator= (std::string const & str)
+PBD::UUID&
+PBD::UUID::operator= (std::string const & str)
 {
         boost::uuids::string_generator gen;
         *((boost::uuids::uuid*) this) = gen (str);
@@ -31,7 +29,7 @@ UUID::operator= (std::string const & str)
 }
 
 std::string
-UUID::to_s () const
+PBD::UUID::to_s () const
 {
         return std::string ((const char*) data, size());
 }
index a1fa77db660b53c3ec40f1871406b863b4747a76..69187995a17fa31ca092d0e2e17990c3597ce46b 100644 (file)
@@ -167,6 +167,7 @@ XMLTree::write() const
 void
 XMLTree::debug(FILE* out) const
 {
+#ifdef LIBXML_DEBUG_ENABLED
        xmlDocPtr doc;
        XMLNodeList children;
 
@@ -176,6 +177,7 @@ XMLTree::debug(FILE* out) const
        writenode(doc, _root, doc->children, 1);
        xmlDebugDumpDocument (out, doc);
        xmlFreeDoc(doc);
+#endif
 }
 
 const string&