From 09714d94739eb9069b7aef6b3e4fd6c3858065d1 Mon Sep 17 00:00:00 2001 From: Benjamin Lee Date: Sat, 6 Oct 2018 22:53:11 -0700 Subject: [PATCH 1/6] Various fixes on #866 which broke building for iOS and Mac --- Release/include/cpprest/http_compression.h | 8 +-- Release/include/cpprest/http_headers.h | 64 +++++++++---------- Release/src/http/common/http_compression.cpp | 36 +++++------ .../src/http/common/internal_http_helpers.h | 2 +- .../http/client/compression_tests.cpp | 44 ++++++------- 5 files changed, 77 insertions(+), 77 deletions(-) diff --git a/Release/include/cpprest/http_compression.h b/Release/include/cpprest/http_compression.h index 13b183af00..c231fdd824 100644 --- a/Release/include/cpprest/http_compression.h +++ b/Release/include/cpprest/http_compression.h @@ -96,7 +96,7 @@ class decompress_factory { public: virtual const utility::string_t& algorithm() const = 0; - virtual const uint16_t weight() const = 0; + virtual uint16_t weight() const = 0; virtual std::unique_ptr make_decompressor() const = 0; virtual ~decompress_factory() = default; }; @@ -117,9 +117,9 @@ _ASYNCRTIMP bool supported(); /// namespace algorithm { -constexpr utility::char_t *GZIP = _XPLATSTR("gzip"); -constexpr utility::char_t *DEFLATE = _XPLATSTR("deflate"); -constexpr utility::char_t *BROTLI = _XPLATSTR("br"); +constexpr utility::char_t *GZIP = const_cast(_XPLATSTR("gzip")); +constexpr utility::char_t *DEFLATE = const_cast(_XPLATSTR("deflate")); +constexpr utility::char_t *BROTLI = const_cast(_XPLATSTR("br")); /// /// Test whether cpprestsdk was built with built-in compression support and diff --git a/Release/include/cpprest/http_headers.h b/Release/include/cpprest/http_headers.h index 077266a7d5..2369e1b231 100644 --- a/Release/include/cpprest/http_headers.h +++ b/Release/include/cpprest/http_headers.h @@ -18,7 +18,37 @@ #include "cpprest/asyncrt_utils.h" namespace web { namespace http { - +namespace details +{ + template + bool bind_impl(const key_type &text, _t &ref) + { + utility::istringstream_t iss(text); + iss.imbue(std::locale::classic()); + iss >> ref; + if (iss.fail() || !iss.eof()) + { + return false; + } + + return true; + } + + template + bool bind_impl(const key_type &text, utf16string &ref) + { + ref = utility::conversions::to_utf16string(text); + return true; + } + + template + bool bind_impl(const key_type &text, std::string &ref) + { + ref = utility::conversions::to_utf8string(text); + return true; + } +} + /// /// Binds an individual reference to a string value. /// @@ -219,7 +249,7 @@ class http_headers return false; } - return details::bind_impl(iter->second, value) || iter->second.empty(); + return web::http::details::bind_impl(iter->second, value) || iter->second.empty(); } /// @@ -289,34 +319,4 @@ class http_headers inner_container m_headers; }; -namespace details -{ - template - bool bind_impl(const key_type &text, _t &ref) - { - utility::istringstream_t iss(text); - iss.imbue(std::locale::classic()); - iss >> ref; - if (iss.fail() || !iss.eof()) - { - return false; - } - - return true; - } - - template - bool bind_impl(const key_type &text, utf16string &ref) - { - ref = utility::conversions::to_utf16string(text); - return true; - } - - template - bool bind_impl(const key_type &text, std::string &ref) - { - ref = utility::conversions::to_utf8string(text); - return true; - } -} }} diff --git a/Release/src/http/common/http_compression.cpp b/Release/src/http/common/http_compression.cpp index e7e7f9a927..331293673f 100644 --- a/Release/src/http/common/http_compression.cpp +++ b/Release/src/http/common/http_compression.cpp @@ -156,7 +156,7 @@ class zlib_compressor_base : public compress_provider private: int m_state{Z_BUF_ERROR}; - z_stream m_stream{0}; + z_stream m_stream{}; const utility::string_t& m_algorithm; }; @@ -263,7 +263,7 @@ class zlib_decompressor_base : public decompress_provider private: int m_state{Z_BUF_ERROR}; - z_stream m_stream{0}; + z_stream m_stream{}; const utility::string_t& m_algorithm; }; @@ -283,7 +283,7 @@ class gzip_compressor : public zlib_compressor_base class gzip_decompressor : public zlib_decompressor_base { public: - gzip_decompressor::gzip_decompressor() : zlib_decompressor_base(16) // gzip auto-detect + gzip_decompressor() : zlib_decompressor_base(16) // gzip auto-detect { } }; @@ -620,7 +620,7 @@ class generic_decompress_factory : public decompress_factory const utility::string_t& algorithm() const { return m_algorithm; } - const uint16_t weight() const { return m_weight; } + uint16_t weight() const { return m_weight; } std::unique_ptr make_decompressor() const { return _make_decompressor(); } @@ -634,14 +634,14 @@ class generic_decompress_factory : public decompress_factory static const std::vector> g_compress_factories #if defined(CPPREST_HTTP_COMPRESSION) = {std::make_shared( - algorithm::GZIP, []() -> std::unique_ptr { return std::make_unique(); }), + algorithm::GZIP, []() -> std::unique_ptr { return utility::details::make_unique(); }), std::make_shared( algorithm::DEFLATE, - []() -> std::unique_ptr { return std::make_unique(); }), + []() -> std::unique_ptr { return utility::details::make_unique(); }), #if defined(CPPREST_BROTLI_COMPRESSION) std::make_shared( algorithm::BROTLI, - []() -> std::unique_ptr { return std::make_unique(); }) + []() -> std::unique_ptr { return utility::details::make_unique(); }) #endif // CPPREST_BROTLI_COMPRESSION }; #else // CPPREST_HTTP_COMPRESSION @@ -653,16 +653,16 @@ static const std::vector> g_decompress_facto = {std::make_shared( algorithm::GZIP, 500, - []() -> std::unique_ptr { return std::make_unique(); }), + []() -> std::unique_ptr { return utility::details::make_unique(); }), std::make_shared( algorithm::DEFLATE, 500, - []() -> std::unique_ptr { return std::make_unique(); }), + []() -> std::unique_ptr { return utility::details::make_unique(); }), #if defined(CPPREST_BROTLI_COMPRESSION) std::make_shared( algorithm::BROTLI, 500, - []() -> std::unique_ptr { return std::make_unique(); }) + []() -> std::unique_ptr { return utility::details::make_unique(); }) #endif // CPPREST_BROTLI_COMPRESSION }; #else // CPPREST_HTTP_COMPRESSION @@ -751,7 +751,7 @@ std::shared_ptr get_decompress_factory(const utility::string std::unique_ptr make_gzip_compressor(int compressionLevel, int method, int strategy, int memLevel) { #if defined(CPPREST_HTTP_COMPRESSION) - return std::move(std::make_unique(compressionLevel, method, strategy, memLevel)); + return utility::details::make_unique(compressionLevel, method, strategy, memLevel); #else // CPPREST_HTTP_COMPRESSION return std::unique_ptr(); #endif // CPPREST_HTTP_COMPRESSION @@ -760,7 +760,7 @@ std::unique_ptr make_gzip_compressor(int compressionLevel, in std::unique_ptr make_deflate_compressor(int compressionLevel, int method, int strategy, int memLevel) { #if defined(CPPREST_HTTP_COMPRESSION) - return std::move(std::make_unique(compressionLevel, method, strategy, memLevel)); + return utility::details::make_unique(compressionLevel, method, strategy, memLevel); #else // CPPREST_HTTP_COMPRESSION return std::unique_ptr(); #endif // CPPREST_HTTP_COMPRESSION @@ -769,7 +769,7 @@ std::unique_ptr make_deflate_compressor(int compressionLevel, std::unique_ptr make_brotli_compressor(uint32_t window, uint32_t quality, uint32_t mode) { #if defined(CPPREST_HTTP_COMPRESSION) && defined(CPPREST_BROTLI_COMPRESSION) - return std::move(std::make_unique(window, quality, mode)); + return utility::details::make_unique(window, quality, mode); #else // CPPREST_BROTLI_COMPRESSION return std::unique_ptr(); #endif // CPPREST_BROTLI_COMPRESSION @@ -951,7 +951,7 @@ std::unique_ptr get_compressor_from_header( if (compressor) { - return std::move(compressor); + return compressor; } // If we're here, we didn't match the caller's compressor above; @@ -965,7 +965,7 @@ std::unique_ptr get_compressor_from_header( auto compressor = web::http::compression::builtin::_make_compressor(f, coding); if (compressor) { - return std::move(compressor); + return compressor; } if (type == header_types::accept_encoding && utility::details::str_iequal(coding, _XPLATSTR("identity"))) { @@ -1068,7 +1068,7 @@ std::unique_ptr get_decompressor_from_header( // Either the response is compressed and we have a decompressor that can handle it, or // built-in compression is not enabled and we don't have an alternate set of decompressors - return std::move(decompressor); + return decompressor; } utility::string_t build_supported_header(header_types type, @@ -1084,7 +1084,7 @@ utility::string_t build_supported_header(header_types type, // Add all specified algorithms and their weights to the header start = true; os.imbue(std::locale::classic()); - for each (auto& factory in f) + for (auto& factory : f) { if (factory) { @@ -1109,7 +1109,7 @@ utility::string_t build_supported_header(header_types type, os << _XPLATSTR("identity;q=1, *;q=0"); } - return std::move(os.str()); + return os.str(); } } // namespace details } // namespace compression diff --git a/Release/src/http/common/internal_http_helpers.h b/Release/src/http/common/internal_http_helpers.h index ef19612270..76b4f4f4da 100644 --- a/Release/src/http/common/internal_http_helpers.h +++ b/Release/src/http/common/internal_http_helpers.h @@ -34,7 +34,7 @@ bool validate_method(const utility::string_t& method); namespace web { namespace http { namespace compression { -class compression::decompress_factory; +class decompress_factory; namespace details { namespace builtin { diff --git a/Release/tests/functional/http/client/compression_tests.cpp b/Release/tests/functional/http/client/compression_tests.cpp index e9cc9ef661..e50c9c902b 100644 --- a/Release/tests/functional/http/client/compression_tests.cpp +++ b/Release/tests/functional/http/client/compression_tests.cpp @@ -202,7 +202,7 @@ SUITE(compression_tests) std::vector dcmp_buffer; web::http::compression::operation_result r; std::vector chunk_sizes; - Concurrency::task_group_status result; + pplx::task_group_status result; size_t csize; size_t dsize; size_t i; @@ -210,8 +210,8 @@ SUITE(compression_tests) if (algorithm == fake_provider::FAKE) { - compressor = std::make_unique(buffer_size); - decompressor = std::make_unique(buffer_size); + compressor = utility::details::make_unique(buffer_size); + decompressor = utility::details::make_unique(buffer_size); } else { @@ -247,7 +247,7 @@ SUITE(compression_tests) web::http::compression::operation_hint::has_more) .then([&r](web::http::compression::operation_result x) { r = x; }) .wait(); - VERIFY_ARE_EQUAL(result, Concurrency::task_group_status::completed); + VERIFY_ARE_EQUAL(result, pplx::task_group_status::completed); VERIFY_ARE_EQUAL(r.input_bytes_processed, std::min(chunk_size, buffer_size - i)); VERIFY_ARE_EQUAL(r.done, false); chunk_sizes.push_back(r.output_bytes_produced); @@ -272,7 +272,7 @@ SUITE(compression_tests) web::http::compression::operation_hint::is_last) .then([&r](web::http::compression::operation_result x) { r = x; }) .wait(); - VERIFY_ARE_EQUAL(result, Concurrency::task_group_status::completed); + VERIFY_ARE_EQUAL(result, pplx::task_group_status::completed); VERIFY_ARE_EQUAL(r.input_bytes_processed, 0); chunk_sizes.push_back(r.output_bytes_produced); csize += r.output_bytes_produced; @@ -283,7 +283,7 @@ SUITE(compression_tests) result = compressor->compress(NULL, 0, NULL, 0, web::http::compression::operation_hint::is_last) .then([&r](web::http::compression::operation_result x) { r = x; }) .wait(); - VERIFY_ARE_EQUAL(result, Concurrency::task_group_status::completed); + VERIFY_ARE_EQUAL(result, pplx::task_group_status::completed); VERIFY_ARE_EQUAL(r.input_bytes_processed, 0); VERIFY_ARE_EQUAL(r.output_bytes_produced, 0); VERIFY_ARE_EQUAL(r.done, true); @@ -311,7 +311,7 @@ SUITE(compression_tests) hint) .then([&r](web::http::compression::operation_result x) { r = x; }) .wait(); - VERIFY_ARE_EQUAL(result, Concurrency::task_group_status::completed); + VERIFY_ARE_EQUAL(result, pplx::task_group_status::completed); nn += *it; dsize += r.output_bytes_produced; } @@ -339,7 +339,7 @@ SUITE(compression_tests) web::http::compression::operation_hint::has_more) .then([&r](web::http::compression::operation_result x) { r = x; }) .wait(); - VERIFY_ARE_EQUAL(result, Concurrency::task_group_status::completed); + VERIFY_ARE_EQUAL(result, pplx::task_group_status::completed); dsize += r.output_bytes_produced; nn += r.input_bytes_processed; n -= r.input_bytes_processed; @@ -354,7 +354,7 @@ SUITE(compression_tests) result = decompressor->decompress(NULL, 0, NULL, 0, web::http::compression::operation_hint::has_more) .then([&r](web::http::compression::operation_result x) { r = x; }) .wait(); - VERIFY_ARE_EQUAL(result, Concurrency::task_group_status::completed); + VERIFY_ARE_EQUAL(result, pplx::task_group_status::completed); VERIFY_ARE_EQUAL(r.input_bytes_processed, 0); VERIFY_ARE_EQUAL(r.output_bytes_produced, 0); VERIFY_IS_TRUE(r.done); @@ -370,7 +370,7 @@ SUITE(compression_tests) web::http::compression::operation_hint::is_last) .then([&r](web::http::compression::operation_result x) { r = x; }) .wait(); - VERIFY_ARE_EQUAL(result, Concurrency::task_group_status::completed); + VERIFY_ARE_EQUAL(result, pplx::task_group_status::completed); VERIFY_ARE_EQUAL(r.output_bytes_produced, buffer_size); VERIFY_ARE_EQUAL(input_buffer, dcmp_buffer); @@ -448,28 +448,28 @@ SUITE(compression_tests) std::shared_ptr fcf = web::http::compression::make_compress_factory( fake_provider::FAKE, []() -> std::unique_ptr { - return std::make_unique(); + return utility::details::make_unique(); }); std::vector> fcv; fcv.push_back(fcf); std::shared_ptr fdf = web::http::compression::make_decompress_factory( fake_provider::FAKE, 800, []() -> std::unique_ptr { - return std::make_unique(); + return utility::details::make_unique(); }); std::vector> fdv; fdv.push_back(fdf); std::shared_ptr ncf = web::http::compression::make_compress_factory( _NONE, []() -> std::unique_ptr { - return std::make_unique(); + return utility::details::make_unique(); }); std::vector> ncv; ncv.push_back(ncf); std::shared_ptr ndf = web::http::compression::make_decompress_factory( _NONE, 800, []() -> std::unique_ptr { - return std::make_unique(); + return utility::details::make_unique(); }); std::vector> ndv; ndv.push_back(ndf); @@ -794,7 +794,7 @@ SUITE(compression_tests) { test_http_server* p_server = nullptr; std::unique_ptr scoped = - std::move(std::make_unique(m_uri)); + std::move(utility::details::make_unique(m_uri)); scoped->server()->next_request().then([&skip_transfer_put](pplx::task op) { try { @@ -810,7 +810,7 @@ SUITE(compression_tests) http_client client(m_uri); http_request msg(methods::PUT); - msg.set_compressor(std::make_unique(0)); + msg.set_compressor(utility::details::make_unique(0)); msg.set_body(concurrency::streams::rawptr_stream::open_istream((const uint8_t*)nullptr, 0)); http_response rsp = client.request(msg).get(); rsp.content_ready().wait(); @@ -872,7 +872,7 @@ SUITE(compression_tests) if (encoding.find(fake_provider::FAKE) != utility::string_t::npos) { // This one won't be found in the server's default set... - rsp._get_impl()->set_compressor(std::make_unique(buffer_size)); + rsp._get_impl()->set_compressor(utility::details::make_unique(buffer_size)); } #endif // _WIN32 rsp.set_body( @@ -913,7 +913,7 @@ SUITE(compression_tests) } else { - scoped = std::move(std::make_unique(m_uri)); + scoped = std::move(utility::details::make_unique(m_uri)); p_server = scoped->server(); } @@ -968,12 +968,12 @@ SUITE(compression_tests) fake_provider::FAKE, 1000, [buffer_size]() -> std::unique_ptr { - return std::make_unique(buffer_size); + return utility::details::make_unique(buffer_size); }); dfactories.push_back(dmap[fake_provider::FAKE]); cfactories.push_back(web::http::compression::make_compress_factory( fake_provider::FAKE, [buffer_size]() -> std::unique_ptr { - return std::make_unique(buffer_size); + return utility::details::make_unique(buffer_size); })); v.resize(buffer_size); @@ -1037,7 +1037,7 @@ SUITE(compression_tests) if (algorithm == fake_provider::FAKE) { VERIFY_IS_FALSE((bool)c); - c = std::make_unique(buffer_size); + c = utility::details::make_unique(buffer_size); } VERIFY_IS_TRUE((bool)c); auto got = c->compress(v.data(), @@ -1069,7 +1069,7 @@ SUITE(compression_tests) VERIFY_ARE_EQUAL(boo, algorithm != fake_provider::FAKE); if (algorithm == fake_provider::FAKE) { - msg.set_compressor(std::make_unique(buffer_size)); + msg.set_compressor(utility::details::make_unique(buffer_size)); } } else From b0927b9ef25597776787fb5b56b19b2d09a1bbfa Mon Sep 17 00:00:00 2001 From: Benjamin Lee Date: Sun, 7 Oct 2018 08:23:13 -0700 Subject: [PATCH 2/6] Remove trailing semicolon from namespace since flags error when building on Ubuntu --- Release/include/cpprest/http_compression.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Release/include/cpprest/http_compression.h b/Release/include/cpprest/http_compression.h index c231fdd824..5a77cdd31c 100644 --- a/Release/include/cpprest/http_compression.h +++ b/Release/include/cpprest/http_compression.h @@ -129,7 +129,7 @@ constexpr utility::char_t *BROTLI = const_cast(_XPLATSTR("br" /// the supplied string matches a supported built-in algorithm, and false if not. /// _ASYNCRTIMP bool supported(const utility::string_t& algorithm); -}; +} /// /// Factory function to instantiate a built-in compression provider with default parameters by compression algorithm From d2b80321081299136e2b3c910d721457a36fac3a Mon Sep 17 00:00:00 2001 From: Benjamin Lee Date: Sun, 7 Oct 2018 19:52:36 -0700 Subject: [PATCH 3/6] Ubuntu builds needs to factor in unused arguments/variables --- Release/src/http/client/http_client_asio.cpp | 4 +++ Release/src/http/common/http_compression.cpp | 34 ++++++++++++++++---- 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/Release/src/http/client/http_client_asio.cpp b/Release/src/http/client/http_client_asio.cpp index 7590497420..5b5ceffd7c 100644 --- a/Release/src/http/client/http_client_asio.cpp +++ b/Release/src/http/client/http_client_asio.cpp @@ -1753,7 +1753,11 @@ class asio_context final : public request_context, public std::enable_shared_fro writeBuffer.putn_nocopy(shared_decompressed->data(), shared_decompressed->size()) .then([this_request, read_size, shared_decompressed AND_CAPTURE_MEMBER_FUNCTION_POINTERS]( pplx::task op) { +#if defined(__GNUC__) + size_t writtenSize __attribute__ ((unused)) = 0; +#else // __GNUC__ size_t writtenSize = 0; +#endif // __GNUC__ try { writtenSize = op.get(); diff --git a/Release/src/http/common/http_compression.cpp b/Release/src/http/common/http_compression.cpp index 331293673f..f8c0f4e2c3 100644 --- a/Release/src/http/common/http_compression.cpp +++ b/Release/src/http/common/http_compression.cpp @@ -748,32 +748,54 @@ std::shared_ptr get_decompress_factory(const utility::string return std::shared_ptr(); } + +#if defined(CPPREST_HTTP_COMPRESSION) std::unique_ptr make_gzip_compressor(int compressionLevel, int method, int strategy, int memLevel) { -#if defined(CPPREST_HTTP_COMPRESSION) return utility::details::make_unique(compressionLevel, method, strategy, memLevel); +} #else // CPPREST_HTTP_COMPRESSION +#if defined(__GNUC__) +std::unique_ptr make_gzip_compressor(int compressionLevel __attribute__((unused)), int method __attribute__((unused)), int strategy __attribute__((unused)), int memLevel __attribute__((unused))) +#else // __GNUC__ +std::unique_ptr make_gzip_compressor(int compressionLevel, int method, int strategy, int memLevel) +#endif // __GNUC__ +{ return std::unique_ptr(); -#endif // CPPREST_HTTP_COMPRESSION } +#endif // CPPREST_HTTP_COMPRESSION +#if defined(CPPREST_HTTP_COMPRESSION) std::unique_ptr make_deflate_compressor(int compressionLevel, int method, int strategy, int memLevel) { -#if defined(CPPREST_HTTP_COMPRESSION) return utility::details::make_unique(compressionLevel, method, strategy, memLevel); +} #else // CPPREST_HTTP_COMPRESSION +#if defined(__GNUC__) +std::unique_ptr make_deflate_compressor(int compressionLevel __attribute__((unused)), int method __attribute__((unused)), int strategy __attribute__((unused)), int memLevel __attribute__((unused))) +#else // __GNUC__ +std::unique_ptr make_deflate_compressor(int compressionLevel, int method, int strategy, int memLevel) +#endif // __GNUC__ +{ return std::unique_ptr(); -#endif // CPPREST_HTTP_COMPRESSION } +#endif // CPPREST_HTTP_COMPRESSION +#if defined(CPPREST_HTTP_COMPRESSION) && defined(CPPREST_BROTLI_COMPRESSION) std::unique_ptr make_brotli_compressor(uint32_t window, uint32_t quality, uint32_t mode) { -#if defined(CPPREST_HTTP_COMPRESSION) && defined(CPPREST_BROTLI_COMPRESSION) return utility::details::make_unique(window, quality, mode); +} #else // CPPREST_BROTLI_COMPRESSION +#if defined(__GNUC__) +std::unique_ptr make_brotli_compressor(uint32_t window __attribute__((unused)), uint32_t quality __attribute__((unused)), uint32_t mode __attribute__((unused))) +#else // __GNUC__ +std::unique_ptr make_brotli_compressor(uint32_t window, uint32_t quality, uint32_t mode) +#endif // __GNUC__ +{ return std::unique_ptr(); -#endif // CPPREST_BROTLI_COMPRESSION } +#endif // CPPREST_BROTLI_COMPRESSION } // namespace builtin std::shared_ptr make_compress_factory( From 893c101b2d08ddf4da0de7a6a86b420a1031e85e Mon Sep 17 00:00:00 2001 From: Benjamin Lee Date: Mon, 8 Oct 2018 16:47:12 -0700 Subject: [PATCH 4/6] Remove trailing spaces from empty lines --- Release/include/cpprest/http_headers.h | 8 ++++---- Release/src/http/client/http_client_asio.cpp | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Release/include/cpprest/http_headers.h b/Release/include/cpprest/http_headers.h index 2369e1b231..770fe981cb 100644 --- a/Release/include/cpprest/http_headers.h +++ b/Release/include/cpprest/http_headers.h @@ -30,17 +30,17 @@ namespace details { return false; } - + return true; } - + template bool bind_impl(const key_type &text, utf16string &ref) { ref = utility::conversions::to_utf16string(text); return true; } - + template bool bind_impl(const key_type &text, std::string &ref) { @@ -48,7 +48,7 @@ namespace details return true; } } - + /// /// Binds an individual reference to a string value. /// diff --git a/Release/src/http/client/http_client_asio.cpp b/Release/src/http/client/http_client_asio.cpp index 5b5ceffd7c..4db17ca71e 100644 --- a/Release/src/http/client/http_client_asio.cpp +++ b/Release/src/http/client/http_client_asio.cpp @@ -1753,11 +1753,11 @@ class asio_context final : public request_context, public std::enable_shared_fro writeBuffer.putn_nocopy(shared_decompressed->data(), shared_decompressed->size()) .then([this_request, read_size, shared_decompressed AND_CAPTURE_MEMBER_FUNCTION_POINTERS]( pplx::task op) { -#if defined(__GNUC__) +#if defined(__GNUC__) size_t writtenSize __attribute__ ((unused)) = 0; #else // __GNUC__ size_t writtenSize = 0; -#endif // __GNUC__ +#endif // __GNUC__ try { writtenSize = op.get(); From ba203252dfb9ed3f031109ecbc2bee43c4583096 Mon Sep 17 00:00:00 2001 From: Billy O'Neal Date: Mon, 8 Oct 2018 19:34:04 -0700 Subject: [PATCH 5/6] Remove duplicate bind_impls. --- Release/include/cpprest/http_headers.h | 31 -------------------------- 1 file changed, 31 deletions(-) diff --git a/Release/include/cpprest/http_headers.h b/Release/include/cpprest/http_headers.h index 1cdf3cce25..34f0122b3f 100644 --- a/Release/include/cpprest/http_headers.h +++ b/Release/include/cpprest/http_headers.h @@ -18,37 +18,6 @@ #include "cpprest/asyncrt_utils.h" namespace web { namespace http { -namespace details -{ - template - bool bind_impl(const key_type &text, _t &ref) - { - utility::istringstream_t iss(text); - iss.imbue(std::locale::classic()); - iss >> ref; - if (iss.fail() || !iss.eof()) - { - return false; - } - - return true; - } - - template - bool bind_impl(const key_type &text, utf16string &ref) - { - ref = utility::conversions::to_utf16string(text); - return true; - } - - template - bool bind_impl(const key_type &text, std::string &ref) - { - ref = utility::conversions::to_utf8string(text); - return true; - } -} - /// /// Binds an individual reference to a string value. /// From 790e620033ca060ab320de2fcb86a24b973a2a70 Mon Sep 17 00:00:00 2001 From: Billy O'Neal Date: Mon, 8 Oct 2018 19:36:29 -0700 Subject: [PATCH 6/6] Fix some merge fallout with master. --- Release/src/http/common/http_compression.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/Release/src/http/common/http_compression.cpp b/Release/src/http/common/http_compression.cpp index d269e6a879..194f1efc97 100644 --- a/Release/src/http/common/http_compression.cpp +++ b/Release/src/http/common/http_compression.cpp @@ -749,46 +749,43 @@ std::shared_ptr get_decompress_factory(const utility::string } -#if defined(CPPREST_HTTP_COMPRESSION) std::unique_ptr make_gzip_compressor(int compressionLevel, int method, int strategy, int memLevel) { +#if defined(CPPREST_HTTP_COMPRESSION) return utility::details::make_unique(compressionLevel, method, strategy, memLevel); -} #else // CPPREST_HTTP_COMPRESSION (void)compressionLevel; (void)method; (void)strategy; (void)memLevel; return std::unique_ptr(); -} #endif // CPPREST_HTTP_COMPRESSION - -#if defined(CPPREST_HTTP_COMPRESSION) +} + std::unique_ptr make_deflate_compressor(int compressionLevel, int method, int strategy, int memLevel) { +#if defined(CPPREST_HTTP_COMPRESSION) return utility::details::make_unique(compressionLevel, method, strategy, memLevel); -} #else // CPPREST_HTTP_COMPRESSION (void)compressionLevel; (void)method; (void)strategy; (void)memLevel; return std::unique_ptr(); -} #endif // CPPREST_HTTP_COMPRESSION +} -#if defined(CPPREST_HTTP_COMPRESSION) && defined(CPPREST_BROTLI_COMPRESSION) std::unique_ptr make_brotli_compressor(uint32_t window, uint32_t quality, uint32_t mode) { +#if defined(CPPREST_HTTP_COMPRESSION) && defined(CPPREST_BROTLI_COMPRESSION) return utility::details::make_unique(window, quality, mode); -} #else // CPPREST_BROTLI_COMPRESSION (void)window; (void)quality; (void)mode; return std::unique_ptr(); -} #endif // CPPREST_BROTLI_COMPRESSION +} } // namespace builtin std::shared_ptr make_compress_factory(