From c7213d6593d9440516f5d901183ad6a778c4d957 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 19 Mar 2013 11:46:53 -0700 Subject: [PATCH] conditionally include winsock2.h instead of UNIX socket stuff --- domain/src/main.cpp | 18 ++++++++++-------- interface/src/SerialInterface.cpp | 10 ++++------ interface/src/SerialInterface.h | 1 + interface/src/main.cpp | 6 ++++-- mixer/src/main.cpp | 18 ++++++++++-------- shared/src/Agent.cpp | 7 ++++++- shared/src/Agent.h | 5 +++++ shared/src/AgentList.cpp | 7 ++++++- shared/src/UDPSocket.cpp | 9 +++++++-- shared/src/UDPSocket.h | 5 +++++ voxel/src/main.cpp | 16 +++++++++------- 11 files changed, 67 insertions(+), 35 deletions(-) diff --git a/domain/src/main.cpp b/domain/src/main.cpp index 3f086ca78c..434f807d28 100644 --- a/domain/src/main.cpp +++ b/domain/src/main.cpp @@ -22,19 +22,21 @@ #include #include #include -#include -#include -#include #include -#ifdef _WIN32 -#include "Systime.h" -#else -#include -#endif _WIN32 #include #include "AgentList.h" #include "SharedUtil.h" +#ifdef _WIN32 +#include "Systime.h" +#include +#else +#include +#include +#include +#include +#endif _WIN32 + const int DOMAIN_LISTEN_PORT = 40102; unsigned char packetData[MAX_PACKET_SIZE]; diff --git a/interface/src/SerialInterface.cpp b/interface/src/SerialInterface.cpp index 60a224d04c..17813ebc64 100644 --- a/interface/src/SerialInterface.cpp +++ b/interface/src/SerialInterface.cpp @@ -15,14 +15,10 @@ // #include "SerialInterface.h" -#include -#ifdef _WIN32 -#include "Systime.h" -#else -#include -#endif + #ifdef __APPLE__ #include +#include #endif int serial_fd; @@ -224,6 +220,7 @@ void SerialInterface::readData() { } void SerialInterface::resetSerial() { +#ifdef __APPLE__ active = false; totalSamples = 0; @@ -238,6 +235,7 @@ void SerialInterface::resetSerial() { for (int i = 1; i < MAX_BUFFER; i++) { serial_buffer[i] = ' '; } +#endif } diff --git a/interface/src/SerialInterface.h b/interface/src/SerialInterface.h index c943ef60a7..323966bc9f 100644 --- a/interface/src/SerialInterface.h +++ b/interface/src/SerialInterface.h @@ -17,6 +17,7 @@ #include #include #include +#include #endif #define NUM_CHANNELS 6 diff --git a/interface/src/main.cpp b/interface/src/main.cpp index 75b70ebd00..9c4209be1d 100644 --- a/interface/src/main.cpp +++ b/interface/src/main.cpp @@ -25,14 +25,16 @@ #ifdef _WIN32 #include "Systime.h" +#include #else #include +#include +#include #endif #include -#include + #include -#include #include "Field.h" #include "world.h" #include "Util.h" diff --git a/mixer/src/main.cpp b/mixer/src/main.cpp index 9dcc8f2831..b0c4566f33 100644 --- a/mixer/src/main.cpp +++ b/mixer/src/main.cpp @@ -3,15 +3,7 @@ #include #include #include -#include -#include -#include #include -#ifdef _WIN32 -#include "Systime.h" -#else -#include -#endif _WIN32 #include #include #include @@ -21,6 +13,16 @@ #include #include "AudioRingBuffer.h" +#ifdef _WIN32 +#include "Systime.h" +#include +#else +#include +#include +#include +#include +#endif _WIN32 + const unsigned short MIXER_LISTEN_PORT = 55443; const float SAMPLE_RATE = 22050.0; diff --git a/shared/src/Agent.cpp b/shared/src/Agent.cpp index cacb3a5f94..9316317d53 100644 --- a/shared/src/Agent.cpp +++ b/shared/src/Agent.cpp @@ -7,11 +7,16 @@ // #include "Agent.h" -#include #include #include "UDPSocket.h" #include "SharedUtil.h" +#ifdef _WIN32 +#include +#else +#include +#endif + Agent::Agent() {} Agent::Agent(sockaddr *agentPublicSocket, sockaddr *agentLocalSocket, char agentType) { diff --git a/shared/src/Agent.h b/shared/src/Agent.h index dafbeb768f..5fb2d018da 100644 --- a/shared/src/Agent.h +++ b/shared/src/Agent.h @@ -11,7 +11,12 @@ #include #include "AgentData.h" + +#ifdef _WIN32 +#include +#else #include +#endif class Agent { public: diff --git a/shared/src/AgentList.cpp b/shared/src/AgentList.cpp index 0bdedb10cd..ed27f8ea8c 100644 --- a/shared/src/AgentList.cpp +++ b/shared/src/AgentList.cpp @@ -7,10 +7,15 @@ // #include "AgentList.h" -#include #include #include "SharedUtil.h" +#ifdef _WIN32 +#include +#else +#include +#endif + const char * SOLO_AGENT_TYPES_STRING = "MV"; bool stopAgentRemovalThread = false; diff --git a/shared/src/UDPSocket.cpp b/shared/src/UDPSocket.cpp index 85ebcf2056..b1ae645b88 100644 --- a/shared/src/UDPSocket.cpp +++ b/shared/src/UDPSocket.cpp @@ -7,13 +7,18 @@ // #include "UDPSocket.h" -#include -#include #include #include #include #include +#ifdef _WIN32 +#include +#else +#include +#include +#endif + sockaddr_in destSockaddr, senderAddress; bool socketMatch(sockaddr *first, sockaddr *second) { diff --git a/shared/src/UDPSocket.h b/shared/src/UDPSocket.h index b2389ad73f..da06c4d86d 100644 --- a/shared/src/UDPSocket.h +++ b/shared/src/UDPSocket.h @@ -10,8 +10,13 @@ #define __interface__UDPSocket__ #include + +#ifdef _WIN32 +#include +#else #include #include +#endif #define MAX_BUFFER_LENGTH_BYTES 1500 diff --git a/voxel/src/main.cpp b/voxel/src/main.cpp index 5fccb82624..beff2abb7f 100644 --- a/voxel/src/main.cpp +++ b/voxel/src/main.cpp @@ -6,14 +6,7 @@ // Copyright (c) 2012 High Fidelity, Inc. All rights reserved. // -#ifdef _WIN32 -#include "Systime.h" -#else -#include -#endif _WIN32 -#include -#include #include #include #include @@ -23,6 +16,15 @@ #include #include +#ifdef _WIN32 +#include "Systime.h" +#include +#else +#include +#include +#include +#endif _WIN32 + const int VOXEL_LISTEN_PORT = 40106; const int NUMBER_OF_VOXELS = 250000;