Skip to content
This repository was archived by the owner on Mar 18, 2024. It is now read-only.

Commit 479ebe7

Browse files
committed
Code review comments for 952a0e22
Conflicts: Release/src/http/client/http_client.cpp
1 parent ba2adb3 commit 479ebe7

File tree

5 files changed

+14
-20
lines changed

5 files changed

+14
-20
lines changed

Release/include/cpprest/http_msg.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1337,14 +1337,12 @@ class http_pipeline_stage : public std::enable_shared_from_this<http_pipeline_st
13371337
{
13381338
public:
13391339

1340-
http_pipeline_stage() {}
1340+
http_pipeline_stage() = default;
13411341

13421342
http_pipeline_stage & operator=(const http_pipeline_stage &) = delete;
13431343
http_pipeline_stage(const http_pipeline_stage &) = delete;
13441344

1345-
virtual ~http_pipeline_stage()
1346-
{
1347-
}
1345+
virtual ~http_pipeline_stage() = default;
13481346

13491347
/// <summary>
13501348
/// Runs this stage against the given request and passes onto the next stage.

Release/src/http/client/http_client.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ namespace details
5151
{
5252

5353
#if defined(_WIN32)
54-
const utility::char_t * get_with_body_err_msg = _XPLATSTR("A GET or HEAD request should not have an entity body.");
54+
extern const utility::char_t * get_with_body_err_msg = _XPLATSTR("A GET or HEAD request should not have an entity body.");
5555
#endif
5656

5757
void request_context::complete_headers()

Release/src/http/client/http_client_winhttp.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,9 @@ class winhttp_client : public _http_client_communicator
317317
, m_hSession(nullptr)
318318
, m_hConnection(nullptr) { }
319319

320+
winhttp_client(const winhttp_client&) = delete;
321+
winhttp_client &operator=(const winhttp_client&) = delete;
322+
320323
// Closes session.
321324
~winhttp_client()
322325
{
@@ -1289,10 +1292,6 @@ class winhttp_client : public _http_client_communicator
12891292
HINTERNET m_hSession;
12901293
HINTERNET m_hConnection;
12911294
bool m_secure;
1292-
1293-
// No copy or assignment.
1294-
winhttp_client(const winhttp_client&) = delete;
1295-
winhttp_client &operator=(const winhttp_client&) = delete;
12961295
};
12971296

12981297
std::shared_ptr<_http_client_communicator> create_platform_final_pipeline_stage(uri base_uri, const http_client_config& client_config)

Release/src/http/client/http_client_winrt.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,9 @@ class winrt_client : public _http_client_communicator
359359
winrt_client(http::uri address, http_client_config client_config)
360360
: _http_client_communicator(std::move(address), std::move(client_config)) { }
361361

362+
winrt_client(const winrt_client&) = delete;
363+
winrt_client &operator=(const winrt_client&) = delete;
364+
362365
virtual pplx::task<http_response> propagate(http_request request) override
363366
{
364367
auto self = std::static_pointer_cast<_http_client_communicator>(shared_from_this());
@@ -555,12 +558,6 @@ class winrt_client : public _http_client_communicator
555558
});
556559
}
557560
}
558-
559-
private:
560-
561-
// No copy or assignment.
562-
winrt_client(const winrt_client&) = delete;
563-
winrt_client &operator=(const winrt_client&) = delete;
564561
};
565562

566563
std::shared_ptr<_http_client_communicator> create_platform_final_pipeline_stage(uri base_uri, const http_client_config& client_config)

Release/src/http/common/http_msg.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,19 @@ utility::string_t http_headers::content_type() const
4747
/// Helper functions to convert a series of bytes from a charset to utf-8 or utf-16.
4848
/// These APIs deal with checking for and handling byte order marker (BOM).
4949
namespace {
50-
enum endian_ness
50+
enum endianness
5151
{
5252
little_endian,
5353
big_endian,
5454
unknown
5555
};
56-
endian_ness check_byte_order_mark(const utf16string &str)
56+
endianness check_byte_order_mark(const utf16string &str)
5757
{
5858
if (str.empty())
5959
{
6060
return unknown;
6161
}
62-
const unsigned char *src = (const unsigned char *) &str[0];
62+
const unsigned char *src = reinterpret_cast<const unsigned char *>(str.data());
6363

6464
// little endian
6565
if (src[0] == 0xFF && src[1] == 0xFE)
@@ -142,7 +142,7 @@ namespace {
142142

143143
std::string convert_utf16_to_utf8(utf16string src)
144144
{
145-
const endian_ness endian = check_byte_order_mark(src);
145+
const endianness endian = check_byte_order_mark(src);
146146
switch (endian)
147147
{
148148
case little_endian:
@@ -158,7 +158,7 @@ namespace {
158158

159159
utf16string convert_utf16_to_utf16(utf16string src)
160160
{
161-
const endian_ness endian = check_byte_order_mark(src);
161+
const endianness endian = check_byte_order_mark(src);
162162
switch (endian)
163163
{
164164
case little_endian:

0 commit comments

Comments
 (0)