summaryrefslogtreecommitdiffhomepage
path: root/ir/lpp
diff options
context:
space:
mode:
authorMatthias Braun <matthias.braun@kit.edu>2012-07-13 22:02:50 +0200
committerMatthias Braun <matthias.braun@kit.edu>2012-07-13 22:04:14 +0200
commita4360ad1c1ce12cf7258bdb564e28d26859e3729 (patch)
tree0423ebabc1691386b2da6bd19d132456757cbd96 /ir/lpp
parent10927999e0da0ff6e4b816018291eea9cc265a31 (diff)
adapt to -std=c99
Diffstat (limited to 'ir/lpp')
-rw-r--r--ir/lpp/lpp_comm.c11
-rw-r--r--ir/lpp/lpp_comm.h7
-rw-r--r--ir/lpp/lpp_net.c2
3 files changed, 11 insertions, 9 deletions
diff --git a/ir/lpp/lpp_comm.c b/ir/lpp/lpp_comm.c
index bcfa974..8d307e8 100644
--- a/ir/lpp/lpp_comm.c
+++ b/ir/lpp/lpp_comm.c
@@ -33,6 +33,8 @@
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <winsock2.h>
+#include <BaseTsd.h>
+typedef SSIZE_T ssize_t;
#else
#include <unistd.h>
#include <sys/types.h>
@@ -119,7 +121,7 @@ static ssize_t secure_send(int fd, const void *buf, size_t n)
return n;
}
-ssize_t lpp_flush(lpp_comm_t *comm)
+static ssize_t lpp_flush_(lpp_comm_t *comm)
{
ssize_t res = 0;
if(comm->w_pos - comm->w_buf > 0) {
@@ -133,6 +135,11 @@ ssize_t lpp_flush(lpp_comm_t *comm)
return res;
}
+void lpp_flush(lpp_comm_t *comm)
+{
+ lpp_flush_(comm);
+}
+
static ssize_t lpp_write(lpp_comm_t *comm, const void *buf, size_t len)
{
assert(comm->w_pos - comm->w_buf >= 0);
@@ -160,7 +167,7 @@ static ssize_t lpp_write(lpp_comm_t *comm, const void *buf, size_t len)
size_t n_direct = rest / comm->buf_size;
size_t last_rest;
- if(lpp_flush(comm) < 0)
+ if(lpp_flush_(comm) < 0)
return -1;
for(i = 0; i < n_direct; ++i) {
diff --git a/ir/lpp/lpp_comm.h b/ir/lpp/lpp_comm.h
index e087e8e..193d004 100644
--- a/ir/lpp/lpp_comm.h
+++ b/ir/lpp/lpp_comm.h
@@ -28,11 +28,6 @@
#include <stdarg.h>
#include <stdint.h>
-#ifdef _WIN32
-#include <BaseTsd.h>
-typedef SSIZE_T ssize_t;
-#endif
-
#define LPP_PORT 2175
#define LPP_BUFSIZE (1 << 20)
@@ -95,7 +90,7 @@ lpp_comm_t *lpp_comm_new(int fd, size_t buf_size);
int lpp_comm_fileno(const lpp_comm_t *comm);
-ssize_t lpp_flush(lpp_comm_t *comm);
+void lpp_flush(lpp_comm_t *comm);
void lpp_comm_free(lpp_comm_t *comm);
diff --git a/ir/lpp/lpp_net.c b/ir/lpp/lpp_net.c
index c8799a6..7ef7285 100644
--- a/ir/lpp/lpp_net.c
+++ b/ir/lpp/lpp_net.c
@@ -110,7 +110,7 @@ static int connect_tcp(const char *host, uint16_t port)
sin.sin_port = htons(port);
if ((phe = gethostbyname(host)))
- memcpy(&sin.sin_addr, phe->h_addr, phe->h_length);
+ memcpy(&sin.sin_addr, phe->h_addr_list[0], phe->h_length);
else if((sin.sin_addr.s_addr = inet_addr(host)) == INADDR_NONE) {
lpp_print_err("cannot get host entry for %s", host);
return -1;