summaryrefslogtreecommitdiff
path: root/libs/midi++2/ipmidi_port.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2014-01-10 16:07:57 -0500
committerPaul Davis <paul@linuxaudiosystems.com>2014-01-10 16:07:57 -0500
commit3020b224fa2d6e1b6b8a576e8e8e211e0585f2a2 (patch)
tree314c3099bcc57d9af09d249e1e7dd8e45baca642 /libs/midi++2/ipmidi_port.cc
parentd15fda6d751a465d278f477923075d4783f3b1ca (diff)
parent897fbdc652434d3aa1e67223c3c3ef7ae9be2318 (diff)
Merge windows+cc branch into cairocanvas branch. Not finished, need to now merge windows branch to get changes from there
Diffstat (limited to 'libs/midi++2/ipmidi_port.cc')
-rw-r--r--libs/midi++2/ipmidi_port.cc22
1 files changed, 17 insertions, 5 deletions
diff --git a/libs/midi++2/ipmidi_port.cc b/libs/midi++2/ipmidi_port.cc
index c4544c237b..567df99335 100644
--- a/libs/midi++2/ipmidi_port.cc
+++ b/libs/midi++2/ipmidi_port.cc
@@ -25,9 +25,17 @@
#include <errno.h>
#include <stdlib.h>
#include <string.h>
+#ifdef COMPILER_MSVC
+#undef O_NONBLOCK
+#define O_NONBLOCK 0
+#endif
+#if defined(PLATFORM_WINDOWS)
+#include <winsock2.h>
+#else
#include <netdb.h>
+#endif
-#if defined(WIN32)
+#if defined(PLATFORM_WINDOWS)
static WSADATA g_wsaData;
typedef int socklen_t;
#else
@@ -109,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));
@@ -138,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");
@@ -240,10 +249,13 @@ IPMIDIPort::open_sockets (int base_port, const string& ifname)
}
return true;
+#else
+ return false;
+#endif // !PLATFORM_WINDOWS'
}
int
-IPMIDIPort::write (const byte* msg, size_t msglen, timestamp_t /* ignored */) {
+IPMIDIPort::write (const MIDI::byte* msg, size_t msglen, timestamp_t /* ignored */) {
if (sockout) {
Glib::Threads::Mutex::Lock lm (write_lock);
@@ -257,7 +269,7 @@ IPMIDIPort::write (const 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;