Skip to content

Commit 53de429

Browse files
committed
Fixes type in utf8_range_IsTrailByteOk
1 parent 16dde22 commit 53de429

File tree

3 files changed

+10
-13
lines changed

3 files changed

+10
-13
lines changed

sdk/src/common/internal/utf8_range/uft8_range.cc

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,9 @@ static FORCE_INLINE_ATTR bool utf8_range_AsciiIsAscii(unsigned char c)
4949
return c < 128;
5050
}
5151

52-
static FORCE_INLINE_ATTR bool utf8_range_IsTrailByteOk(const char c)
52+
static FORCE_INLINE_ATTR bool utf8_range_IsTrailByteOk(unsigned char c)
5353
{
54-
return static_cast<int8_t>(c) <= static_cast<int8_t>(0xBF);
55-
}
56-
57-
static FORCE_INLINE_ATTR bool utf8_range_IsTrailByteOk(const unsigned char c)
58-
{
59-
return utf8_range_IsTrailByteOk(static_cast<const char>(c));
54+
return c <= static_cast<unsigned char>(0xBF);
6055
}
6156

6257
/* If return_position is false then it returns 1 if |data| is a valid utf8
@@ -98,7 +93,8 @@ static size_t utf8_range_ValidateUTF8Naive(const char *data, const char *end, in
9893
continue;
9994
}
10095
/* [C2..DF], [80..BF] -> 2 bytes */
101-
if (len >= 2 && byte1 >= 0xC2 && byte1 <= 0xDF && utf8_range_IsTrailByteOk(data[1]))
96+
if (len >= 2 && byte1 >= 0xC2 && byte1 <= 0xDF &&
97+
utf8_range_IsTrailByteOk(static_cast<unsigned char>(data[1])))
10298
{
10399
codepoint_bytes = 2;
104100
continue;
@@ -168,15 +164,15 @@ static size_t utf8_range_ValidateUTF8Naive(const char *data, const char *end, in
168164
static inline int utf8_range_CodepointSkipBackwards(int32_t codepoint_word)
169165
{
170166
const int8_t *const codepoint = (const int8_t *)(&codepoint_word);
171-
if (!utf8_range_IsTrailByteOk(codepoint[3]))
167+
if (!utf8_range_IsTrailByteOk(static_cast<unsigned char>(codepoint[3])))
172168
{
173169
return 1;
174170
}
175-
else if (!utf8_range_IsTrailByteOk(codepoint[2]))
171+
else if (!utf8_range_IsTrailByteOk(static_cast<unsigned char>(codepoint[2])))
176172
{
177173
return 2;
178174
}
179-
else if (!utf8_range_IsTrailByteOk(codepoint[1]))
175+
else if (!utf8_range_IsTrailByteOk(static_cast<unsigned char>(codepoint[1])))
180176
{
181177
return 3;
182178
}

sdk/src/resource/resource.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ namespace resource
2424
{
2525

2626
Resource::Resource(const ResourceAttributes &attributes, const std::string &schema_url) noexcept
27-
: attributes_(attributes), schema_url_(schema_url)
27+
: schema_url_(schema_url)
2828
{
2929
attributes_.reserve(attributes.size());
3030
for (auto &kv : attributes)

sdk/src/trace/span.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,8 @@ void Span::AddLink(const opentelemetry::trace::SpanContext &target,
170170
return;
171171
}
172172

173-
recordable_->AddLink(target, common::KeyValueFilterIterable(attrs, "[Trace Span Link] "));
173+
recordable_->AddLink(
174+
target, opentelemetry::sdk::common::KeyValueFilterIterable(attrs, "[Trace Span Link] "));
174175
}
175176

176177
void Span::AddLinks(const opentelemetry::trace::SpanContextKeyValueIterable &links) noexcept

0 commit comments

Comments
 (0)