diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc index 997c3ba00d6150..aab07945786cec 100644 --- a/src/cares_wrap.cc +++ b/src/cares_wrap.cc @@ -1750,7 +1750,7 @@ void SetServers(const FunctionCallbackInfo& args) { } if (err == 0) - err = ares_set_servers_ports(channel->cares_channel(), &servers[0]); + err = ares_set_servers_ports(channel->cares_channel(), servers.data()); else err = ARES_EBADSTR; diff --git a/src/inspector_socket.cc b/src/inspector_socket.cc index f36682b93386a9..fbaa4969164d7a 100644 --- a/src/inspector_socket.cc +++ b/src/inspector_socket.cc @@ -147,8 +147,9 @@ 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]; - USE(SHA1(reinterpret_cast(&input[0]), input.size(), - reinterpret_cast(hash))); + USE(SHA1(reinterpret_cast(input.data()), + input.size(), + reinterpret_cast(hash))); node::base64_encode(hash, sizeof(hash), *buffer, sizeof(*buffer)); } diff --git a/src/inspector_socket_server.cc b/src/inspector_socket_server.cc index 299664da9a1693..f8f6a1b4ab6bd0 100644 --- a/src/inspector_socket_server.cc +++ b/src/inspector_socket_server.cc @@ -136,7 +136,7 @@ void SendProtocolJson(InspectorSocket* socket) { strm.next_in = const_cast(PROTOCOL_JSON + 3); strm.avail_in = sizeof(PROTOCOL_JSON) - 3; std::string data(kDecompressedSize, '\0'); - strm.next_out = reinterpret_cast(&data[0]); + strm.next_out = reinterpret_cast(data.data()); strm.avail_out = data.size(); CHECK_EQ(Z_STREAM_END, inflate(&strm, Z_FINISH)); CHECK_EQ(0, strm.avail_out); diff --git a/src/node.cc b/src/node.cc index 1bb865d583b17b..60b3df63a7aaa2 100644 --- a/src/node.cc +++ b/src/node.cc @@ -754,9 +754,9 @@ int ProcessGlobalArgs(std::vector* args, std::vector v8_args_as_char_ptr(v8_args.size()); if (v8_args.size() > 0) { for (size_t i = 0; i < v8_args.size(); ++i) - v8_args_as_char_ptr[i] = &v8_args[i][0]; + v8_args_as_char_ptr[i] = v8_args[i].data(); int argc = v8_args.size(); - V8::SetFlagsFromCommandLine(&argc, &v8_args_as_char_ptr[0], true); + V8::SetFlagsFromCommandLine(&argc, v8_args_as_char_ptr.data(), true); v8_args_as_char_ptr.resize(argc); } diff --git a/src/node_file.cc b/src/node_file.cc index f742d3b56c0b5b..4993da585322db 100644 --- a/src/node_file.cc +++ b/src/node_file.cc @@ -1050,7 +1050,7 @@ static void InternalModuleReadJSON(const FunctionCallbackInfo& args) { } while (static_cast(numchars) == kBlockSize); size_t start = 0; - if (offset >= 3 && 0 == memcmp(&chars[0], "\xEF\xBB\xBF", 3)) { + if (offset >= 3 && 0 == memcmp(chars.data(), "\xEF\xBB\xBF", 3)) { start = 3; // Skip UTF-8 BOM. } diff --git a/src/string_bytes.cc b/src/string_bytes.cc index 98da55a9d71f21..b3c0a90b548c70 100644 --- a/src/string_bytes.cc +++ b/src/string_bytes.cc @@ -541,7 +541,7 @@ size_t StringBytes::hex_encode( std::string StringBytes::hex_encode(const char* src, size_t slen) { size_t dlen = slen * 2; std::string dst(dlen, '\0'); - hex_encode(src, slen, &dst[0], dlen); + hex_encode(src, slen, dst.data(), dlen); return dst; } diff --git a/src/util.cc b/src/util.cc index 53ace10e0c3ffa..073e73b30c39ed 100644 --- a/src/util.cc +++ b/src/util.cc @@ -140,7 +140,7 @@ std::string GetProcessTitle(const char* default_title) { std::string buf(16, '\0'); for (;;) { - const int rc = uv_get_process_title(&buf[0], buf.size()); + const int rc = uv_get_process_title(buf.data(), buf.size()); if (rc == 0) break; @@ -156,7 +156,7 @@ std::string GetProcessTitle(const char* default_title) { // Strip excess trailing nul bytes. Using strlen() here is safe, // uv_get_process_title() always zero-terminates the result. - buf.resize(strlen(&buf[0])); + buf.resize(strlen(buf.data())); return buf; } diff --git a/test/cctest/test_inspector_socket.cc b/test/cctest/test_inspector_socket.cc index b351a23002c9ca..2efa0d55d748f1 100644 --- a/test/cctest/test_inspector_socket.cc +++ b/test/cctest/test_inspector_socket.cc @@ -764,8 +764,8 @@ TEST_F(InspectorSocketTest, Send1Mb) { std::string expected(EXPECTED_FRAME_HEADER, sizeof(EXPECTED_FRAME_HEADER)); expected.append(message); - delegate->Write(&message[0], message.size()); - expect_on_client(&expected[0], expected.size()); + delegate->Write(message.data(), message.size()); + expect_on_client(expected.data(), expected.size()); char MASK[4] = {'W', 'h', 'O', 'a'}; @@ -778,8 +778,8 @@ TEST_F(InspectorSocketTest, Send1Mb) { outgoing.resize(outgoing.size() + message.size()); mask_message(message, &outgoing[sizeof(FRAME_TO_SERVER_HEADER)], MASK); - do_write(&outgoing[0], outgoing.size()); - delegate->ExpectData(&message[0], message.size()); + do_write(outgoing.data(), outgoing.size()); + delegate->ExpectData(message.data(), message.size()); // 3. Close const char CLIENT_CLOSE_FRAME[] = {'\x88', '\x80', '\x2D',