mirror of
https://github.com/libssh2/libssh2.git
synced 2025-07-29 13:01:14 +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:
@ -35,7 +35,8 @@ int test(LIBSSH2_SESSION *session)
|
||||
LIBSSH2_CHANNEL *channel;
|
||||
|
||||
const char *userauth_list =
|
||||
libssh2_userauth_list(session, USERNAME, strlen(USERNAME));
|
||||
libssh2_userauth_list(session, USERNAME,
|
||||
(unsigned int)strlen(USERNAME));
|
||||
if(userauth_list == NULL) {
|
||||
print_last_session_error("libssh2_userauth_list");
|
||||
return 1;
|
||||
@ -48,7 +49,7 @@ int test(LIBSSH2_SESSION *session)
|
||||
}
|
||||
|
||||
rc = libssh2_userauth_publickey_fromfile_ex(
|
||||
session, USERNAME, strlen(USERNAME),
|
||||
session, USERNAME, (unsigned int)strlen(USERNAME),
|
||||
srcdir_path(KEY_FILE_PUBLIC), srcdir_path(KEY_FILE_PRIVATE), NULL);
|
||||
if(rc != 0) {
|
||||
print_last_session_error("libssh2_userauth_publickey_fromfile_ex");
|
||||
@ -73,7 +74,7 @@ int test(LIBSSH2_SESSION *session)
|
||||
char buf[1024];
|
||||
ssize_t err = libssh2_channel_read(channel, buf, sizeof(buf));
|
||||
if(err < 0)
|
||||
fprintf(stderr, "Unable to read response: %zd\n", err);
|
||||
fprintf(stderr, "Unable to read response: %d\n", (int)err);
|
||||
else {
|
||||
int i;
|
||||
for(i = 0; i < err; ++i) {
|
||||
|
Reference in New Issue
Block a user