Skip to content

Commit 04ac9e1

Browse files
committed
src: suppress compilation warning in inspector_socket.cc
When building/linking against OpenSSL 3.0.0alpha17 the following compilation error occurs: In file included from ../src/inspector_socket.cc:7: ../src/inspector_socket.cc: In function ‘void node::inspector::{anonymous}::generate_accept_string( const string&, char (*)[28])’: ../src/inspector_socket.cc:150:8: error: second operand of conditional expression has no effect [-Werror=unused-value] 150 | reinterpret_cast<unsigned char*>(hash)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../deps/openssl/openssl/include/openssl/sha.h:57:57: note: in definition of macro ‘SHA1’ 57 | (EVP_Q_digest(NULL, "SHA1", NULL, d, n, md, NULL) ? md : NULL) | ^~ ../src/inspector_socket.cc:150:47: error: third operand of conditional expression has no effect [-Werror=unused-value] 150 | reinterpret_cast<unsigned char*>(hash)); | ^ This commit suppresses this warning for OpenSSL 3.0.
1 parent eaf8adc commit 04ac9e1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/inspector_socket.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ static void generate_accept_string(const std::string& client_key,
146146
static const char ws_magic[] = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
147147
std::string input(client_key + ws_magic);
148148
char hash[SHA_DIGEST_LENGTH];
149-
SHA1(reinterpret_cast<const unsigned char*>(&input[0]), input.size(),
150-
reinterpret_cast<unsigned char*>(hash));
149+
USE(SHA1(reinterpret_cast<const unsigned char*>(&input[0]), input.size(),
150+
reinterpret_cast<unsigned char*>(hash)));
151151
node::base64_encode(hash, sizeof(hash), *buffer, sizeof(*buffer));
152152
}
153153

0 commit comments

Comments
 (0)