File tree Expand file tree Collapse file tree
include/opentelemetry/ext/http/client/curl
test/w3c_tracecontext_http_test_server
sdk/include/opentelemetry/sdk/common Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1717 matrix :
1818 include :
1919 - cmake_options : all-options-abiv1-preview
20- warning_limit : 83
20+ warning_limit : 73
2121 - cmake_options : all-options-abiv2-preview
22- warning_limit : 86
22+ warning_limit : 76
2323 env :
2424 CC : /usr/bin/clang-22
2525 CXX : /usr/bin/clang++-22
Original file line number Diff line number Diff line change @@ -51,9 +51,7 @@ class RequestHandler : public HTTP_SERVER_NS::HttpRequestCallback
5151 std::string span_name = request.uri ;
5252
5353 // extract context from http header
54- std::map<std::string, std::string> &request_headers =
55- const_cast <std::map<std::string, std::string> &>(request.headers );
56- const HttpTextMapCarrier<std::map<std::string, std::string>> carrier (request_headers);
54+ const HttpTextMapCarrier<std::map<std::string, std::string>> carrier (request.headers );
5755 auto prop = context::propagation::GlobalTextMapPropagator::GetGlobalPropagator ();
5856 auto current_ctx = context::RuntimeContext::GetCurrent ();
5957 auto new_context = prop->Extract (carrier, current_ctx);
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ template <typename T>
2929class HttpTextMapCarrier : public opentelemetry ::context::propagation::TextMapCarrier
3030{
3131public:
32- HttpTextMapCarrier (T &headers) : headers_(headers) {}
32+ HttpTextMapCarrier (const T &headers) : headers_(headers) {}
3333 HttpTextMapCarrier () = default ;
3434 opentelemetry::nostd::string_view Get (
3535 opentelemetry::nostd::string_view key) const noexcept override
Original file line number Diff line number Diff line change @@ -290,12 +290,11 @@ class HttpOperation
290290 inline CURL *GetCurlEasyHandle () noexcept { return curl_resource_.easy_handle ; }
291291
292292private:
293- CURLcode SetCurlPtrOption (CURLoption option, void *value);
293+ CURLcode SetCurlPtrOption (CURLoption option, const void *value);
294294
295295 CURLcode SetCurlStrOption (CURLoption option, const char *str)
296296 {
297- void *ptr = const_cast <char *>(str);
298- return SetCurlPtrOption (option, ptr);
297+ return SetCurlPtrOption (option, str);
299298 }
300299
301300 CURLcode SetCurlBlobOption (CURLoption option, struct curl_blob *blob)
Original file line number Diff line number Diff line change @@ -721,7 +721,7 @@ const char *HttpOperation::GetCurlErrorMessage(CURLcode code)
721721 return message;
722722}
723723
724- CURLcode HttpOperation::SetCurlPtrOption (CURLoption option, void *value)
724+ CURLcode HttpOperation::SetCurlPtrOption (CURLoption option, const void *value)
725725{
726726 /*
727727 curl_easy_setopt() is a macro with variadic arguments, type unsafe.
@@ -912,6 +912,7 @@ CURLcode HttpOperation::Setup()
912912
913913 struct curl_blob stblob
914914 {};
915+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-const-cast)
915916 stblob.data = const_cast <char *>(data);
916917 stblob.len = data_len;
917918 stblob.flags = CURL_BLOB_COPY ;
@@ -954,6 +955,7 @@ CURLcode HttpOperation::Setup()
954955
955956 struct curl_blob stblob
956957 {};
958+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-const-cast)
957959 stblob.data = const_cast <char *>(data);
958960 stblob.len = data_len;
959961 stblob.flags = CURL_BLOB_COPY ;
@@ -1002,6 +1004,7 @@ CURLcode HttpOperation::Setup()
10021004
10031005 struct curl_blob stblob
10041006 {};
1007+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-const-cast)
10051008 stblob.data = const_cast <char *>(data);
10061009 stblob.len = data_len;
10071010 stblob.flags = CURL_BLOB_COPY ;
Original file line number Diff line number Diff line change @@ -203,7 +203,7 @@ int main(int argc, char *argv[])
203203
204204 for (auto &part : body)
205205 {
206- auto headers_2 = const_cast <std::map<std::string, std::string> &>( req.headers ) ;
206+ auto headers_2 = req.headers ;
207207
208208 const TextMapCarrierTest carrier (headers_2);
209209 auto current_ctx = context::RuntimeContext::GetCurrent ();
Original file line number Diff line number Diff line change @@ -38,10 +38,7 @@ class CircularBuffer
3838 *
3939 * Note: This method must only be called from the consumer thread.
4040 */
41- CircularBufferRange<const AtomicUniquePtr<T>> Peek () const noexcept
42- {
43- return const_cast <CircularBuffer *>(this )->PeekImpl ();
44- }
41+ CircularBufferRange<const AtomicUniquePtr<T>> Peek () const noexcept { return PeekImpl (); }
4542
4643 /* *
4744 * Consume elements from the circular buffer's tail.
@@ -172,7 +169,7 @@ class CircularBuffer
172169 std::atomic<uint64_t > head_{0 };
173170 std::atomic<uint64_t > tail_{0 };
174171
175- CircularBufferRange<AtomicUniquePtr<T>> PeekImpl () noexcept
172+ CircularBufferRange<AtomicUniquePtr<T>> PeekImpl () const noexcept
176173 {
177174 uint64_t tail_index = tail_ % capacity_;
178175 uint64_t head_index = head_ % capacity_;
You can’t perform that action at this time.
0 commit comments