зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1552755 - Add ToHex to stringutils.h; r=ng
This was added in commit 74395345e8d2fecd504cb687eb79deee4ef394c3, but this only cherry picks the ToHex part of that commit. Depends on D33336 Differential Revision: https://phabricator.services.mozilla.com/D33337 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
3a63433a17
Коммит
a03a64be06
|
@ -130,4 +130,11 @@ std::string string_trim(const std::string& s) {
|
|||
return s.substr(first, last - first + 1);
|
||||
}
|
||||
|
||||
std::string ToHex(const int i) {
|
||||
char buffer[50];
|
||||
snprintf(buffer, sizeof(buffer), "%x", i);
|
||||
|
||||
return std::string(buffer);
|
||||
}
|
||||
|
||||
} // namespace rtc
|
||||
|
|
|
@ -311,6 +311,9 @@ bool ends_with(const char *s1, const char *s2);
|
|||
// Remove leading and trailing whitespaces.
|
||||
std::string string_trim(const std::string& s);
|
||||
|
||||
// TODO(jonasolsson): replace with absl::Hex when that becomes available.
|
||||
std::string ToHex(const int i);
|
||||
|
||||
} // namespace rtc
|
||||
|
||||
#endif // RTC_BASE_STRINGUTILS_H_
|
||||
|
|
Загрузка…
Ссылка в новой задаче