mirror of
https://github.com/libssh2/libssh2.git
synced 2025-07-28 01:41:49 +03:00
build: more fixes and tidy-up (mostly for Windows)
- cmake: always link `ws2_32` on Windows. Also add it to `libssh2.pc`. Fixes #745 - agent: fix gcc compiler warning: `src/agent.c:296:35: warning: 'snprintf' output truncated before the last format character [-Wformat-truncation=]` - autotools: fix `EVP_aes_128_ctr` detection with binutils `ld` The prerequisite for a successful detection is setting `LIBS=-lbcrypt` if the chosen openssl-compatible library requires it, e.g. libressl, or quictls/openssl built with `-DUSE_BCRYPTGENRANDOM`. With llvm `lld`, detection works out of the box. With binutils `ld`, it does not. The reason is `ld`s world-famous pickiness with lib order. To fix it, we pass all custom libs before and after the TLS libs. This ugly hack makes `ld` happy and detection succeed. - agent: fix Windows-specific warning: `src/agent.c:318:10: warning: implicit conversion loses integer precision: 'LRESULT' (aka 'long long') to 'int' [-Wshorten-64-to-32]` - src: fix llvm/clang compiler warning: `src/libssh2_priv.h:987:28: warning: variadic macros are a C99 feature [-Wvariadic-macros]` - src: support `inline` with `__GNUC__` (llvm/clang and gcc), fixing: ``` src/libssh2_priv.h:990:8: warning: extension used [-Wlanguage-extension-token] static inline void ^ ``` - blowfish: support `inline` keyword with MSVC. Also switch to `__inline__` (from `__inline`) for `__GNUC__`: https://gcc.gnu.org/onlinedocs/gcc/Inline.html https://clang.llvm.org/docs/UsersManual.html#differences-between-various-standard-modes - example/test: fix MSVC compiler warnings: - `example\direct_tcpip.c(209): warning C4244: 'function': conversion from 'unsigned int' to 'u_short', possible loss of data` - `tests\session_fixture.c(96): warning C4013: 'getcwd' undefined; assuming extern returning int` - `tests\session_fixture.c(100): warning C4013: 'chdir' undefined; assuming extern returning int` - delete unused macros: - `HAVE_SOCKET` - `HAVE_INET_ADDR` - `NEED_LIB_NSL` - `NEED_LIB_SOCKET` - `HAVE_NTSTATUS_H` - `HAVE_NTDEF_H` - build: delete stale zlib/openssl version numbers from path defaults. - cmake: convert tabs to spaces, add newline at EOFs. Closes #811
This commit is contained in:
@ -36,7 +36,6 @@
|
||||
include(CheckIncludeFiles)
|
||||
include(CheckSymbolExists)
|
||||
include(CopyRuntimeDependencies)
|
||||
include(SocketLibraries)
|
||||
|
||||
set(EXAMPLES
|
||||
direct_tcpip
|
||||
@ -63,8 +62,6 @@ set(EXAMPLES
|
||||
subsystem_netconf
|
||||
tcpip-forward)
|
||||
|
||||
append_needed_socket_libraries(LIBRARIES)
|
||||
|
||||
foreach(example ${EXAMPLES})
|
||||
add_executable(example-${example} ${example}.c)
|
||||
list(APPEND EXAMPLE_TARGETS example-${example})
|
||||
|
@ -206,7 +206,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
sin.sin_family = AF_INET;
|
||||
sin.sin_port = htons(local_listenport);
|
||||
sin.sin_port = htons((unsigned short)local_listenport);
|
||||
sin.sin_addr.s_addr = inet_addr(local_listenip);
|
||||
if(INADDR_NONE == sin.sin_addr.s_addr) {
|
||||
perror("inet_addr");
|
||||
|
@ -229,7 +229,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
sin.sin_family = AF_INET;
|
||||
sin.sin_port = htons(local_destport);
|
||||
sin.sin_port = htons((unsigned short)local_destport);
|
||||
sin.sin_addr.s_addr = inet_addr(local_destip);
|
||||
if(INADDR_NONE == sin.sin_addr.s_addr) {
|
||||
perror("inet_addr");
|
||||
|
Reference in New Issue
Block a user