From 5cde554569497922b48bf1315d99165141edde97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Thu, 27 Oct 2022 23:45:29 +0800 Subject: [PATCH] fix -Wpointer-to-int-cast --- server.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server.c b/server.c index d6e17ba..3759ed9 100644 --- a/server.c +++ b/server.c @@ -581,7 +581,7 @@ static int s5_md5(thread_timer_t *timer) { } static void handle_quit(int signo) { - uint32_t index = (uint32_t)(pthread_getspecific(pthread_key_index)); + uint32_t index = (uint32_t)((uintptr_t)pthread_getspecific(pthread_key_index)); printf("Handle sigquit@%d\n", index-1); fflush(stdout); if(index) { @@ -592,7 +592,7 @@ static void handle_quit(int signo) { } static void handle_segv(int signo) { - uint32_t index = (uint32_t)(pthread_getspecific(pthread_key_index)); + uint32_t index = (uint32_t)((uintptr_t)pthread_getspecific(pthread_key_index)); printf("Handle sigsegv@%d\n", index-1); fflush(stdout); if(index) { @@ -615,7 +615,7 @@ static void handle_int(int signo) { } static void handle_pipe(int signo) { - uint32_t index = (uint32_t)(pthread_getspecific(pthread_key_index)); + uint32_t index = (uint32_t)((uintptr_t)pthread_getspecific(pthread_key_index)); printf("Pipe error@%d, break loop...\n", index-1); fflush(stdout); if(index) { @@ -1002,7 +1002,7 @@ int main(int argc, char *argv[]) { perror("fopen"); return 7; } - if(~((int)fp)) { + if(~((uintptr_t)fp)) { uint8_t buf[8+sizeof(config_t)]; SIMPLE_PB* spb = read_pb_into(fp, (SIMPLE_PB*)buf); if(!spb) {