Skip to content

Commit

Permalink
resolved aditya's questions
Browse files Browse the repository at this point in the history
  • Loading branch information
Tianlin-Zhao committed Aug 21, 2020
1 parent dd7f65d commit bae2047
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions api/include/opentelemetry/trace/propagation/http_trace_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class HttpTraceContext : public HTTPTextFormat<T>
}
}

static void GenerateBuffer(nostd::string_view string, int bytes, uint8_t *buffer)
static void GenerateBuffer(nostd::string_view string, int bytes, uint8_t buf[])
{
const char *str_id = string.begin();
for (int i = 0; i < bytes; i++)
Expand All @@ -103,33 +103,33 @@ class HttpTraceContext : public HTTPTextFormat<T>
{
for (int j = 0; j < bytes / 2; j++)
{
buffer[j] = 0;
buf[j] = 0;
}
return;
}
if (i % 2 == 0)
{
buffer[i / 2] = tmp * 16;
buf[i / 2] = tmp * 16;
}
else
{
buffer[i / 2] += tmp;
buf[i / 2] += tmp;
}
}
}

static TraceId GenerateTraceIdFromString(nostd::string_view trace_id)
{
uint8_t buf[kTraceIdBytes / 2];
GenerateBuffer(trace_id, kTraceIdBytes, &buf);
GenerateBuffer(trace_id, kTraceIdBytes, buf);
return TraceId(buf);
}

static SpanId GenerateSpanIdFromString(nostd::string_view span_id)
{
uint8_t buf[kSpanIdBytes / 2];
GenerateBuffer(span_id, kSpanIdBytes, &buf);
return SpanId(buf);
GenerateBuffer(span_id, kSpanIdBytes, buf);
return SpanId();
}

static TraceFlags GenerateTraceFlagsFromString(nostd::string_view trace_flags)
Expand Down

0 comments on commit bae2047

Please sign in to comment.