Skip to content

Commit 16c7067

Browse files
authored
[API] fix sign-conversion warnings in span & trace id (open-telemetry#3761)
1 parent bed305f commit 16c7067

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

api/include/opentelemetry/nostd/internal/absl/types/internal/variant.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ OTABSL_NAMESPACE_BEGIN
4545
template <class... Types>
4646
class variant;
4747

48-
OTABSL_INTERNAL_INLINE_CONSTEXPR(size_t, variant_npos, -1);
48+
OTABSL_INTERNAL_INLINE_CONSTEXPR(size_t, variant_npos, static_cast<std::size_t>(-1));
4949

5050
template <class T>
5151
struct variant_size;

api/include/opentelemetry/nostd/string_view.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ class string_view
124124
auto found = Traits::find(data() + pos, length() - pos, ch);
125125
if (found)
126126
{
127-
res = found - data();
127+
res = static_cast<size_type>(found - data());
128128
}
129129
}
130130
return res;

api/include/opentelemetry/trace/span_id.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class SpanId final
1717
{
1818
public:
1919
// The size in bytes of the SpanId.
20-
static constexpr int kSize = 8;
20+
static constexpr size_t kSize = 8;
2121

2222
// An invalid SpanId (all zeros).
2323
SpanId() noexcept : rep_{0} {}
@@ -29,7 +29,7 @@ class SpanId final
2929
void ToLowerBase16(nostd::span<char, 2 * kSize> buffer) const noexcept
3030
{
3131
constexpr char kHex[] = "0123456789abcdef";
32-
for (int i = 0; i < kSize; ++i)
32+
for (size_t i = 0; i < kSize; ++i)
3333
{
3434
buffer[i * 2 + 0] = kHex[(rep_[i] >> 4) & 0xF];
3535
buffer[i * 2 + 1] = kHex[(rep_[i] >> 0) & 0xF];

api/include/opentelemetry/trace/trace_id.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class TraceId final
2020
{
2121
public:
2222
// The size in bytes of the TraceId.
23-
static constexpr int kSize = 16;
23+
static constexpr size_t kSize = 16;
2424

2525
// An invalid TraceId (all zeros).
2626
TraceId() noexcept : rep_{0} {}
@@ -35,7 +35,7 @@ class TraceId final
3535
void ToLowerBase16(nostd::span<char, 2 * kSize> buffer) const noexcept
3636
{
3737
constexpr char kHex[] = "0123456789abcdef";
38-
for (int i = 0; i < kSize; ++i)
38+
for (size_t i = 0; i < kSize; ++i)
3939
{
4040
buffer[i * 2 + 0] = kHex[(rep_[i] >> 4) & 0xF];
4141
buffer[i * 2 + 1] = kHex[(rep_[i] >> 0) & 0xF];

0 commit comments

Comments
 (0)