mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-11 13:24:43 -04:00
r19675@catbus: nickm | 2008-05-11 20:39:39 -0400
Stop pretending that u_char and u_short are standard types that win32 is dumb not to have. In fact, u_char can really just be spelled out, and u_short was usually just a bad way of saying ev_uint16_t. svn:r808
This commit is contained in:
parent
a57767faf8
commit
6bf1ca780c
20
buffer.c
20
buffer.c
@ -131,7 +131,7 @@ evbuffer_get_contiguous_space(struct evbuffer *buf)
|
||||
return (chain != NULL ? chain->off : 0);
|
||||
}
|
||||
|
||||
u_char *
|
||||
unsigned char *
|
||||
evbuffer_reserve_space(struct evbuffer *buf, size_t size)
|
||||
{
|
||||
struct evbuffer_chain *chain;
|
||||
@ -395,11 +395,11 @@ evbuffer_remove_buffer(struct evbuffer *src, struct evbuffer *dst,
|
||||
}
|
||||
|
||||
/* XXX shouldn't the second arg be ssize_t? */
|
||||
u_char *
|
||||
unsigned char *
|
||||
evbuffer_pullup(struct evbuffer *buf, int size)
|
||||
{
|
||||
struct evbuffer_chain *chain = buf->first, *next, *tmp;
|
||||
u_char *buffer;
|
||||
unsigned char *buffer;
|
||||
|
||||
if (size == -1)
|
||||
size = buf->total_len;
|
||||
@ -643,7 +643,7 @@ int
|
||||
evbuffer_add(struct evbuffer *buf, const void *data_in, size_t datlen)
|
||||
{
|
||||
struct evbuffer_chain *chain = buf->last;
|
||||
const u_char *data = data_in;
|
||||
const unsigned char *data = data_in;
|
||||
size_t old_len = buf->total_len, remain, to_alloc;
|
||||
|
||||
/* If there are no chains allocated for this buffer, allocate one
|
||||
@ -813,7 +813,7 @@ int
|
||||
evbuffer_read(struct evbuffer *buf, evutil_socket_t fd, int howmuch)
|
||||
{
|
||||
struct evbuffer_chain *chain = buf->last;
|
||||
u_char *p;
|
||||
unsigned char *p;
|
||||
size_t old_len = buf->total_len;
|
||||
int n = EVBUFFER_MAX_READ;
|
||||
|
||||
@ -910,12 +910,12 @@ evbuffer_write(struct evbuffer *buffer, evutil_socket_t fd)
|
||||
return (n);
|
||||
}
|
||||
|
||||
u_char *
|
||||
evbuffer_find(struct evbuffer *buffer, const u_char *what, size_t len)
|
||||
unsigned char *
|
||||
evbuffer_find(struct evbuffer *buffer, const unsigned char *what, size_t len)
|
||||
{
|
||||
u_char *search = evbuffer_pullup(buffer, -1);
|
||||
u_char *end = search + buffer->total_len;
|
||||
u_char *p;
|
||||
unsigned char *search = evbuffer_pullup(buffer, -1);
|
||||
unsigned char *end = search + buffer->total_len;
|
||||
unsigned char *p;
|
||||
|
||||
while (search < end &&
|
||||
(p = memchr(search, *what, end - search)) != NULL) {
|
||||
|
1
evdns.c
1
evdns.c
@ -132,7 +132,6 @@
|
||||
|
||||
#ifdef __USE_ISOC99B
|
||||
/* libevent doesn't work without this */
|
||||
typedef ev_uint8_t u_char;
|
||||
typedef unsigned int uint;
|
||||
#endif
|
||||
#include "event2/event.h"
|
||||
|
16
http.c
16
http.c
@ -153,7 +153,7 @@ extern int debug;
|
||||
|
||||
static int socket_connect(evutil_socket_t kefd, const char *address, unsigned short port);
|
||||
static evutil_socket_t bind_socket_ai(struct addrinfo *);
|
||||
static evutil_socket_t bind_socket(const char *, u_short);
|
||||
static evutil_socket_t bind_socket(const char *, ev_uint16_t);
|
||||
static void name_from_addr(struct sockaddr *, socklen_t, char **, char **);
|
||||
static int evhttp_associate_new_request_with_connection(
|
||||
struct evhttp_connection *evcon);
|
||||
@ -1483,7 +1483,7 @@ evhttp_connection_set_closecb(struct evhttp_connection *evcon,
|
||||
|
||||
void
|
||||
evhttp_connection_get_peer(struct evhttp_connection *evcon,
|
||||
char **address, u_short *port)
|
||||
char **address, ev_uint16_t *port)
|
||||
{
|
||||
*address = evcon->address;
|
||||
*port = evcon->port;
|
||||
@ -1788,10 +1788,10 @@ evhttp_encode_uri(const char *uri)
|
||||
char *p;
|
||||
|
||||
for (p = (char *)uri; *p != '\0'; p++) {
|
||||
if (uri_chars[(u_char)(*p)]) {
|
||||
if (uri_chars[(unsigned char)(*p)]) {
|
||||
evbuffer_add(buf, p, 1);
|
||||
} else {
|
||||
evbuffer_add_printf(buf, "%%%02X", (u_char)(*p));
|
||||
evbuffer_add_printf(buf, "%%%02X", (unsigned char)(*p));
|
||||
}
|
||||
}
|
||||
evbuffer_add(buf, "", 1);
|
||||
@ -2027,7 +2027,7 @@ accept_socket(evutil_socket_t fd, short what, void *arg)
|
||||
}
|
||||
|
||||
int
|
||||
evhttp_bind_socket(struct evhttp *http, const char *address, u_short port)
|
||||
evhttp_bind_socket(struct evhttp *http, const char *address, ev_uint16_t port)
|
||||
{
|
||||
evutil_socket_t fd;
|
||||
int res;
|
||||
@ -2114,7 +2114,7 @@ evhttp_new(struct event_base *base)
|
||||
*/
|
||||
|
||||
struct evhttp *
|
||||
evhttp_start(const char *address, u_short port)
|
||||
evhttp_start(const char *address, unsigned short port)
|
||||
{
|
||||
struct evhttp *http = evhttp_new_object();
|
||||
|
||||
@ -2576,7 +2576,7 @@ bind_socket_ai(struct addrinfo *ai)
|
||||
}
|
||||
|
||||
static struct addrinfo *
|
||||
make_addrinfo(const char *address, u_short port)
|
||||
make_addrinfo(const char *address, ev_uint16_t port)
|
||||
{
|
||||
struct addrinfo *aitop = NULL;
|
||||
|
||||
@ -2614,7 +2614,7 @@ make_addrinfo(const char *address, u_short port)
|
||||
}
|
||||
|
||||
static evutil_socket_t
|
||||
bind_socket(const char *address, u_short port)
|
||||
bind_socket(const char *address, ev_uint16_t port)
|
||||
{
|
||||
evutil_socket_t fd;
|
||||
struct addrinfo *aitop = make_addrinfo(address, port);
|
||||
|
@ -134,7 +134,7 @@ int evbuffer_expand(struct evbuffer *buf, size_t datlen);
|
||||
@see evbuffer_commit_space
|
||||
*/
|
||||
|
||||
u_char *evbuffer_reserve_space(struct evbuffer *buf, size_t size);
|
||||
unsigned char *evbuffer_reserve_space(struct evbuffer *buf, size_t size);
|
||||
|
||||
/**
|
||||
Commits previously reserved space.
|
||||
@ -306,7 +306,7 @@ int evbuffer_read(struct evbuffer *buffer, evutil_socket_t fd, int howmuch);
|
||||
@param len the length of the search string
|
||||
@return a pointer to the beginning of the search string, or NULL if the search failed.
|
||||
*/
|
||||
u_char *evbuffer_find(struct evbuffer *buffer, const u_char *what, size_t len);
|
||||
unsigned char *evbuffer_find(struct evbuffer *buffer, const unsigned char *what, size_t len);
|
||||
|
||||
/**
|
||||
Set a callback to invoke when the evbuffer is modified.
|
||||
@ -327,7 +327,7 @@ void evbuffer_setcb(struct evbuffer *buffer,
|
||||
@return a pointer to the contigous memory areay
|
||||
*/
|
||||
|
||||
u_char *evbuffer_pullup(struct evbuffer *buf, int size);
|
||||
unsigned char *evbuffer_pullup(struct evbuffer *buf, int size);
|
||||
|
||||
/**
|
||||
Prepends data to the beginning of the evbuffer
|
||||
|
@ -55,8 +55,6 @@ extern "C" {
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
typedef unsigned char u_char;
|
||||
typedef unsigned short u_short;
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -55,8 +55,6 @@ extern "C" {
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
typedef unsigned char u_char;
|
||||
typedef unsigned short u_short;
|
||||
#endif
|
||||
|
||||
struct event_watermark {
|
||||
|
@ -52,8 +52,6 @@ extern "C" {
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
typedef unsigned char u_char;
|
||||
typedef unsigned short u_short;
|
||||
#endif
|
||||
|
||||
struct event_base;
|
||||
|
@ -53,8 +53,6 @@ extern "C" {
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
typedef unsigned char u_char;
|
||||
typedef unsigned short u_short;
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -53,8 +53,6 @@ extern "C" {
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
typedef unsigned char u_char;
|
||||
typedef unsigned short u_short;
|
||||
#endif
|
||||
|
||||
#define EVLIST_TIMEOUT 0x01
|
||||
|
@ -89,7 +89,7 @@ struct evhttp *evhttp_new(struct event_base *base);
|
||||
* @return 0 on success, -1 on failure.
|
||||
* @see evhttp_free(), evhttp_accept_socket()
|
||||
*/
|
||||
int evhttp_bind_socket(struct evhttp *http, const char *address, u_short port);
|
||||
int evhttp_bind_socket(struct evhttp *http, const char *address, ev_uint16_t port);
|
||||
|
||||
/**
|
||||
* Makes an HTTP server accept connections on the specified socket
|
||||
@ -272,7 +272,7 @@ void evhttp_connection_set_closecb(struct evhttp_connection *evcon,
|
||||
|
||||
/** Get the remote address and port associated with this connection. */
|
||||
void evhttp_connection_get_peer(struct evhttp_connection *evcon,
|
||||
char **address, u_short *port);
|
||||
char **address, ev_uint16_t *port);
|
||||
|
||||
/** The connection gets ownership of the request */
|
||||
int evhttp_make_request(struct evhttp_connection *evcon,
|
||||
|
@ -53,8 +53,6 @@ extern "C" {
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
typedef unsigned char u_char;
|
||||
typedef unsigned short u_short;
|
||||
#endif
|
||||
|
||||
/**
|
||||
@ -66,7 +64,7 @@ typedef unsigned short u_short;
|
||||
* @param port the port number on which the HTTP server should listen
|
||||
* @return an struct evhttp object
|
||||
*/
|
||||
struct evhttp *evhttp_start(const char *address, u_short port);
|
||||
struct evhttp *evhttp_start(const char *address, unsigned short port);
|
||||
|
||||
/**
|
||||
* A connection object that can be used to for making HTTP requests. The
|
||||
|
@ -79,7 +79,7 @@ struct {
|
||||
|
||||
/* address of the remote host and the port connection came from */
|
||||
char *remote_host;
|
||||
u_short remote_port;
|
||||
ev_uint16_t remote_port;
|
||||
|
||||
enum evhttp_request_kind kind;
|
||||
enum evhttp_cmd_type type;
|
||||
|
@ -52,8 +52,6 @@ extern "C" {
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
typedef unsigned char u_char;
|
||||
typedef unsigned short u_short;
|
||||
#endif
|
||||
|
||||
struct evbuffer;
|
||||
|
Loading…
x
Reference in New Issue
Block a user