X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fmidi%2B%2B2%2Fipmidi_port.cc;h=567df99335e4c41a7d4cc167e1c13d081189eca8;hb=a882e96db1367c26660fd3d3079e9e3e19b1e149;hp=50777634f1146d88d2d0ffbebeb37d17e69b3bee;hpb=d5e14b3d9144400fb8026fb9783a5a8582c0ad87;p=ardour.git diff --git a/libs/midi++2/ipmidi_port.cc b/libs/midi++2/ipmidi_port.cc index 50777634f1..567df99335 100644 --- a/libs/midi++2/ipmidi_port.cc +++ b/libs/midi++2/ipmidi_port.cc @@ -25,9 +25,17 @@ #include #include #include +#ifdef COMPILER_MSVC +#undef O_NONBLOCK +#define O_NONBLOCK 0 +#endif +#if defined(PLATFORM_WINDOWS) +#include +#else #include +#endif -#if defined(WIN32) +#if defined(PLATFORM_WINDOWS) static WSADATA g_wsaData; typedef int socklen_t; #else @@ -36,9 +44,6 @@ typedef int socklen_t; inline void closesocket(int s) { ::close(s); } #endif -#include -#include - #include "pbd/xml++.h" #include "pbd/error.h" #include "pbd/failed_constructor.h" @@ -112,7 +117,7 @@ get_address (int sock, struct in_addr *inaddr, const string& ifname ) { // Get interface address from supplied name. -#if !defined(WIN32) +#if !defined(PLATFORM_WINDOWS) struct ifreq ifr; ::strncpy(ifr.ifr_name, ifname.c_str(), sizeof(ifr.ifr_name)); @@ -141,12 +146,13 @@ get_address (int sock, struct in_addr *inaddr, const string& ifname ) return false; -#endif // !WIN32 +#endif // !PLATFORM_WINDOWS' } bool IPMIDIPort::open_sockets (int base_port, const string& ifname) { +#if !defined(PLATFORM_WINDOWS) int protonum = 0; struct protoent *proto = ::getprotobyname("IP"); @@ -243,14 +249,17 @@ IPMIDIPort::open_sockets (int base_port, const string& ifname) } return true; +#else + return false; +#endif // !PLATFORM_WINDOWS' } int -IPMIDIPort::write (byte* msg, size_t msglen, timestamp_t /* ignored */) { +IPMIDIPort::write (const MIDI::byte* msg, size_t msglen, timestamp_t /* ignored */) { if (sockout) { - Glib::Mutex::Lock lm (write_lock); - if (::sendto (sockout, (char *) msg, msglen, 0, (struct sockaddr *) &addrout, sizeof(struct sockaddr_in)) < 0) { + Glib::Threads::Mutex::Lock lm (write_lock); + if (::sendto (sockout, (const char *) msg, msglen, 0, (struct sockaddr *) &addrout, sizeof(struct sockaddr_in)) < 0) { ::perror("sendto"); return -1; } @@ -260,7 +269,7 @@ IPMIDIPort::write (byte* msg, size_t msglen, timestamp_t /* ignored */) { } int -IPMIDIPort::read (byte* buf, size_t bufsize) +IPMIDIPort::read (MIDI::byte* /*buf*/, size_t /*bufsize*/) { /* nothing to do here - all handled by parse() */ return 0;