1
0
mirror of https://github.com/libssh2/libssh2.git synced 2026-01-06 14:21:57 +03:00

example, tests: address compiler warnings

Fix or silence all C compiler warnings discovered with (or without)
`PICKY_COMPILER=ON` (in CMake). This means all warnings showing up in
CI (gcc, clang, MSVS 2013/2015), in local tests on macOS (clang 14) and
Windows cross-builds using gcc (12) and llvm/clang (14/15).

Also fix the expression `nread -= nread` in `sftp_RW_nonblock.c`.

Cherry-picked from: #846
Closes #861
This commit is contained in:
Viktor Szakats
2023-03-20 15:46:12 +00:00
parent ec0a51db1f
commit b13936bd6a
47 changed files with 343 additions and 262 deletions

View File

@@ -65,13 +65,13 @@
#include <assert.h>
LIBSSH2_SESSION *connected_session = NULL;
int connected_socket = -1;
libssh2_socket_t connected_socket = LIBSSH2_INVALID_SOCKET;
static int connect_to_server(void)
{
int rc;
connected_socket = open_socket_to_openssh_server();
if(connected_socket <= 0) {
if(connected_socket == LIBSSH2_INVALID_SOCKET) {
return -1;
}
@@ -91,7 +91,7 @@ static void setup_fixture_workdir(void)
#else
char wd_buf[MAXPATHLEN];
#endif
char *wd = getenv("FIXTURE_WORKDIR");
const char *wd = getenv("FIXTURE_WORKDIR");
#ifdef FIXTURE_WORKDIR
if(!wd) {
wd = FIXTURE_WORKDIR;