summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2013-09-02 11:41:06 -0400
committerirungentoo <irungentoo@gmail.com>2013-09-02 11:41:06 -0400
commit385772065899f7263b6edee15e6f83f1ecd4245e (patch)
tree104f446e4f1b4770da1a7ad5dbef4ba9d8e61096
parent52336565612207fdb2d2068989da936b5b83ceeb (diff)
Fixed some warnings.
-rw-r--r--toxcore/network.c8
-rw-r--r--toxcore/network.h10
2 files changed, 18 insertions, 0 deletions
diff --git a/toxcore/network.c b/toxcore/network.c
index 34775570..d8ae7750 100644
--- a/toxcore/network.c
+++ b/toxcore/network.c
@@ -60,7 +60,11 @@ uint32_t random_int(void)
60/* Basic network functions: 60/* Basic network functions:
61 * Function to send packet(data) of length length to ip_port. 61 * Function to send packet(data) of length length to ip_port.
62 */ 62 */
63#ifdef WIN32
64int sendpacket(unsigned int sock, IP_Port ip_port, uint8_t *data, uint32_t length)
65#else
63int sendpacket(int sock, IP_Port ip_port, uint8_t *data, uint32_t length) 66int sendpacket(int sock, IP_Port ip_port, uint8_t *data, uint32_t length)
67#endif
64{ 68{
65 ADDR addr = {AF_INET, ip_port.port, ip_port.ip}; 69 ADDR addr = {AF_INET, ip_port.port, ip_port.ip};
66 return sendto(sock, (char *) data, length, 0, (struct sockaddr *)&addr, sizeof(addr)); 70 return sendto(sock, (char *) data, length, 0, (struct sockaddr *)&addr, sizeof(addr));
@@ -72,7 +76,11 @@ int sendpacket(int sock, IP_Port ip_port, uint8_t *data, uint32_t length)
72 * Packet length is put into length. 76 * Packet length is put into length.
73 * Dump all empty packets. 77 * Dump all empty packets.
74 */ 78 */
79#ifdef WIN32
80static int receivepacket(unsigned int sock, IP_Port *ip_port, uint8_t *data, uint32_t *length)
81#else
75static int receivepacket(int sock, IP_Port *ip_port, uint8_t *data, uint32_t *length) 82static int receivepacket(int sock, IP_Port *ip_port, uint8_t *data, uint32_t *length)
83#endif
76{ 84{
77 ADDR addr; 85 ADDR addr;
78#ifdef WIN32 86#ifdef WIN32
diff --git a/toxcore/network.h b/toxcore/network.h
index 32850944..3a1c75f8 100644
--- a/toxcore/network.h
+++ b/toxcore/network.h
@@ -120,7 +120,12 @@ typedef struct {
120typedef struct { 120typedef struct {
121 Packet_Handles packethandlers[256]; 121 Packet_Handles packethandlers[256];
122 /* Our UDP socket. */ 122 /* Our UDP socket. */
123#ifdef WIN32
124 unsigned int sock;
125#else
123 int sock; 126 int sock;
127#endif
128
124} Networking_Core; 129} Networking_Core;
125 130
126/* return current time in milleseconds since the epoch. */ 131/* return current time in milleseconds since the epoch. */
@@ -134,7 +139,12 @@ uint32_t random_int(void);
134/* Basic network functions: */ 139/* Basic network functions: */
135 140
136/* Function to send packet(data) of length length to ip_port. */ 141/* Function to send packet(data) of length length to ip_port. */
142#ifdef WIN32
143int sendpacket(unsigned int sock, IP_Port ip_port, uint8_t *data, uint32_t length);
144#else
137int sendpacket(int sock, IP_Port ip_port, uint8_t *data, uint32_t length); 145int sendpacket(int sock, IP_Port ip_port, uint8_t *data, uint32_t length);
146#endif
147
138 148
139/* Function to call when packet beginning with byte is received. */ 149/* Function to call when packet beginning with byte is received. */
140void networking_registerhandler(Networking_Core *net, uint8_t byte, packet_handler_callback cb, void *object); 150void networking_registerhandler(Networking_Core *net, uint8_t byte, packet_handler_callback cb, void *object);