mirror of
https://github.com/libevent/libevent.git
synced 2025-01-31 09:12:55 +08:00
Use ev_ssize_t in place of ssize_t *everywhere*.
svn:r1309
This commit is contained in:
parent
7289d7f800
commit
0b22ca1929
20
buffer.c
20
buffer.c
@ -463,7 +463,7 @@ evbuffer_get_contiguous_space(const struct evbuffer *buf)
|
||||
}
|
||||
|
||||
int
|
||||
evbuffer_reserve_space(struct evbuffer *buf, ssize_t size,
|
||||
evbuffer_reserve_space(struct evbuffer *buf, ev_ssize_t size,
|
||||
struct evbuffer_iovec *vec, int n_vecs)
|
||||
{
|
||||
struct evbuffer_chain *chain;
|
||||
@ -863,11 +863,11 @@ done:
|
||||
}
|
||||
|
||||
unsigned char *
|
||||
evbuffer_pullup(struct evbuffer *buf, ssize_t size)
|
||||
evbuffer_pullup(struct evbuffer *buf, ev_ssize_t size)
|
||||
{
|
||||
struct evbuffer_chain *chain, *next, *tmp;
|
||||
unsigned char *buffer, *result = NULL;
|
||||
ssize_t remaining;
|
||||
ev_ssize_t remaining;
|
||||
|
||||
EVBUFFER_LOCK(buf, EVTHREAD_WRITE);
|
||||
|
||||
@ -1492,7 +1492,7 @@ _evbuffer_expand_fast(struct evbuffer *buf, size_t datlen)
|
||||
@return The number of buffers we're using.
|
||||
*/
|
||||
int
|
||||
_evbuffer_read_setup_vecs(struct evbuffer *buf, ssize_t howmuch,
|
||||
_evbuffer_read_setup_vecs(struct evbuffer *buf, ev_ssize_t howmuch,
|
||||
struct evbuffer_iovec *vecs, struct evbuffer_chain **chainp, int exact)
|
||||
{
|
||||
struct evbuffer_chain *chain;
|
||||
@ -1541,7 +1541,7 @@ _evbuffer_read_setup_vecs(struct evbuffer *buf, ssize_t howmuch,
|
||||
return nvecs;
|
||||
}
|
||||
|
||||
/* TODO(niels): should this function return ssize_t and take ssize_t
|
||||
/* TODO(niels): should this function return ev_ssize_t and take ev_ssize_t
|
||||
* as howmuch? */
|
||||
int
|
||||
evbuffer_read(struct evbuffer *buf, evutil_socket_t fd, int howmuch)
|
||||
@ -1667,7 +1667,7 @@ evbuffer_read(struct evbuffer *buf, evutil_socket_t fd, int howmuch)
|
||||
|
||||
#ifdef USE_IOVEC_IMPL
|
||||
if (nvecs == 2) {
|
||||
ssize_t space = CHAIN_SPACE_LEN(chain);
|
||||
ev_ssize_t space = CHAIN_SPACE_LEN(chain);
|
||||
if (space < n) {
|
||||
chain->off += space;
|
||||
chain->next->off += n-space;
|
||||
@ -1741,7 +1741,7 @@ ssize_t howmuch)
|
||||
#ifdef USE_SENDFILE
|
||||
static inline int
|
||||
evbuffer_write_sendfile(struct evbuffer *buffer, evutil_socket_t fd,
|
||||
ssize_t howmuch)
|
||||
ev_ssize_t howmuch)
|
||||
{
|
||||
struct evbuffer_chain *chain = buffer->first;
|
||||
struct evbuffer_chain_fd *info =
|
||||
@ -1750,7 +1750,7 @@ evbuffer_write_sendfile(struct evbuffer *buffer, evutil_socket_t fd,
|
||||
int res;
|
||||
off_t len = chain->off;
|
||||
#elif SENDFILE_IS_LINUX
|
||||
ssize_t res;
|
||||
ev_ssize_t res;
|
||||
off_t offset = chain->misalign;
|
||||
#endif
|
||||
|
||||
@ -1782,7 +1782,7 @@ evbuffer_write_sendfile(struct evbuffer *buffer, evutil_socket_t fd,
|
||||
|
||||
int
|
||||
evbuffer_write_atmost(struct evbuffer *buffer, evutil_socket_t fd,
|
||||
ssize_t howmuch)
|
||||
ev_ssize_t howmuch)
|
||||
{
|
||||
int n = -1;
|
||||
|
||||
@ -2233,7 +2233,7 @@ evbuffer_add_file(struct evbuffer *outbuf, int fd,
|
||||
{
|
||||
/* the default implementation */
|
||||
struct evbuffer *tmp = evbuffer_new();
|
||||
ssize_t read;
|
||||
ev_ssize_t read;
|
||||
|
||||
if (tmp == NULL)
|
||||
return (-1);
|
||||
|
@ -111,7 +111,7 @@ pin_release(struct event_overlapped *eo, unsigned flag)
|
||||
|
||||
/** IOCP callback invoked when a read operation is finished. */
|
||||
static void
|
||||
read_completed(struct event_overlapped *eo, uintptr_t _, ssize_t nBytes)
|
||||
read_completed(struct event_overlapped *eo, uintptr_t _, ev_ssize_t nBytes)
|
||||
{
|
||||
struct buffer_overlapped *buf_o = upcast_overlapped(eo);
|
||||
struct evbuffer_overlapped *buf = buf_o->buf;
|
||||
@ -145,7 +145,7 @@ read_completed(struct event_overlapped *eo, uintptr_t _, ssize_t nBytes)
|
||||
|
||||
/** IOCP callback invoked when a write operation is finished. */
|
||||
static void
|
||||
write_completed(struct event_overlapped *eo, uintptr_t _, ssize_t nBytes)
|
||||
write_completed(struct event_overlapped *eo, uintptr_t _, ev_ssize_t nBytes)
|
||||
{
|
||||
struct buffer_overlapped *buf_o = upcast_overlapped(eo);
|
||||
struct evbuffer_overlapped *buf = buf_o->buf;
|
||||
@ -177,7 +177,7 @@ evbuffer_overlapped_new(evutil_socket_t fd)
|
||||
}
|
||||
|
||||
int
|
||||
evbuffer_launch_write(struct evbuffer *buf, ssize_t at_most)
|
||||
evbuffer_launch_write(struct evbuffer *buf, ev_ssize_t at_most)
|
||||
{
|
||||
struct evbuffer_overlapped *buf_o = upcast_evbuffer(buf);
|
||||
int r = -1;
|
||||
|
@ -152,7 +152,7 @@ be_readbuf_full(struct bufferevent_filtered *bevf,
|
||||
|
||||
/* Filter to use when we're created with a NULL filter. */
|
||||
static enum bufferevent_filter_result
|
||||
be_null_filter(struct evbuffer *src, struct evbuffer *dst, ssize_t lim,
|
||||
be_null_filter(struct evbuffer *src, struct evbuffer *dst, ev_ssize_t lim,
|
||||
enum bufferevent_flush_mode state, void *ctx)
|
||||
{
|
||||
(void)state;
|
||||
@ -268,7 +268,7 @@ be_filter_process_input(struct bufferevent_filtered *bevf,
|
||||
}
|
||||
|
||||
do {
|
||||
ssize_t limit = -1;
|
||||
ev_ssize_t limit = -1;
|
||||
if (state == BEV_NORMAL && bev->wm_read.high)
|
||||
limit = bev->wm_read.high -
|
||||
evbuffer_get_length(bev->input);
|
||||
@ -317,7 +317,7 @@ be_filter_process_output(struct bufferevent_filtered *bevf,
|
||||
again = 0;
|
||||
|
||||
do {
|
||||
ssize_t limit = -1;
|
||||
ev_ssize_t limit = -1;
|
||||
if (state == BEV_NORMAL &&
|
||||
bevf->underlying->wm_write.high)
|
||||
limit = bevf->underlying->wm_write.high -
|
||||
|
@ -263,7 +263,7 @@ int _evbuffer_expand_fast(struct evbuffer *, size_t);
|
||||
* extent, and *chainp to poitn to the first chain that we'll try to read into.
|
||||
* Returns the number of vecs used.
|
||||
*/
|
||||
int _evbuffer_read_setup_vecs(struct evbuffer *buf, ssize_t howmuch,
|
||||
int _evbuffer_read_setup_vecs(struct evbuffer *buf, ev_ssize_t howmuch,
|
||||
struct evbuffer_iovec *vecs, struct evbuffer_chain **chainp, int exact);
|
||||
|
||||
/* Helper macro: copies an evbuffer_iovec in ei to a win32 WSABUF in i. */
|
||||
|
@ -219,7 +219,7 @@ int evbuffer_expand(struct evbuffer *buf, size_t datlen);
|
||||
@see evbuffer_commit_space
|
||||
*/
|
||||
int
|
||||
evbuffer_reserve_space(struct evbuffer *buf, ssize_t size,
|
||||
evbuffer_reserve_space(struct evbuffer *buf, ev_ssize_t size,
|
||||
struct evbuffer_iovec *vec, int n_vecs);
|
||||
|
||||
/**
|
||||
|
@ -34,7 +34,7 @@ extern "C" {
|
||||
struct event_overlapped;
|
||||
struct event_iocp_port;
|
||||
struct evbuffer;
|
||||
typedef void (*iocp_callback)(struct event_overlapped *, uintptr_t, ssize_t);
|
||||
typedef void (*iocp_callback)(struct event_overlapped *, uintptr_t, ev_ssize_t);
|
||||
|
||||
/* This whole file is actually win32 only. We wrap the structures in a win32
|
||||
* ifdef so that we can test-compile code that uses these interfaces on
|
||||
@ -122,7 +122,7 @@ int evbuffer_launch_read(struct evbuffer *, size_t n);
|
||||
@param n The number of bytes to try to read.
|
||||
@return 0 on success, -1 on error.
|
||||
*/
|
||||
int evbuffer_launch_write(struct evbuffer *, ssize_t n);
|
||||
int evbuffer_launch_write(struct evbuffer *, ev_ssize_t n);
|
||||
|
||||
/** Create an IOCP, and launch its worker threads. Internal use only.
|
||||
|
||||
|
7
signal.c
7
signal.c
@ -87,11 +87,8 @@ static void
|
||||
evsig_cb(evutil_socket_t fd, short what, void *arg)
|
||||
{
|
||||
static char signals[1];
|
||||
#ifdef WIN32
|
||||
SSIZE_T n;
|
||||
#else
|
||||
ssize_t n;
|
||||
#endif
|
||||
ev_ssize_t n;
|
||||
|
||||
(void)arg; /* Suppress "unused variable" warning. */
|
||||
|
||||
n = recv(fd, signals, sizeof(signals), 0);
|
||||
|
@ -273,7 +273,7 @@ test_bufferevent_pair_watermarks(void)
|
||||
|
||||
static enum bufferevent_filter_result
|
||||
bufferevent_input_filter(struct evbuffer *src, struct evbuffer *dst,
|
||||
ssize_t lim, enum bufferevent_flush_mode state, void *ctx)
|
||||
ev_ssize_t lim, enum bufferevent_flush_mode state, void *ctx)
|
||||
{
|
||||
const unsigned char *buffer;
|
||||
int i;
|
||||
@ -295,7 +295,7 @@ bufferevent_input_filter(struct evbuffer *src, struct evbuffer *dst,
|
||||
|
||||
static enum bufferevent_filter_result
|
||||
bufferevent_output_filter(struct evbuffer *src, struct evbuffer *dst,
|
||||
ssize_t lim, enum bufferevent_flush_mode state, void *ctx)
|
||||
ev_ssize_t lim, enum bufferevent_flush_mode state, void *ctx)
|
||||
{
|
||||
const unsigned char *buffer;
|
||||
int i;
|
||||
|
@ -49,11 +49,11 @@ struct dummy_overlapped {
|
||||
void *lock;
|
||||
int call_count;
|
||||
uintptr_t keys[MAX_CALLS];
|
||||
ssize_t sizes[MAX_CALLS];
|
||||
ev_ssize_t sizes[MAX_CALLS];
|
||||
};
|
||||
|
||||
static void
|
||||
dummy_cb(struct event_overlapped *o, uintptr_t key, ssize_t n)
|
||||
dummy_cb(struct event_overlapped *o, uintptr_t key, ev_ssize_t n)
|
||||
{
|
||||
struct dummy_overlapped *d_o =
|
||||
EVUTIL_UPCAST(o, struct dummy_overlapped, eo);
|
||||
@ -68,7 +68,7 @@ dummy_cb(struct event_overlapped *o, uintptr_t key, ssize_t n)
|
||||
}
|
||||
|
||||
static int
|
||||
pair_is_in(struct dummy_overlapped *o, uintptr_t key, ssize_t n)
|
||||
pair_is_in(struct dummy_overlapped *o, uintptr_t key, ev_ssize_t n)
|
||||
{
|
||||
int i;
|
||||
int result = 0;
|
||||
|
@ -104,7 +104,7 @@ getstate(enum bufferevent_flush_mode state)
|
||||
*/
|
||||
static enum bufferevent_filter_result
|
||||
zlib_input_filter(struct evbuffer *src, struct evbuffer *dst,
|
||||
ssize_t lim, enum bufferevent_flush_mode state, void *ctx)
|
||||
ev_ssize_t lim, enum bufferevent_flush_mode state, void *ctx)
|
||||
{
|
||||
struct evbuffer_iovec v_in[1];
|
||||
struct evbuffer_iovec v_out[1];
|
||||
@ -158,7 +158,7 @@ zlib_input_filter(struct evbuffer *src, struct evbuffer *dst,
|
||||
|
||||
static enum bufferevent_filter_result
|
||||
zlib_output_filter(struct evbuffer *src, struct evbuffer *dst,
|
||||
ssize_t lim, enum bufferevent_flush_mode state, void *ctx)
|
||||
ev_ssize_t lim, enum bufferevent_flush_mode state, void *ctx)
|
||||
{
|
||||
struct evbuffer_iovec v_in[1];
|
||||
struct evbuffer_iovec v_out[1];
|
||||
|
@ -40,9 +40,6 @@ extern "C" {
|
||||
#ifdef _EVENT___func__
|
||||
#define __func__ _EVENT___func__
|
||||
#endif
|
||||
#ifdef _EVENT_ssize_t
|
||||
#define ssize_t _EVENT_ssize_t
|
||||
#endif
|
||||
|
||||
/* A good no-op to use in macro definitions. */
|
||||
#define _EVUTIL_NIL_STMT ((void)0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user