get rid of arpa/inet.h and netdb.h

This commit is contained in:
Brad Hefta-Gaub 2014-01-10 18:13:23 -08:00
parent 9bc4a3df41
commit 5725a92cfe
6 changed files with 227 additions and 225 deletions

View file

@ -6,7 +6,7 @@
// Copyright (c) 2013 HighFidelity, Inc. All rights reserved. // Copyright (c) 2013 HighFidelity, Inc. All rights reserved.
// //
#include <arpa/inet.h> //#include <arpa/inet.h> // not available on windows, apparently not needed on mac
#include <signal.h> #include <signal.h>
#include <QtCore/QJsonDocument> #include <QtCore/QJsonDocument>

View file

@ -6,7 +6,7 @@
// Copyright (c) 2013 High Fidelity, Inc. All rights reserved. // Copyright (c) 2013 High Fidelity, Inc. All rights reserved.
// //
#include <arpa/inet.h> //#include <arpa/inet.h> // not available on windows, apparently not needed on mac
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>

View file

@ -9,7 +9,7 @@
#include <cstring> #include <cstring>
#include <cstdio> #include <cstdio>
#include <iostream> #include <iostream>
#include <netdb.h> //#include <netdb.h> // not available on windows, apparently not needed on mac
#include <QtNetwork/QHostInfo> #include <QtNetwork/QHostInfo>

View file

@ -12,7 +12,7 @@
#define __shared_NetworkPacket__ #define __shared_NetworkPacket__
#include <stdlib.h> #include <stdlib.h>
#include <arpa/inet.h> //#include <arpa/inet.h> // not available on windows, apparently not needed on mac
#include <ifaddrs.h> #include <ifaddrs.h>
#include "HifiSockAddr.h" #include "HifiSockAddr.h"

View file

@ -12,7 +12,7 @@
#ifdef _WIN32 #ifdef _WIN32
#include "Syssocket.h" #include "Syssocket.h"
#else #else
#include <arpa/inet.h> //#include <arpa/inet.h> // not available on windows, apparently not needed on mac
#endif #endif
#include "Node.h" #include "Node.h"

View file

@ -11,7 +11,9 @@
#include <cstdio> #include <cstdio>
#include <cstring> #include <cstring>
#include <arpa/inet.h> //#include <arpa/inet.h> // not available on windows, apparently not needed on mac
const int INET_ADDR_STRLEN = 16;
#include <QtNetwork/QUdpSocket> #include <QtNetwork/QUdpSocket>
@ -28,7 +30,7 @@ struct PairableDevice {
}; };
struct RequestingClient { struct RequestingClient {
char address[INET_ADDRSTRLEN]; char address[INET_ADDR_STRLEN];
int port; int port;
}; };
@ -47,7 +49,7 @@ int indexOfFirstOccurenceOfCharacter(char* haystack, char needle) {
} }
void sendLastClientToLastDevice() { void sendLastClientToLastDevice() {
char pairData[INET_ADDRSTRLEN + 6] = {}; char pairData[INET_ADDR_STRLEN + 6] = {};
int bytesWritten = sprintf(pairData, "%s:%d", ::lastClient->address, ::lastClient->port); int bytesWritten = sprintf(pairData, "%s:%d", ::lastClient->address, ::lastClient->port);
::serverSocket.writeDatagram(pairData, bytesWritten, ::serverSocket.writeDatagram(pairData, bytesWritten,
@ -70,7 +72,7 @@ int main(int argc, const char* argv[]) {
PairableDevice tempDevice = {}; PairableDevice tempDevice = {};
char deviceAddress[INET_ADDRSTRLEN] = {}; char deviceAddress[INET_ADDR_STRLEN] = {};
int socketPort = 0; int socketPort = 0;
int numMatches = sscanf(senderData, "Available %s %[^:]:%d %s", int numMatches = sscanf(senderData, "Available %s %[^:]:%d %s",