Merge pull request #1456 from atn34/trace-format-fixes
Trace format fixes
This commit is contained in:
commit
77843e8494
|
@ -1218,3 +1218,8 @@ void TraceEventFields::validateFormat() const {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::string traceableStringToString(const char* value, size_t S) {
|
||||
ASSERT_WE_THINK(value[S - 1] == '\0');
|
||||
return std::string(value, S - 1); // Exclude trailing \0 byte
|
||||
}
|
||||
|
|
10
flow/Trace.h
10
flow/Trace.h
|
@ -262,6 +262,8 @@ struct TraceableString<const char*> {
|
|||
}
|
||||
};
|
||||
|
||||
std::string traceableStringToString(const char* value, size_t S);
|
||||
|
||||
template<size_t S>
|
||||
struct TraceableString<char[S]> {
|
||||
static const char* begin(const char* value) {
|
||||
|
@ -269,12 +271,10 @@ struct TraceableString<char[S]> {
|
|||
}
|
||||
|
||||
static bool atEnd(const char* value, const char* iter) {
|
||||
return iter - value == S;
|
||||
return iter - value == S - 1; // Exclude trailing \0 byte
|
||||
}
|
||||
|
||||
static std::string toString(const char* value) {
|
||||
return std::string(value, S);
|
||||
}
|
||||
static std::string toString(const char* value) { return traceableStringToString(value, S); }
|
||||
};
|
||||
|
||||
template<>
|
||||
|
@ -294,7 +294,7 @@ struct TraceableString<char*> {
|
|||
|
||||
template<class T>
|
||||
struct TraceableStringImpl : std::true_type {
|
||||
static constexpr bool isPrintable(char c) { return c > 32 && c < 127; }
|
||||
static constexpr bool isPrintable(char c) { return 32 <= c && c <= 126; }
|
||||
|
||||
template<class Str>
|
||||
static std::string toString(Str&& value) {
|
||||
|
|
Loading…
Reference in New Issue