13
0

Remaining changes needed for building libpdb on Windows (except for adding the extra JE source modules)

This commit is contained in:
John Emmas 2013-07-17 08:08:46 +01:00
parent 105652ad09
commit 350ed31655
15 changed files with 40 additions and 34 deletions

View 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());

View 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 */

View File

@ -94,7 +94,7 @@ mountpoint (string path)
return best;
}
#elif defined(WIN32)
#elif defined(PLATFORM_WINDOWS)
string
mountpoint (string path)

View 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

View 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;

View 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)
{

View 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 ();

View 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);

View 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 = ":";

View 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 ()

View 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);

View 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

View 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
}
}

View File

@ -20,10 +20,8 @@
#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());
}

View 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&