tests: fix some compile warnings on windows

This commit is contained in:
Bert Belder 2012-10-16 17:21:07 +02:00
parent 36b1e1a57c
commit c5e1140779
3 changed files with 6 additions and 6 deletions

View File

@ -43,7 +43,8 @@ struct receiver_state {
uv_udp_t udp_handle;
};
static unsigned int packet_counter = 1e6; /* not used in timed mode */
/* not used in timed mode */
static unsigned int packet_counter = (unsigned int) 1e6;
static int n_senders_;
static int n_receivers_;
@ -190,7 +191,8 @@ static int do_packet_storm(int n_senders,
duration = uv_hrtime();
ASSERT(0 == uv_run(loop));
duration = uv_hrtime() - duration;
duration = duration / 1e6; /* convert from nanoseconds to milliseconds */
/* convert from nanoseconds to milliseconds */
duration = duration / (uint64_t) 1e6;
printf("udp_packet_storm_%dv%d: %.0f/s received, %.0f/s sent. "
"%u received, %u sent in %.1f seconds.\n",

View File

@ -50,7 +50,6 @@ static void startup(void) {
static uv_os_sock_t create_tcp_socket(void) {
uv_os_sock_t sock;
int r;
sock = socket(AF_INET, SOCK_STREAM, IPPROTO_IP);
#ifdef _WIN32
@ -63,7 +62,7 @@ static uv_os_sock_t create_tcp_socket(void) {
{
/* Allow reuse of the port. */
int yes = 1;
r = setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof yes);
int r = setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof yes);
ASSERT(r == 0);
}
#endif

View File

@ -46,7 +46,6 @@ static void startup(void) {
static uv_os_sock_t create_udp_socket(void) {
uv_os_sock_t sock;
int r;
sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP);
#ifdef _WIN32
@ -59,7 +58,7 @@ static uv_os_sock_t create_udp_socket(void) {
{
/* Allow reuse of the port. */
int yes = 1;
r = setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof yes);
int r = setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof yes);
ASSERT(r == 0);
}
#endif