mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-11-23 18:49:08 +08:00
Fix compiler warning for argument of getaddrinfo
Some checks failed
CodeQL / Analyze (cpp) (push) Has been cancelled
sw / build (fedora:latest, ubuntu-22.04) (push) Has been cancelled
sw / build (macos-latest) (push) Has been cancelled
sw / build (windows-2022) (push) Has been cancelled
unittest-disablelegacy / linux (clang++-15, ubuntu-22.04) (push) Has been cancelled
unittest-disablelegacy / linux (g++, ubuntu-22.04) (push) Has been cancelled
msys2 / windows (mingw-w64-x86_64, MINGW64) (push) Has been cancelled
Some checks failed
CodeQL / Analyze (cpp) (push) Has been cancelled
sw / build (fedora:latest, ubuntu-22.04) (push) Has been cancelled
sw / build (macos-latest) (push) Has been cancelled
sw / build (windows-2022) (push) Has been cancelled
unittest-disablelegacy / linux (clang++-15, ubuntu-22.04) (push) Has been cancelled
unittest-disablelegacy / linux (g++, ubuntu-22.04) (push) Has been cancelled
msys2 / windows (mingw-w64-x86_64, MINGW64) (push) Has been cancelled
Fix this clang warning: src/viewer/svutil.cpp:277:51: warning: missing field 'ai_protocol' initializer [-Wmissing-field-initializers] Replace also PF_INET by AF_INET which is the recommended value. Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
parent
cdb7ff90e4
commit
49cbe2b47d
@ -273,8 +273,6 @@ SVNetwork::SVNetwork(const char *hostname, int port) {
|
||||
|
||||
buffer_ptr_ = nullptr;
|
||||
|
||||
struct addrinfo *addr_info = nullptr;
|
||||
struct addrinfo hints = {0, PF_INET, SOCK_STREAM};
|
||||
auto port_string = std::to_string(port);
|
||||
# ifdef _WIN32
|
||||
// Initialize Winsock
|
||||
@ -285,6 +283,10 @@ SVNetwork::SVNetwork(const char *hostname, int port) {
|
||||
}
|
||||
# endif // _WIN32
|
||||
|
||||
struct addrinfo *addr_info = nullptr;
|
||||
struct addrinfo hints = {};
|
||||
hints.ai_family = AF_INET;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
if (getaddrinfo(hostname, port_string.c_str(), &hints, &addr_info) != 0) {
|
||||
std::cerr << "Error resolving name for ScrollView host "
|
||||
<< std::string(hostname) << ":" << port << std::endl;
|
||||
|
Loading…
Reference in New Issue
Block a user