Change type for data to void *

This commit is contained in:
Joris Vink 2014-07-04 11:25:05 +02:00
parent 423d57b08d
commit baac693f2f
2 changed files with 8 additions and 6 deletions

View File

@ -448,7 +448,7 @@ void net_recv_queue(struct connection *, size_t, int,
struct netbuf **, int (*cb)(struct netbuf *));
int net_recv_expand(struct connection *c, struct netbuf *, size_t,
int (*cb)(struct netbuf *));
void net_send_queue(struct connection *, u_int8_t *,
void net_send_queue(struct connection *, void *,
u_int32_t, struct spdy_stream *);
void kore_buf_free(struct kore_buf *);

View File

@ -27,25 +27,27 @@ net_init(void)
}
void
net_send_queue(struct connection *c, u_int8_t *data, u_int32_t len,
net_send_queue(struct connection *c, void *data, u_int32_t len,
struct spdy_stream *s)
{
u_int8_t *d;
struct netbuf *nb;
u_int32_t avail;
d = data;
nb = TAILQ_LAST(&(c->send_queue), netbuf_head);
if (nb != NULL && nb->b_len < nb->m_len && nb->stream == s) {
avail = nb->m_len - nb->b_len;
if (len < avail) {
memcpy(nb->buf + nb->b_len, data, len);
memcpy(nb->buf + nb->b_len, d, len);
nb->b_len += len;
return;
} else if (len > avail) {
memcpy(nb->buf + nb->b_len, data, avail);
memcpy(nb->buf + nb->b_len, d, avail);
nb->b_len += avail;
len -= avail;
data += avail;
d += avail;
if (len == 0)
return;
}
@ -67,7 +69,7 @@ net_send_queue(struct connection *c, u_int8_t *data, u_int32_t len,
nb->buf = kore_malloc(nb->m_len);
if (len > 0)
memcpy(nb->buf, data, nb->b_len);
memcpy(nb->buf, d, nb->b_len);
TAILQ_INSERT_TAIL(&(c->send_queue), nb, list);
}