use ev_uint16_t instead of unsigned short for port

Like in `sockaddr_in` structure in /usr/include/netinet/in.h

@azat: convert all other users (bench, compat, ..) and tweak message
Fixes: #178
Fixes: #196
Refs: 6bf1ca78
Link: https://codereview.appspot.com/156040043/#msg4
This commit is contained in:
Thomas Bernard 2014-12-13 19:42:42 +01:00 committed by Azat Khuzhin
parent bcb990ab7c
commit e983712456
7 changed files with 13 additions and 13 deletions

View File

@ -62,10 +62,10 @@ struct evhttp_connection {
struct event retry_ev; /* for retrying connects */ struct event retry_ev; /* for retrying connects */
char *bind_address; /* address to use for binding the src */ char *bind_address; /* address to use for binding the src */
unsigned short bind_port; /* local port for binding the src */ ev_uint16_t bind_port; /* local port for binding the src */
char *address; /* address to connect to */ char *address; /* address to connect to */
unsigned short port; ev_uint16_t port;
size_t max_headers_size; size_t max_headers_size;
ev_uint64_t max_body_size; ev_uint64_t max_body_size;

8
http.c
View File

@ -2342,14 +2342,14 @@ evhttp_read_header(struct evhttp_connection *evcon,
*/ */
struct evhttp_connection * struct evhttp_connection *
evhttp_connection_new(const char *address, unsigned short port) evhttp_connection_new(const char *address, ev_uint16_t port)
{ {
return (evhttp_connection_base_new(NULL, NULL, address, port)); return (evhttp_connection_base_new(NULL, NULL, address, port));
} }
struct evhttp_connection * struct evhttp_connection *
evhttp_connection_base_bufferevent_new(struct event_base *base, struct evdns_base *dnsbase, struct bufferevent* bev, evhttp_connection_base_bufferevent_new(struct event_base *base, struct evdns_base *dnsbase, struct bufferevent* bev,
const char *address, unsigned short port) const char *address, ev_uint16_t port)
{ {
struct evhttp_connection *evcon = NULL; struct evhttp_connection *evcon = NULL;
@ -2425,7 +2425,7 @@ evhttp_connection_get_server(struct evhttp_connection *evcon)
struct evhttp_connection * struct evhttp_connection *
evhttp_connection_base_new(struct event_base *base, struct evdns_base *dnsbase, evhttp_connection_base_new(struct event_base *base, struct evdns_base *dnsbase,
const char *address, unsigned short port) const char *address, ev_uint16_t port)
{ {
return evhttp_connection_base_bufferevent_new(base, dnsbase, NULL, address, port); return evhttp_connection_base_bufferevent_new(base, dnsbase, NULL, address, port);
} }
@ -3665,7 +3665,7 @@ evhttp_new(struct event_base *base)
*/ */
struct evhttp * struct evhttp *
evhttp_start(const char *address, unsigned short port) evhttp_start(const char *address, ev_uint16_t port)
{ {
struct evhttp *http = NULL; struct evhttp *http = NULL;

View File

@ -520,7 +520,7 @@ enum evhttp_request_kind { EVHTTP_REQUEST, EVHTTP_RESPONSE };
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
struct evhttp_connection *evhttp_connection_base_bufferevent_new( struct evhttp_connection *evhttp_connection_base_bufferevent_new(
struct event_base *base, struct evdns_base *dnsbase, struct bufferevent* bev, const char *address, unsigned short port); struct event_base *base, struct evdns_base *dnsbase, struct bufferevent* bev, const char *address, ev_uint16_t port);
/** /**
* Return the bufferevent that an evhttp_connection is using. * Return the bufferevent that an evhttp_connection is using.
@ -641,7 +641,7 @@ void evhttp_request_free(struct evhttp_request *req);
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
struct evhttp_connection *evhttp_connection_base_new( struct evhttp_connection *evhttp_connection_base_new(
struct event_base *base, struct evdns_base *dnsbase, struct event_base *base, struct evdns_base *dnsbase,
const char *address, unsigned short port); const char *address, ev_uint16_t port);
/** /**
* Set family hint for DNS requests. * Set family hint for DNS requests.

View File

@ -58,7 +58,7 @@ extern "C" {
* @param port the port number on which the HTTP server should listen * @param port the port number on which the HTTP server should listen
* @return an struct evhttp object * @return an struct evhttp object
*/ */
struct evhttp *evhttp_start(const char *address, unsigned short port); struct evhttp *evhttp_start(const char *address, ev_uint16_t port);
/** /**
* A connection object that can be used to for making HTTP requests. The * A connection object that can be used to for making HTTP requests. The
@ -68,7 +68,7 @@ struct evhttp *evhttp_start(const char *address, unsigned short port);
* @deprecated It does not allow an event base to be specified * @deprecated It does not allow an event base to be specified
*/ */
struct evhttp_connection *evhttp_connection_new( struct evhttp_connection *evhttp_connection_new(
const char *address, unsigned short port); const char *address, ev_uint16_t port);
/** /**
* Associates an event base with the connection - can only be called * Associates an event base with the connection - can only be called

View File

@ -333,7 +333,7 @@ main(int argc, char **argv)
struct evhttp *http; struct evhttp *http;
struct evhttp_bound_socket *handle; struct evhttp_bound_socket *handle;
unsigned short port = 0; ev_uint16_t port = 0;
#ifdef _WIN32 #ifdef _WIN32
WSADATA WSAData; WSADATA WSAData;
WSAStartup(0x101, &WSAData); WSAStartup(0x101, &WSAData);

View File

@ -90,7 +90,7 @@ main(int argc, char **argv)
int i; int i;
int c; int c;
int use_iocp = 0; int use_iocp = 0;
unsigned short port = 8080; ev_uint16_t port = 8080;
char *endptr = NULL; char *endptr = NULL;
#ifdef _WIN32 #ifdef _WIN32

View File

@ -164,7 +164,7 @@ http_setup(ev_uint16_t *pport, struct event_base *base, int mask)
#endif #endif
static evutil_socket_t static evutil_socket_t
http_connect(const char *address, unsigned short port) http_connect(const char *address, ev_uint16_t port)
{ {
/* Stupid code for connecting */ /* Stupid code for connecting */
struct evutil_addrinfo ai, *aitop; struct evutil_addrinfo ai, *aitop;