Prints the given array of characters to the ostream. The array starts at *begin, the length is len, it may include '\0' characters and may not be null-terminated.
| 8804 | // The array starts at *begin, the length is len, it may include '\0' characters |
| 8805 | // and may not be null-terminated. |
| 8806 | static void PrintCharsAsStringTo(const char* begin, size_t len, ostream* os) { |
| 8807 | *os << "\""; |
| 8808 | bool is_previous_hex = false; |
| 8809 | for (size_t index = 0; index < len; ++index) { |
| 8810 | const char cur = begin[index]; |
| 8811 | if (is_previous_hex && IsXDigit(cur)) { |
| 8812 | // Previous character is of '\x..' form and this character can be |
| 8813 | // interpreted as another hexadecimal digit in its number. Break string to |
| 8814 | // disambiguate. |
| 8815 | *os << "\" \""; |
| 8816 | } |
| 8817 | is_previous_hex = PrintAsNarrowStringLiteralTo(cur, os) == kHexEscape; |
| 8818 | } |
| 8819 | *os << "\""; |
| 8820 | } |
| 8821 | |
| 8822 | // Prints a (const) char array of 'len' elements, starting at address 'begin'. |
| 8823 | void UniversalPrintArray(const char* begin, size_t len, ostream* os) { |
no test coverage detected