diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2018-07-28 11:09:23 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2018-07-28 11:09:23 +0000 |
commit | f73363f1dd94996356cefbf24388f561891acf0b (patch) | |
tree | e3c31248bdb36eaec5fd833490d4278162dba2a0 /source/DataFormatters/StringPrinter.cpp | |
parent | 160ee69dd7ae18978f4068116777639ea98dc951 (diff) |
Notes
Diffstat (limited to 'source/DataFormatters/StringPrinter.cpp')
-rw-r--r-- | source/DataFormatters/StringPrinter.cpp | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/source/DataFormatters/StringPrinter.cpp b/source/DataFormatters/StringPrinter.cpp index 84143a541087..89d7a95069ca 100644 --- a/source/DataFormatters/StringPrinter.cpp +++ b/source/DataFormatters/StringPrinter.cpp @@ -26,9 +26,8 @@ using namespace lldb; using namespace lldb_private; using namespace lldb_private::formatters; -// we define this for all values of type but only implement it for those we care -// about -// that's good because we get linker errors for any unsupported type +// we define this for all values of type but only implement it for those we +// care about that's good because we get linker errors for any unsupported type template <lldb_private::formatters::StringPrinter::StringElementType type> static StringPrinter::StringPrinterBufferPointer<> GetPrintableImpl(uint8_t *buffer, uint8_t *buffer_end, uint8_t *&next); @@ -163,8 +162,8 @@ GetPrintableImpl<StringPrinter::StringElementType::UTF8>(uint8_t *buffer, (unsigned char)*(buffer + 2), (unsigned char)*(buffer + 3)); break; default: - // this is probably some bogus non-character thing - // just print it as-is and hope to sync up again soon + // this is probably some bogus non-character thing just print it as-is and + // hope to sync up again soon retval = {buffer, 1}; next = buffer + 1; return retval; @@ -223,9 +222,9 @@ GetPrintableImpl<StringPrinter::StringElementType::UTF8>(uint8_t *buffer, return retval; } -// Given a sequence of bytes, this function returns: -// a sequence of bytes to actually print out + a length -// the following unscanned position of the buffer is in next +// Given a sequence of bytes, this function returns: a sequence of bytes to +// actually print out + a length the following unscanned position of the buffer +// is in next static StringPrinter::StringPrinterBufferPointer<> GetPrintable(StringPrinter::StringElementType type, uint8_t *buffer, uint8_t *buffer_end, uint8_t *&next) { @@ -321,8 +320,7 @@ static bool DumpUTFBufferToStream( (llvm::UTF8 *)utf8_data_buffer_sp->GetBytes(); } else { // just copy the pointers - the cast is necessary to make the compiler - // happy - // but this should only happen if we are reading UTF8 data + // happy but this should only happen if we are reading UTF8 data utf8_data_ptr = const_cast<llvm::UTF8 *>( reinterpret_cast<const llvm::UTF8 *>(data_ptr)); utf8_data_end_ptr = const_cast<llvm::UTF8 *>( @@ -344,8 +342,8 @@ static bool DumpUTFBufferToStream( } // since we tend to accept partial data (and even partially malformed data) - // we might end up with no NULL terminator before the end_ptr - // hence we need to take a slower route and ensure we stay within boundaries + // we might end up with no NULL terminator before the end_ptr hence we need + // to take a slower route and ensure we stay within boundaries for (; utf8_data_ptr < utf8_data_end_ptr;) { if (zero_is_terminator && !*utf8_data_ptr) break; @@ -472,8 +470,8 @@ bool StringPrinter::ReadStringAndDumpToStream< } // since we tend to accept partial data (and even partially malformed data) - // we might end up with no NULL terminator before the end_ptr - // hence we need to take a slower route and ensure we stay within boundaries + // we might end up with no NULL terminator before the end_ptr hence we need + // to take a slower route and ensure we stay within boundaries for (uint8_t *data = buffer_sp->GetBytes(); *data && (data < data_end);) { if (escape_non_printables) { uint8_t *next_data = nullptr; |