| 10099 | GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_ |
| 10100 | GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_ |
| 10101 | static void PrintCharsAsStringTo( |
| 10102 | const CharType* begin, size_t len, ostream* os) { |
| 10103 | const char* const kQuoteBegin = sizeof(CharType) == 1 ? "\"" : "L\""; |
| 10104 | *os << kQuoteBegin; |
| 10105 | bool is_previous_hex = false; |
| 10106 | for (size_t index = 0; index < len; ++index) { |
| 10107 | const CharType cur = begin[index]; |
| 10108 | if (is_previous_hex && IsXDigit(cur)) { |
| 10109 | // Previous character is of '\x..' form and this character can be |
| 10110 | // interpreted as another hexadecimal digit in its number. Break string to |
| 10111 | // disambiguate. |
| 10112 | *os << "\" " << kQuoteBegin; |
| 10113 | } |
| 10114 | is_previous_hex = PrintAsStringLiteralTo(cur, os) == kHexEscape; |
| 10115 | } |
| 10116 | *os << "\""; |
| 10117 | } |
| 10118 | |
| 10119 | // Prints a (const) char/wchar_t array of 'len' elements, starting at address |
| 10120 | // 'begin'. CharType must be either char or wchar_t. |
no test coverage detected