summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2005-02-01 21:36:03 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2005-02-01 21:36:03 +0000
commite733b84415023e8e6c83afc1af1c8653abbf7d16 (patch)
treed08ea0e90f2f8f639652bc9372f0c609d2f2a7d5
parent11750cd51d0158acbff6eca77fe6350328f2f744 (diff)
switch the buffer size describing vars from ssize_t to size_t and adjust
the API appropriately. avoid singled-compare warnings by rewriting two expressions. ok claudio
-rw-r--r--usr.sbin/bgpd/bgpd.h14
-rw-r--r--usr.sbin/bgpd/buffer.c12
2 files changed, 13 insertions, 13 deletions
diff --git a/usr.sbin/bgpd/bgpd.h b/usr.sbin/bgpd/bgpd.h
index 41586b4128a..77b623e6d6b 100644
--- a/usr.sbin/bgpd/bgpd.h
+++ b/usr.sbin/bgpd/bgpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpd.h,v 1.154 2004/12/23 17:26:51 henning Exp $ */
+/* $OpenBSD: bgpd.h,v 1.155 2005/02/01 21:36:01 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -84,9 +84,9 @@ enum reconf_action {
struct buf {
TAILQ_ENTRY(buf) entry;
u_char *buf;
- ssize_t size;
- ssize_t wpos;
- ssize_t rpos;
+ size_t size;
+ size_t wpos;
+ size_t rpos;
int fd;
};
@@ -584,9 +584,9 @@ void send_nexthop_update(struct kroute_nexthop *);
void send_imsg_session(int, pid_t, void *, u_int16_t);
/* buffer.c */
-struct buf *buf_open(ssize_t);
-int buf_add(struct buf *, void *, ssize_t);
-void *buf_reserve(struct buf *, ssize_t);
+struct buf *buf_open(size_t);
+int buf_add(struct buf *, void *, size_t);
+void *buf_reserve(struct buf *, size_t);
int buf_close(struct msgbuf *, struct buf *);
int buf_write(int, struct buf *);
void buf_free(struct buf *);
diff --git a/usr.sbin/bgpd/buffer.c b/usr.sbin/bgpd/buffer.c
index 75be51c7e81..a0e196ca0bb 100644
--- a/usr.sbin/bgpd/buffer.c
+++ b/usr.sbin/bgpd/buffer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: buffer.c,v 1.25 2004/09/16 01:33:53 henning Exp $ */
+/* $OpenBSD: buffer.c,v 1.26 2005/02/01 21:36:02 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -33,7 +33,7 @@ void buf_enqueue(struct msgbuf *, struct buf *);
void buf_dequeue(struct msgbuf *, struct buf *);
struct buf *
-buf_open(ssize_t len)
+buf_open(size_t len)
{
struct buf *buf;
@@ -50,7 +50,7 @@ buf_open(ssize_t len)
}
int
-buf_add(struct buf *buf, void *data, ssize_t len)
+buf_add(struct buf *buf, void *data, size_t len)
{
if (buf->wpos + len > buf->size)
return (-1);
@@ -61,7 +61,7 @@ buf_add(struct buf *buf, void *data, ssize_t len)
}
void *
-buf_reserve(struct buf *buf, ssize_t len)
+buf_reserve(struct buf *buf, size_t len)
{
void *b;
@@ -98,7 +98,7 @@ buf_write(int sock, struct buf *buf)
return (-2);
}
- if (n < buf->size - buf->rpos) { /* not all data written yet */
+ if (buf->rpos + n < buf->size) { /* not all data written yet */
buf->rpos += n;
return (0);
} else
@@ -186,7 +186,7 @@ msgbuf_write(struct msgbuf *msgbuf)
for (buf = TAILQ_FIRST(&msgbuf->bufs); buf != NULL && n > 0;
buf = next) {
next = TAILQ_NEXT(buf, entry);
- if (n >= buf->size - buf->rpos) {
+ if (buf->rpos + n >= buf->size) {
n -= buf->size - buf->rpos;
buf_dequeue(msgbuf, buf);
} else {