Skip to content

Commit 52a243b

Browse files
apply change for const cast of socket fd
1 parent 181aaa6 commit 52a243b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

code/logic/network.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const char *fossil_nstream_last_error(void) {
5252
return fossil_last_error;
5353
}
5454

55-
static int fossil_socket_init() {
55+
static int fossil_socket_init(void) {
5656
#ifdef _WIN32
5757
WSADATA wsa;
5858
return WSAStartup(MAKEWORD(2,2), &wsa);
@@ -61,7 +61,7 @@ static int fossil_socket_init() {
6161
#endif
6262
}
6363

64-
static void fossil_socket_cleanup() {
64+
static void fossil_socket_cleanup(void) {
6565
#ifdef _WIN32
6666
WSACleanup();
6767
#endif
@@ -246,7 +246,7 @@ int fossil_nstream_listen(fossil_nstream_t *stream, const char *host, int port)
246246
}
247247

248248
stream->socket_fd = fossil_create_socket(stream->protocol);
249-
if (stream->socket_fd < 0) {
249+
if (stream->socket_fd == (socket_t)-1) {
250250
return -1;
251251
}
252252

@@ -332,7 +332,7 @@ ssize_t fossil_nstream_send(fossil_nstream_t *stream, const void *buffer, size_t
332332
}
333333

334334
ssize_t fossil_nstream_recv(fossil_nstream_t *stream, void *buffer, size_t size) {
335-
if (!stream || stream->socket_fd < 0) {
335+
if (!stream || stream->socket_fd == (socket_t)-1) {
336336
fossil_set_last_error("Invalid stream or socket");
337337
return -1;
338338
}
@@ -348,7 +348,7 @@ ssize_t fossil_nstream_recv(fossil_nstream_t *stream, void *buffer, size_t size)
348348
}
349349

350350
void fossil_nstream_close(fossil_nstream_t *stream) {
351-
if (!stream || (socket_t)(stream->socket_fd) < 0) return;
351+
if (!stream || stream->socket_fd == (socket_t)-1) return;
352352
#ifdef _WIN32
353353
closesocket(stream->socket_fd);
354354
#else

0 commit comments

Comments
 (0)