Repository navigation
Conversation
``` tests/session_fixture.c:97:12: warning: assigning to 'char *' from 'const char[...]' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers] tests/session_fixture.c:97:12: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] ```
```
example/subsystem_netconf.c:63:..: warning C4244: '=': conversion from 'ssize_t' to 'int', possible loss of data
example/subsystem_netconf.c:63:13: warning: implicit conversion loses integer precision: 'ssize_t' (aka 'long long') to 'int' [-Wshorten-64-to-32]
example/subsystem_netconf.c:63:13: warning: implicit conversion loses integer precision: 'ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
example/subsystem_netconf.c:114:..: warning C4267: 'return': conversion from 'size_t' to 'int', possible loss of data
example/subsystem_netconf.c:114:12: warning: conversion from 'size_t' {aka 'long long unsigned int'} to 'int' may change value [-Wconversion]
example/subsystem_netconf.c:114:12: warning: conversion from 'size_t' {aka 'long unsigned int'} to 'int' may change value [-Wconversion]
example/subsystem_netconf.c:114:12: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long long') to 'int' [-Wshorten-64-to-32]
example/subsystem_netconf.c:114:12: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]
```
```
example/sftp_append.c:216:..: warning C4244: '=': conversion from 'ssize_t' to 'int', possible loss of data
example/sftp_append.c:216:18: warning: conversion from 'ssize_t' {aka 'long int'} to 'int' may change value [-Wconversion]
example/sftp_append.c:216:18: warning: conversion from 'ssize_t' {aka 'long long int'} to 'int' may change value [-Wconversion]
example/sftp_append.c:216:18: warning: implicit conversion loses integer precision: 'ssize_t' (aka 'long long') to 'int' [-Wshorten-64-to-32]
example/sftp_append.c:216:18: warning: implicit conversion loses integer precision: 'ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
```
Also fix `nread -= nread` in `sftp_RW_nonblock.c`.
``` tests/openssh_fixture.c:116:..: warning C4267: 'function': conversion from 'size_t' to 'int', possible loss of data tests/openssh_fixture.c:116:42: warning: conversion from 'long long unsigned int' to 'int' may change value [-Wconversion] tests/openssh_fixture.c:116:42: warning: conversion from 'long unsigned int' to 'int' may change value [-Wconversion] tests/openssh_fixture.c:116:42: warning: implicit conversion loses integer precision: 'unsigned long long' to 'int' [-Wshorten-64-to-32] tests/openssh_fixture.c:116:42: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32] ```
``` example/scp_write_nonblock.c:262:29: warning: implicit conversion from 'long' to 'double' may lose precision [-Wimplicit-int-float-conversion] example/scp_write_nonblock.c:262:34: warning: conversion from 'long int' to 'double' may change value [-Wconversion] example/sftp_write_nonblock.c:272:29: warning: implicit conversion from 'long' to 'double' may lose precision [-Wimplicit-int-float-conversion] example/sftp_write_nonblock.c:272:34: warning: conversion from 'long int' to 'double' may change value [-Wconversion] example/sftp_write_sliding.c:282:29: warning: implicit conversion from 'long' to 'double' may lose precision [-Wimplicit-int-float-conversion] example/sftp_write_sliding.c:282:34: warning: conversion from 'long int' to 'double' may change value [-Wconversion] ```
It's an unused arg on that platform.
```
example/direct_tcpip.c:264:..: warning C4244: 'function': conversion from 'libssh2_socket_t' to 'int', possible loss of data
example/direct_tcpip.c:264:33: warning: conversion from 'libssh2_socket_t' {aka 'long long unsigned int'} to 'int' may change value [-Wconversion]
example/direct_tcpip.c:264:33: warning: implicit conversion loses integer precision: 'unsigned long long' to 'int' [-Wshorten-64-to-32]
example/scp_nonblock.c:81:..: warning C4244: 'function': conversion from 'libssh2_socket_t' to 'int', possible loss of data
example/scp_nonblock.c:81:27: warning: conversion from 'libssh2_socket_t' {aka 'long long unsigned int'} to 'int' may change value [-Wconversion]
example/scp_nonblock.c:81:27: warning: implicit conversion loses integer precision: 'unsigned long long' to 'int' [-Wshorten-64-to-32]
example/scp_write_nonblock.c:68:..: warning C4244: 'function': conversion from 'libssh2_socket_t' to 'int', possible loss of data
example/scp_write_nonblock.c:68:27: warning: conversion from 'libssh2_socket_t' {aka 'long long unsigned int'} to 'int' may change value [-Wconversion]
example/scp_write_nonblock.c:68:27: warning: implicit conversion loses integer precision: 'unsigned long long' to 'int' [-Wshorten-64-to-32]
example/sftp_RW_nonblock.c:75:..: warning C4244: 'function': conversion from 'libssh2_socket_t' to 'int', possible loss of data
example/sftp_RW_nonblock.c:75:27: warning: conversion from 'libssh2_socket_t' {aka 'long long unsigned int'} to 'int' may change value [-Wconversion]
example/sftp_RW_nonblock.c:75:27: warning: implicit conversion loses integer precision: 'unsigned long long' to 'int' [-Wshorten-64-to-32]
example/sftp_RW_nonblock.c:268:..: warning C4244: 'function': conversion from 'libssh2_socket_t' to 'int', possible loss of data
example/sftp_RW_nonblock.c:268:26: warning: conversion from 'libssh2_socket_t' {aka 'long long unsigned int'} to 'int' may change value [-Wconversion]
example/sftp_RW_nonblock.c:268:26: warning: implicit conversion loses integer precision: 'unsigned long long' to 'int' [-Wshorten-64-to-32]
example/sftp_RW_nonblock.c:328:..: warning C4244: 'function': conversion from 'libssh2_socket_t' to 'int', possible loss of data
example/sftp_RW_nonblock.c:328:30: warning: conversion from 'libssh2_socket_t' {aka 'long long unsigned int'} to 'int' may change value [-Wconversion]
example/sftp_RW_nonblock.c:328:30: warning: implicit conversion loses integer precision: 'unsigned long long' to 'int' [-Wshorten-64-to-32]
example/sftp_nonblock.c:86:..: warning C4244: 'function': conversion from 'libssh2_socket_t' to 'int', possible loss of data
example/sftp_nonblock.c:86:27: warning: conversion from 'libssh2_socket_t' {aka 'long long unsigned int'} to 'int' may change value [-Wconversion]
example/sftp_nonblock.c:86:27: warning: implicit conversion loses integer precision: 'unsigned long long' to 'int' [-Wshorten-64-to-32]
example/sftp_write_nonblock.c:74:..: warning C4244: 'function': conversion from 'libssh2_socket_t' to 'int', possible loss of data
example/sftp_write_nonblock.c:74:27: warning: conversion from 'libssh2_socket_t' {aka 'long long unsigned int'} to 'int' may change value [-Wconversion]
example/sftp_write_nonblock.c:74:27: warning: implicit conversion loses integer precision: 'unsigned long long' to 'int' [-Wshorten-64-to-32]
example/sftp_write_sliding.c:74:..: warning C4244: 'function': conversion from 'libssh2_socket_t' to 'int', possible loss of data
example/sftp_write_sliding.c:74:27: warning: conversion from 'libssh2_socket_t' {aka 'long long unsigned int'} to 'int' may change value [-Wconversion]
example/sftp_write_sliding.c:74:27: warning: implicit conversion loses integer precision: 'unsigned long long' to 'int' [-Wshorten-64-to-32]
example/ssh2_agent_forwarding.c:79:..: warning C4244: 'function': conversion from 'libssh2_socket_t' to 'int', possible loss of data
example/ssh2_agent_forwarding.c:79:27: warning: conversion from 'libssh2_socket_t' {aka 'long long unsigned int'} to 'int' may change value [-Wconversion]
example/ssh2_agent_forwarding.c:79:27: warning: implicit conversion loses integer precision: 'unsigned long long' to 'int' [-Wshorten-64-to-32]
example/ssh2_echo.c:75:..: warning C4244: 'function': conversion from 'libssh2_socket_t' to 'int', possible loss of data
example/ssh2_echo.c:75:27: warning: conversion from 'libssh2_socket_t' {aka 'long long unsigned int'} to 'int' may change value [-Wconversion]
example/ssh2_echo.c:75:27: warning: implicit conversion loses integer precision: 'unsigned long long' to 'int' [-Wshorten-64-to-32]
example/ssh2_exec.c:77:..: warning C4244: 'function': conversion from 'libssh2_socket_t' to 'int', possible loss of data
example/ssh2_exec.c:77:27: warning: conversion from 'libssh2_socket_t' {aka 'long long unsigned int'} to 'int' may change value [-Wconversion]
example/ssh2_exec.c:77:27: warning: implicit conversion loses integer precision: 'unsigned long long' to 'int' [-Wshorten-64-to-32]
example/tcpip-forward.c:254:..: warning C4244: 'function': conversion from 'libssh2_socket_t' to 'int', possible loss of data
example/tcpip-forward.c:254:33: warning: conversion from 'libssh2_socket_t' {aka 'long long unsigned int'} to 'int' may change value [-Wconversion]
example/tcpip-forward.c:254:33: warning: implicit conversion loses integer precision: 'unsigned long long' to 'int' [-Wshorten-64-to-32]
```
cast to long instead. LIBSSH2_STRUCT_STAT_SIZE_FORMAT generates
warnings and/or errors depending on platform.
linux / clang / x64:
```
scp_nonblock.c:279:63: error: format specifies type 'long long' but the argument has type 'libssh2_struct_stat_size' (aka 'long') [-Werror,-Wformat]
" in %ld ms = %.1f bytes/sec spin: %d\n", total,
^~~~~
1 error generated.
```
Ref: https://github.com/libssh2/libssh2/actions/runs/4436663090/jobs/7785373909
gcc: (clang was OK)
```
sftpdir.c:287:28: warning: unknown conversion type character 'I' in format [-Wformat=]
287 | printf("%8" __FILESIZE " ", attrs.filesize);
| ^~~~
sftpdir.c:50:21: note: format string is defined here
50 | #define __FILESIZE "I64u"
| ^
sftpdir.c:287:28: warning: too many arguments for format [-Wformat-extra-args]
287 | printf("%8" __FILESIZE " ", attrs.filesize);
| ^~~~
sftpdir_nonblock.c:227:24: warning: unknown conversion type character 'I' in format [-Wformat=]
227 | printf("%8" __FILESIZE " ", attrs.filesize);
| ^~~~
sftpdir_nonblock.c:50:21: note: format string is defined here
50 | #define __FILESIZE "I64u"
| ^
sftpdir_nonblock.c:227:24: warning: too many arguments for format [-Wformat-extra-args]
227 | printf("%8" __FILESIZE " ", attrs.filesize);
| ^~~~
```
Fixes:
```
example/scp.c:96:27: warning: conversion from 'long unsigned int' to 'in_addr_t' {aka 'unsigned int'} may change value [-Wconversion]
example/scp.c:96:27: warning: implicit conversion loses integer precision: 'unsigned long' to 'in_addr_t' (aka 'unsigned int') [-Wshorten-64-to-32]
example/scp_nonblock.c:150:27: warning: conversion from 'long unsigned int' to 'in_addr_t' {aka 'unsigned int'} may change value [-Wconversion]
example/scp_nonblock.c:150:27: warning: implicit conversion loses integer precision: 'unsigned long' to 'in_addr_t' (aka 'unsigned int') [-Wshorten-64-to-32]
example/scp_write.c:119:27: warning: conversion from 'long unsigned int' to 'in_addr_t' {aka 'unsigned int'} may change value [-Wconversion]
example/scp_write.c:119:27: warning: implicit conversion loses integer precision: 'unsigned long' to 'in_addr_t' (aka 'unsigned int') [-Wshorten-64-to-32]
example/scp_write_nonblock.c:149:27: warning: conversion from 'long unsigned int' to 'in_addr_t' {aka 'unsigned int'} may change value [-Wconversion]
example/scp_write_nonblock.c:149:27: warning: implicit conversion loses integer precision: 'unsigned long' to 'in_addr_t' (aka 'unsigned int') [-Wshorten-64-to-32]
example/sftp.c:160:27: warning: conversion from 'long unsigned int' to 'in_addr_t' {aka 'unsigned int'} may change value [-Wconversion]
example/sftp.c:160:27: warning: implicit conversion loses integer precision: 'unsigned long' to 'in_addr_t' (aka 'unsigned int') [-Wshorten-64-to-32]
example/sftp_append.c:114:27: warning: conversion from 'long unsigned int' to 'in_addr_t' {aka 'unsigned int'} may change value [-Wconversion]
example/sftp_append.c:114:27: warning: implicit conversion loses integer precision: 'unsigned long' to 'in_addr_t' (aka 'unsigned int') [-Wshorten-64-to-32]
example/sftp_mkdir.c:98:27: warning: conversion from 'long unsigned int' to 'in_addr_t' {aka 'unsigned int'} may change value [-Wconversion]
example/sftp_mkdir.c:98:27: warning: implicit conversion loses integer precision: 'unsigned long' to 'in_addr_t' (aka 'unsigned int') [-Wshorten-64-to-32]
example/sftp_mkdir_nonblock.c:98:27: warning: conversion from 'long unsigned int' to 'in_addr_t' {aka 'unsigned int'} may change value [-Wconversion]
example/sftp_mkdir_nonblock.c:98:27: warning: implicit conversion loses integer precision: 'unsigned long' to 'in_addr_t' (aka 'unsigned int') [-Wshorten-64-to-32]
example/sftp_nonblock.c:155:27: warning: conversion from 'long unsigned int' to 'in_addr_t' {aka 'unsigned int'} may change value [-Wconversion]
example/sftp_nonblock.c:155:27: warning: implicit conversion loses integer precision: 'unsigned long' to 'in_addr_t' (aka 'unsigned int') [-Wshorten-64-to-32]
example/sftp_write.c:113:27: warning: conversion from 'long unsigned int' to 'in_addr_t' {aka 'unsigned int'} may change value [-Wconversion]
example/sftp_write.c:113:27: warning: implicit conversion loses integer precision: 'unsigned long' to 'in_addr_t' (aka 'unsigned int') [-Wshorten-64-to-32]
example/sftp_write_nonblock.c:153:27: warning: conversion from 'long unsigned int' to 'in_addr_t' {aka 'unsigned int'} may change value [-Wconversion]
example/sftp_write_nonblock.c:153:27: warning: implicit conversion loses integer precision: 'unsigned long' to 'in_addr_t' (aka 'unsigned int') [-Wshorten-64-to-32]
example/sftp_write_sliding.c:153:27: warning: conversion from 'long unsigned int' to 'in_addr_t' {aka 'unsigned int'} may change value [-Wconversion]
example/sftp_write_sliding.c:153:27: warning: implicit conversion loses integer precision: 'unsigned long' to 'in_addr_t' (aka 'unsigned int') [-Wshorten-64-to-32]
example/sftpdir.c:134:27: warning: conversion from 'long unsigned int' to 'in_addr_t' {aka 'unsigned int'} may change value [-Wconversion]
example/sftpdir.c:134:27: warning: implicit conversion loses integer precision: 'unsigned long' to 'in_addr_t' (aka 'unsigned int') [-Wshorten-64-to-32]
example/sftpdir_nonblock.c:114:27: warning: conversion from 'long unsigned int' to 'in_addr_t' {aka 'unsigned int'} may change value [-Wconversion]
example/sftpdir_nonblock.c:114:27: warning: implicit conversion loses integer precision: 'unsigned long' to 'in_addr_t' (aka 'unsigned int') [-Wshorten-64-to-32]
example/ssh2.c:128:27: warning: conversion from 'long unsigned int' to 'in_addr_t' {aka 'unsigned int'} may change value [-Wconversion]
example/ssh2.c:128:27: warning: implicit conversion loses integer precision: 'unsigned long' to 'in_addr_t' (aka 'unsigned int') [-Wshorten-64-to-32]
example/ssh2_agent.c:100:27: warning: conversion from 'long unsigned int' to 'in_addr_t' {aka 'unsigned int'} may change value [-Wconversion]
example/ssh2_agent.c:100:27: warning: implicit conversion loses integer precision: 'unsigned long' to 'in_addr_t' (aka 'unsigned int') [-Wshorten-64-to-32]
example/ssh2_agent_forwarding.c:133:27: warning: conversion from 'long unsigned int' to 'in_addr_t' {aka 'unsigned int'} may change value [-Wconversion]
example/ssh2_agent_forwarding.c:133:27: warning: implicit conversion loses integer precision: 'unsigned long' to 'in_addr_t' (aka 'unsigned int') [-Wshorten-64-to-32]
example/ssh2_echo.c:139:27: warning: conversion from 'long unsigned int' to 'in_addr_t' {aka 'unsigned int'} may change value [-Wconversion]
example/ssh2_echo.c:139:27: warning: implicit conversion loses integer precision: 'unsigned long' to 'in_addr_t' (aka 'unsigned int') [-Wshorten-64-to-32]
example/ssh2_exec.c:143:27: warning: conversion from 'long unsigned int' to 'in_addr_t' {aka 'unsigned int'} may change value [-Wconversion]
example/ssh2_exec.c:143:27: warning: implicit conversion loses integer precision: 'unsigned long' to 'in_addr_t' (aka 'unsigned int') [-Wshorten-64-to-32]
tests/openssh_fixture.c:395:27: warning: conversion from 'long unsigned int' to 'in_addr_t' {aka 'unsigned int'} may change value [-Wconversion]
tests/openssh_fixture.c:395:27: warning: implicit conversion loses integer precision: 'unsigned long' to 'in_addr_t' (aka 'unsigned int') [-Wshorten-64-to-32]
```
6 tasks done
vszakats
added a commit
to vszakats/libssh2
that referenced
this pull request
Jun 25, 2023
Regression from b13936b libssh2#861 libssh2#846. Update a variable name missed in above. Reported-by: PewPewPew Fixes libssh2#1105 Closes libssh2#1106
vszakats
added a commit
that referenced
this pull request
Jun 25, 2023
lampmanyao
pushed a commit
to lampmanyao/libssh2
that referenced
this pull request
Jul 16, 2023
Regression from b13936b libssh2#861 libssh2#846. Update a variable name missed above. Reported-by: PewPewPew Fixes libssh2#1105 Closes libssh2#1106
agreppin
pushed a commit
to agreppin/libssh2
that referenced
this pull request
Jul 14, 2024
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: libssh2#846 Closes libssh2#861
agreppin
pushed a commit
to agreppin/libssh2
that referenced
this pull request
Jul 14, 2024
Regression from b13936b libssh2#861 libssh2#846. Update a variable name missed above. Reported-by: PewPewPew Fixes libssh2#1105 Closes libssh2#1106
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix or silence all C compiler warnings discovered with (or without)
PICKY_COMPILER=ON(in CMake). This means all warnings showing up inCI (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 -= nreadinsftp_RW_nonblock.c.Cherry-picked from: #846
Closes #861
Partial list of warnings fixed:
linux / clang / x64:
Ref: https://github.com/libssh2/libssh2/actions/runs/4436663090/jobs/7785373909
gcc: