Skip to content

Commit

Permalink
Fixing build errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ndaliya committed Mar 29, 2021
1 parent a452a20 commit d01a4e3
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions api/include/opentelemetry/common/string_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ class StringUtil
public:
static nostd::string_view Trim(nostd::string_view str, size_t left, size_t right)
{
while (str[static_cast<std::size_t>(right)] == ' ' && left < right)
while (str[static_cast<std::size_t>(left)] == ' ' && left <= right)
{
right--;
left++;
}
while (str[static_cast<std::size_t>(left)] == ' ' && left < right)
while (str[static_cast<std::size_t>(right)] == ' ' && left <= right)
{
left++;
right--;
}
return str.substr(left, right - left + 1);
return str.substr(left, 1 + right - left);
}
};

Expand Down
2 changes: 1 addition & 1 deletion api/include/opentelemetry/trace/trace_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class TraceState
std::string header_s;
bool first = true;
kv_properties_->GetAllEntries(
[&header_s, &first ](nostd::string_view key, nostd::string_view value) noexcept {
[&header_s, &first](nostd::string_view key, nostd::string_view value) noexcept {
if (!first)
{
header_s.append(",");
Expand Down
4 changes: 2 additions & 2 deletions api/test/common/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ otel_cc_benchmark(
cc_test(
name = "kv_properties_test",
srcs = [
"kv_properties_test.cc"
"kv_properties_test.cc",
],
deps = [
"//api",
Expand All @@ -20,7 +20,7 @@ cc_test(
cc_test(
name = "string_util_test",
srcs = [
"string_util_test.cc"
"string_util_test.cc",
],
deps = [
"//api",
Expand Down
2 changes: 1 addition & 1 deletion api/test/common/string_util_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ TEST(StringUtilTest, TrimString)
const char *expected;
} testcases[] = {{"k1=v1", "k1=v1"}, {"k1=v1,k2=v2, k3=v3", "k1=v1,k2=v2, k3=v3"},
{" k1=v1", "k1=v1"}, {"k1=v1 ", "k1=v1"},
{" k1=v1 ", "k1=v1"}, {"", ""}};
{" k1=v1 ", "k1=v1"}, {" ", ""}};
for (auto &testcase : testcases)
{
EXPECT_EQ(StringUtil::Trim(testcase.input, 0, strlen(testcase.input) - 1), testcase.expected);
Expand Down

0 comments on commit d01a4e3

Please sign in to comment.