Skip to content

Commit

Permalink
src: suppress compilation warning in inspector_socket.cc
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
danbev committed Sep 9, 2021
1 parent e385c05 commit 7ad3118
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/inspector_socket.cc
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ static void generate_accept_string(const std::string& client_key,
static const char ws_magic[] = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
std::string input(client_key + ws_magic);
char hash[SHA_DIGEST_LENGTH];
SHA1(reinterpret_cast<const unsigned char*>(&input[0]), input.size(),
reinterpret_cast<unsigned char*>(hash));
USE(SHA1(reinterpret_cast<const unsigned char*>(&input[0]), input.size(),
reinterpret_cast<unsigned char*>(hash)));
node::base64_encode(hash, sizeof(hash), *buffer, sizeof(*buffer));
}

Expand Down

0 comments on commit 7ad3118

Please sign in to comment.