Skip to content

Commit ceb6551

Browse files
panjf2000azat
authored andcommitted
gcc: fix the -Wincompatible-pointer-types errors
--------- Signed-off-by: Andy Pan <[email protected]>
1 parent 9e89a40 commit ceb6551

File tree

5 files changed

+23
-14
lines changed

5 files changed

+23
-14
lines changed

evutil.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3150,7 +3150,11 @@ evutil_set_tcp_keepalive(evutil_socket_t fd, int on, int timeout)
31503150
if (timeout <= 0)
31513151
return 0;
31523152

3153+
#ifdef _WIN32
3154+
if (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, (const char*)&on, sizeof(on)))
3155+
#else
31533156
if (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &on, sizeof(on)))
3157+
#endif
31543158
return -1;
31553159
if (!on)
31563160
return 0;
@@ -3164,14 +3168,14 @@ evutil_set_tcp_keepalive(evutil_socket_t fd, int on, int timeout)
31643168
* Windows 10 version 1709, but let's gamble here.
31653169
*/
31663170
#if defined(TCP_KEEPIDLE) && defined(TCP_KEEPINTVL) && defined(TCP_KEEPCNT)
3167-
if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE, &idle, sizeof(idle)))
3171+
if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE, (const char*)&idle, sizeof(idle)))
31683172
return -1;
31693173

3170-
if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPINTVL, &intvl, sizeof(intvl)))
3174+
if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPINTVL, (const char*)&intvl, sizeof(intvl)))
31713175
return -1;
31723176

31733177
cnt = 3;
3174-
if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPCNT, &cnt, sizeof(cnt)))
3178+
if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPCNT, (const char*)&cnt, sizeof(cnt)))
31753179
return -1;
31763180

31773181
/* For those versions prior to Windows 10 version 1709, we fall back to SIO_KEEPALIVE_VALS.

test/regress.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1369,7 +1369,9 @@ test_signal_while_processing(void)
13691369
#endif // \_WIN32
13701370

13711371
#ifndef EVENT__DISABLE_THREAD_SUPPORT
1372-
static void* del_wait_thread(void *arg)
1372+
1373+
static THREAD_FN
1374+
del_wait_thread(void *arg)
13731375
{
13741376
struct timeval tv_start, tv_end;
13751377

@@ -1380,7 +1382,7 @@ static void* del_wait_thread(void *arg)
13801382
test_timeval_diff_eq(&tv_start, &tv_end, 300);
13811383

13821384
end:
1383-
return NULL;
1385+
THREAD_RETURN();
13841386
}
13851387

13861388
static void
@@ -1431,11 +1433,14 @@ test_del_wait(void)
14311433
}
14321434

14331435
static void null_cb(evutil_socket_t fd, short what, void *arg) {}
1434-
static void* test_del_notify_thread(void *arg)
1436+
1437+
static THREAD_FN
1438+
test_del_notify_thread(void *arg)
14351439
{
14361440
event_dispatch();
1437-
return NULL;
1441+
THREAD_RETURN();
14381442
}
1443+
14391444
static void
14401445
test_del_notify(void)
14411446
{

test/regress_dns.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1307,7 +1307,7 @@ dns_nameservers_no_nameservers_configured_test(void *arg)
13071307
const char filecontents[] = "# tmp empty resolv.conf\n";
13081308
const size_t filecontentssize = sizeof(filecontents);
13091309
int ok;
1310-
1310+
13111311
fd = regress_make_tmpfile(filecontents, filecontentssize, &tmpfilename);
13121312
if (fd < 0)
13131313
tt_skip();
@@ -2542,14 +2542,14 @@ struct race_param
25422542

25432543
int locked;
25442544
};
2545-
static void *
2545+
static THREAD_FN
25462546
race_base_run(void *arg)
25472547
{
25482548
struct race_param *rp = (struct race_param *)arg;
25492549
event_base_loop(rp->base, EVLOOP_NO_EXIT_ON_EMPTY);
25502550
THREAD_RETURN();
25512551
}
2552-
static void *
2552+
static THREAD_FN
25532553
race_busywait_run(void *arg)
25542554
{
25552555
struct race_param *rp = (struct race_param *)arg;

test/regress_http.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1811,7 +1811,7 @@ http_cancel_test(void *arg)
18111811
tt_assert(evcon);
18121812
if (type & INACTIVE_SERVER)
18131813
evhttp_connection_set_timeout(evcon, 5);
1814-
1814+
18151815

18161816
bufev = evhttp_connection_get_bufferevent(evcon);
18171817
/* Guarantee that we stack in connect() not after waiting EV_READ after
@@ -3545,7 +3545,7 @@ http_base_test(void *ptr)
35453545
const char *http_request;
35463546
ev_uint16_t port = 0;
35473547
struct evhttp *http;
3548-
3548+
35493549
test_ok = 0;
35503550
base = event_base_new();
35513551
tt_assert(base);
@@ -5802,7 +5802,7 @@ http_error_callback_test(void *arg)
58025802
evhttp_free(http);
58035803
}
58045804

5805-
static void http_add_output_buffer(int fd, short events, void *arg)
5805+
static void http_add_output_buffer(evutil_socket_t fd, short events, void *arg)
58065806
{
58075807
evbuffer_add(arg, POST_DATA, strlen(POST_DATA));
58085808
}

test/regress_listener.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ disable_thread(void * arg)
331331
{
332332
struct evconnlistener *lev = (struct evconnlistener *)arg;
333333
evconnlistener_disable(lev);
334-
return NULL;
334+
THREAD_RETURN();
335335
}
336336

337337
static void

0 commit comments

Comments
 (0)