aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGennadiy Civil <gennadiycivil@users.noreply.github.com>2017-12-05 17:19:23 -0500
committerGitHub <noreply@github.com>2017-12-05 17:19:23 -0500
commita868e618c0607259c63f37d948b72586a13922ff (patch)
tree1d961a5f52067643ace2651fd3aa8dfbf965e225
parent247a3d8e5e5d403f7fcacdb8ccc71e5059f15daa (diff)
parent9e236748fb7c9e0d29cdcae0a9f4e1c062838f48 (diff)
downloadgoogletest-a868e618c0607259c63f37d948b72586a13922ff.tar.gz
googletest-a868e618c0607259c63f37d948b72586a13922ff.tar.bz2
googletest-a868e618c0607259c63f37d948b72586a13922ff.zip
Merge pull request #1225 from brian-peloton/master
Speed up printing of characters which need hex escaping
-rw-r--r--googletest/src/gtest-printers.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/googletest/src/gtest-printers.cc b/googletest/src/gtest-printers.cc
index a2df412f..dd67f645 100644
--- a/googletest/src/gtest-printers.cc
+++ b/googletest/src/gtest-printers.cc
@@ -180,7 +180,10 @@ static CharFormat PrintAsCharLiteralTo(Char c, ostream* os) {
*os << static_cast<char>(c);
return kAsIs;
} else {
- *os << "\\x" + String::FormatHexInt(static_cast<UnsignedChar>(c));
+ ostream::fmtflags flags = os->flags();
+ *os << "\\x" << std::hex << std::uppercase
+ << static_cast<int>(static_cast<UnsignedChar>(c));
+ os->flags(flags);
return kHexEscape;
}
}