// This is an arbitrary limitation that can be changed if necessary, or removed // if someone has the time and inclination to replicate the fancy logic from // Chromium's base::StringPrinf().
constexpr int kMaxSize = 512;
} // namespace
std::string StringFormat(const char* fmt, ...) {
char buffer[kMaxSize];
va_list args;
va_start(args, fmt);
int result = vsnprintf(buffer, kMaxSize, fmt, args);
va_end(args);
RTC_DCHECK_GE(result, 0) << "ERROR: vsnprintf() failed with error " << result;
RTC_DCHECK_LT(result, kMaxSize)
<< "WARNING: string was truncated from " << result << " to "
<< (kMaxSize - 1) << " characters"; return std::string(buffer);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.