ASSERT_WE_THINK trailing byte is '\0'
This commit is contained in:
parent
369c1a0230
commit
dced9232d0
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
@ -272,9 +274,7 @@ struct TraceableString<char[S]> {
|
|||
return iter - value == S - 1; // Exclude trailing \0 byte
|
||||
}
|
||||
|
||||
static std::string toString(const char* value) {
|
||||
return std::string(value, S - 1); // Exclude trailing \0 byte
|
||||
}
|
||||
static std::string toString(const char* value) { return traceableStringToString(value, S); }
|
||||
};
|
||||
|
||||
template<>
|
||||
|
|
Loading…
Reference in New Issue