From 2ef15188657f17bf27a8daa16a84b0d59da483e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristj=C3=A1n=20Valur=20J=C3=B3nsson?= Date: Tue, 20 Apr 2021 18:08:58 +0000 Subject: [PATCH] silence STDC warnings in on windows, fix file descriptor type. --- test.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/test.c b/test.c index f991ef1e7..ffb3039e9 100644 --- a/test.c +++ b/test.c @@ -1,3 +1,6 @@ +/* turn of windows warnings for _strcmp etc. */ +#define _CRT_NONSTDC_NO_DEPRECATE + #include "fmacros.h" #include "sockcompat.h" #include @@ -173,7 +176,7 @@ static void send_client_tracking(redisContext *c, const char *str) { freeReplyObject(reply); } -static int disconnect(redisContext *c, int keep_fd) { +static redisFD disconnect(redisContext *c, int keep_fd) { redisReply *reply; /* Make sure we're on DB 9. */ @@ -186,9 +189,9 @@ static int disconnect(redisContext *c, int keep_fd) { /* Free the context as well, but keep the fd if requested. */ if (keep_fd) - return redisFreeKeepFd(c); + return (int)redisFreeKeepFd(c); redisFree(c); - return -1; + return REDIS_INVALID_FD; } static void do_ssl_handshake(redisContext *c) { @@ -217,8 +220,8 @@ static redisContext *do_connect(struct config config) { /* Create a dummy connection just to get an fd to inherit */ redisContext *dummy_ctx = redisConnectUnix(config.unix_sock.path); if (dummy_ctx) { - int fd = disconnect(dummy_ctx, 1); - printf("Connecting to inherited fd %d\n", fd); + redisFD fd = disconnect(dummy_ctx, 1); + printf("Connecting to inherited fd %d\n", (int)fd); c = redisConnectFd(fd); } } else {