| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 456fca0 commit b04d51a
8 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1750,7 +1750,7 @@ void SetServers(const FunctionCallbackInfo<Value>& args) { | |||
| 1750 | 1750 | } | |
| 1751 | 1751 | ||
| 1752 | 1752 | if (err == 0) | |
| 1753 | - err = ares_set_servers_ports(channel->cares_channel(), &servers[0]); | ||
| 1753 | + err = ares_set_servers_ports(channel->cares_channel(), servers.data()); | ||
| 1754 | 1754 | else | |
| 1755 | 1755 | err = ARES_EBADSTR; | |
| 1756 | 1756 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -147,8 +147,9 @@ static void generate_accept_string(const std::string& client_key, | |||
| 147 | 147 | static const char ws_magic[] = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"; | |
| 148 | 148 | std::string input(client_key + ws_magic); | |
| 149 | 149 | char hash[SHA_DIGEST_LENGTH]; | |
| 150 | - USE(SHA1(reinterpret_cast<const unsigned char*>(&input[0]), input.size(), | ||
| 151 | - reinterpret_cast<unsigned char*>(hash))); | ||
| 150 | + USE(SHA1(reinterpret_cast<const unsigned char*>(input.data()), | ||
| 151 | + input.size(), | ||
| 152 | + reinterpret_cast<unsigned char*>(hash))); | ||
| 152 | 153 | node::base64_encode(hash, sizeof(hash), *buffer, sizeof(*buffer)); | |
| 153 | 154 | } | |
| 154 | 155 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -136,7 +136,7 @@ void SendProtocolJson(InspectorSocket* socket) { | |||
| 136 | 136 | strm.next_in = const_cast<uint8_t*>(PROTOCOL_JSON + 3); | |
| 137 | 137 | strm.avail_in = sizeof(PROTOCOL_JSON) - 3; | |
| 138 | 138 | std::string data(kDecompressedSize, '\0'); | |
| 139 | - strm.next_out = reinterpret_cast<Byte*>(&data[0]); | ||
| 139 | + strm.next_out = reinterpret_cast<Byte*>(data.data()); | ||
| 140 | 140 | strm.avail_out = data.size(); | |
| 141 | 141 | CHECK_EQ(Z_STREAM_END, inflate(&strm, Z_FINISH)); | |
| 142 | 142 | CHECK_EQ(0, strm.avail_out); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -733,9 +733,9 @@ static ExitCode ProcessGlobalArgsInternal(std::vector<std::string>* args, | |||
| 733 | 733 | std::vector<char*> v8_args_as_char_ptr(v8_args.size()); | |
| 734 | 734 | if (v8_args.size() > 0) { | |
| 735 | 735 | for (size_t i = 0; i < v8_args.size(); ++i) | |
| 736 | - v8_args_as_char_ptr[i] = &v8_args[i][0]; | ||
| 736 | + v8_args_as_char_ptr[i] = v8_args[i].data(); | ||
| 737 | 737 | int argc = v8_args.size(); | |
| 738 | - V8::SetFlagsFromCommandLine(&argc, &v8_args_as_char_ptr[0], true); | ||
| 738 | + V8::SetFlagsFromCommandLine(&argc, v8_args_as_char_ptr.data(), true); | ||
| 739 | 739 | v8_args_as_char_ptr.resize(argc); | |
| 740 | 740 | } | |
| 741 | 741 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1074,7 +1074,7 @@ static void InternalModuleReadJSON(const FunctionCallbackInfo<Value>& args) { | |||
| 1074 | 1074 | } while (static_cast<size_t>(numchars) == kBlockSize); | |
| 1075 | 1075 | ||
| 1076 | 1076 | size_t start = 0; | |
| 1077 | - if (offset >= 3 && 0 == memcmp(&chars[0], "\xEF\xBB\xBF", 3)) { | ||
| 1077 | + if (offset >= 3 && 0 == memcmp(chars.data(), "\xEF\xBB\xBF", 3)) { | ||
| 1078 | 1078 | start = 3; // Skip UTF-8 BOM. | |
| 1079 | 1079 | } | |
| 1080 | 1080 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -541,7 +541,7 @@ size_t StringBytes::hex_encode( | |||
| 541 | 541 | std::string StringBytes::hex_encode(const char* src, size_t slen) { | |
| 542 | 542 | size_t dlen = slen * 2; | |
| 543 | 543 | std::string dst(dlen, '\0'); | |
| 544 | - hex_encode(src, slen, &dst[0], dlen); | ||
| 544 | + hex_encode(src, slen, dst.data(), dlen); | ||
| 545 | 545 | return dst; | |
| 546 | 546 | } | |
| 547 | 547 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -144,7 +144,7 @@ std::string GetProcessTitle(const char* default_title) { | |||
| 144 | 144 | std::string buf(16, '\0'); | |
| 145 | 145 | ||
| 146 | 146 | for (;;) { | |
| 147 | - const int rc = uv_get_process_title(&buf[0], buf.size()); | ||
| 147 | + const int rc = uv_get_process_title(buf.data(), buf.size()); | ||
| 148 | 148 | ||
| 149 | 149 | if (rc == 0) | |
| 150 | 150 | break; | |
@@ -160,7 +160,7 @@ std::string GetProcessTitle(const char* default_title) { | |||
| 160 | 160 | ||
| 161 | 161 | // Strip excess trailing nul bytes. Using strlen() here is safe, | |
| 162 | 162 | // uv_get_process_title() always zero-terminates the result. | |
| 163 | - buf.resize(strlen(&buf[0])); | ||
| 163 | + buf.resize(strlen(buf.data())); | ||
| 164 | 164 | ||
| 165 | 165 | return buf; | |
| 166 | 166 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -764,8 +764,8 @@ TEST_F(InspectorSocketTest, Send1Mb) { | |||
| 764 | 764 | std::string expected(EXPECTED_FRAME_HEADER, sizeof(EXPECTED_FRAME_HEADER)); | |
| 765 | 765 | expected.append(message); | |
| 766 | 766 | ||
| 767 | - delegate->Write(&message[0], message.size()); | ||
| 768 | - expect_on_client(&expected[0], expected.size()); | ||
| 767 | + delegate->Write(message.data(), message.size()); | ||
| 768 | + expect_on_client(expected.data(), expected.size()); | ||
| 769 | 769 | ||
| 770 | 770 | char MASK[4] = {'W', 'h', 'O', 'a'}; | |
| 771 | 771 | ||
@@ -778,8 +778,8 @@ TEST_F(InspectorSocketTest, Send1Mb) { | |||
| 778 | 778 | outgoing.resize(outgoing.size() + message.size()); | |
| 779 | 779 | mask_message(message, &outgoing[sizeof(FRAME_TO_SERVER_HEADER)], MASK); | |
| 780 | 780 | ||
| 781 | - do_write(&outgoing[0], outgoing.size()); | ||
| 782 | - delegate->ExpectData(&message[0], message.size()); | ||
| 781 | + do_write(outgoing.data(), outgoing.size()); | ||
| 782 | + delegate->ExpectData(message.data(), message.size()); | ||
| 783 | 783 | ||
| 784 | 784 | // 3. Close | |
| 785 | 785 | const char CLIENT_CLOSE_FRAME[] = {'\x88', '\x80', '\x2D', | |
| Back | FazBrowse Home | New Git URL |
0 commit comments