X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=libatalk%2Fdsi%2Fdsi_stream.c;h=ccb8b76eae25d4dc091448ab8dff81e58ee2039a;hb=056d3ef4c88ba09eabb1fcbf06bdd9fe6e7af4cf;hp=c709f2166fc8972e6a693fabc98fd535aab6663e;hpb=0fe0c9fc53956b6f4d336824c2ee8ee44b657948;p=netatalk.git diff --git a/libatalk/dsi/dsi_stream.c b/libatalk/dsi/dsi_stream.c index c709f216..ccb8b76e 100644 --- a/libatalk/dsi/dsi_stream.c +++ b/libatalk/dsi/dsi_stream.c @@ -28,7 +28,6 @@ #include #include -#include #include #define min(a,b) ((a) < (b) ? (a) : (b)) @@ -125,7 +124,7 @@ static int dsi_peek(DSI *dsi) /* * Return all bytes up to count from dsi->buffer if there are any buffered there */ -static size_t from_buf(DSI *dsi, u_int8_t *buf, size_t count) +static size_t from_buf(DSI *dsi, uint8_t *buf, size_t count) { size_t nbe = 0; @@ -160,7 +159,7 @@ static size_t from_buf(DSI *dsi, u_int8_t *buf, size_t count) * Note: this may return fewer bytes then requested in count !! * 3. If the buffer was empty, read from the socket. */ -static ssize_t buf_read(DSI *dsi, u_int8_t *buf, size_t count) +static ssize_t buf_read(DSI *dsi, uint8_t *buf, size_t count) { ssize_t len; @@ -184,7 +183,7 @@ static ssize_t buf_read(DSI *dsi, u_int8_t *buf, size_t count) * Get "length" bytes from buffer and/or socket. In order to avoid frequent small reads * this tries to read larger chunks (8192 bytes) into a buffer. */ -static size_t dsi_buffered_stream_read(DSI *dsi, u_int8_t *data, const size_t length) +static size_t dsi_buffered_stream_read(DSI *dsi, uint8_t *data, const size_t length) { size_t len; size_t buflen; @@ -272,7 +271,7 @@ ssize_t dsi_stream_write(DSI *dsi, void *data, const size_t length, int mode) return -1; while (written < length) { - len = send(dsi->socket, (u_int8_t *) data + written, length - written, flags); + len = send(dsi->socket, (uint8_t *) data + written, length - written, flags); if (len >= 0) { written += len; continue; @@ -342,7 +341,7 @@ ssize_t dsi_stream_read_file(DSI *dsi, int fromfd, off_t offset, const size_t le goto exit; } if (errno == EAGAIN || errno == EWOULDBLOCK) { -#ifdef SOLARIS +#if defined(SOLARIS) || defined(FREEBSD) if (pos > offset) { /* we actually have sent sth., adjust counters and keep trying */ len = pos - offset; @@ -400,7 +399,7 @@ size_t dsi_stream_read(DSI *dsi, void *data, const size_t length) stored = 0; while (stored < length) { - len = buf_read(dsi, (u_int8_t *) data + stored, length - stored); + len = buf_read(dsi, (uint8_t *) data + stored, length - stored); if (len == -1 && (errno == EINTR || errno == EAGAIN)) { LOG(log_maxdebug, logtype_dsi, "dsi_stream_read: select read loop"); continue; @@ -524,7 +523,7 @@ int dsi_stream_receive(DSI *dsi) return 0; /* read in the header */ - if (dsi_buffered_stream_read(dsi, (u_int8_t *)block, sizeof(block)) != sizeof(block)) + if (dsi_buffered_stream_read(dsi, (uint8_t *)block, sizeof(block)) != sizeof(block)) return 0; dsi->header.dsi_flags = block[0];