Skip to content

Commit 2ef1518

Browse files
committed
silence STDC warnings in on windows, fix file descriptor type.
1 parent 180a09e commit 2ef1518

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

test.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
/* turn of windows warnings for _strcmp etc. */
2+
#define _CRT_NONSTDC_NO_DEPRECATE
3+
14
#include "fmacros.h"
25
#include "sockcompat.h"
36
#include <stdio.h>
@@ -173,7 +176,7 @@ static void send_client_tracking(redisContext *c, const char *str) {
173176
freeReplyObject(reply);
174177
}
175178

176-
static int disconnect(redisContext *c, int keep_fd) {
179+
static redisFD disconnect(redisContext *c, int keep_fd) {
177180
redisReply *reply;
178181

179182
/* Make sure we're on DB 9. */
@@ -186,9 +189,9 @@ static int disconnect(redisContext *c, int keep_fd) {
186189

187190
/* Free the context as well, but keep the fd if requested. */
188191
if (keep_fd)
189-
return redisFreeKeepFd(c);
192+
return (int)redisFreeKeepFd(c);
190193
redisFree(c);
191-
return -1;
194+
return REDIS_INVALID_FD;
192195
}
193196

194197
static void do_ssl_handshake(redisContext *c) {
@@ -217,8 +220,8 @@ static redisContext *do_connect(struct config config) {
217220
/* Create a dummy connection just to get an fd to inherit */
218221
redisContext *dummy_ctx = redisConnectUnix(config.unix_sock.path);
219222
if (dummy_ctx) {
220-
int fd = disconnect(dummy_ctx, 1);
221-
printf("Connecting to inherited fd %d\n", fd);
223+
redisFD fd = disconnect(dummy_ctx, 1);
224+
printf("Connecting to inherited fd %d\n", (int)fd);
222225
c = redisConnectFd(fd);
223226
}
224227
} else {

0 commit comments

Comments
 (0)