diff options
Diffstat (limited to 'lldb/source/Core/Stream.cpp')
-rw-r--r-- | lldb/source/Core/Stream.cpp | 98 |
1 files changed, 49 insertions, 49 deletions
diff --git a/lldb/source/Core/Stream.cpp b/lldb/source/Core/Stream.cpp index bb1af7b407c..49c15d63c36 100644 --- a/lldb/source/Core/Stream.cpp +++ b/lldb/source/Core/Stream.cpp @@ -64,10 +64,10 @@ Stream::Offset (uint32_t uval, const char *format) // Put an SLEB128 "uval" out to the stream using the printf format // in "format". //------------------------------------------------------------------ -int +size_t Stream::PutSLEB128 (int64_t sval) { - int bytes_written = 0; + size_t bytes_written = 0; if (m_flags.Test(eBinary)) { bool more = true; @@ -98,10 +98,10 @@ Stream::PutSLEB128 (int64_t sval) // Put an ULEB128 "uval" out to the stream using the printf format // in "format". //------------------------------------------------------------------ -int +size_t Stream::PutULEB128 (uint64_t uval) { - int bytes_written = 0; + size_t bytes_written = 0; if (m_flags.Test(eBinary)) { do @@ -127,10 +127,10 @@ Stream::PutULEB128 (uint64_t uval) //------------------------------------------------------------------ // Print a raw NULL terminated C string to the stream. //------------------------------------------------------------------ -int +size_t Stream::PutCString (const char *cstr) { - int cstr_len = strlen(cstr); + size_t cstr_len = strlen(cstr); // when in binary mode, emit the NULL terminator if (m_flags.Test(eBinary)) ++cstr_len; @@ -152,7 +152,7 @@ Stream::QuotedCString (const char *cstr, const char *format) // and suffix strings. //------------------------------------------------------------------ void -Stream::Address (uint64_t addr, int addr_size, const char *prefix, const char *suffix) +Stream::Address (uint64_t addr, uint32_t addr_size, const char *prefix, const char *suffix) { if (prefix == NULL) prefix = ""; @@ -168,7 +168,7 @@ Stream::Address (uint64_t addr, int addr_size, const char *prefix, const char *s // and suffix strings. //------------------------------------------------------------------ void -Stream::AddressRange(uint64_t lo_addr, uint64_t hi_addr, int addr_size, const char *prefix, const char *suffix) +Stream::AddressRange(uint64_t lo_addr, uint64_t hi_addr, uint32_t addr_size, const char *prefix, const char *suffix) { if (prefix && prefix[0]) PutCString (prefix); @@ -179,7 +179,7 @@ Stream::AddressRange(uint64_t lo_addr, uint64_t hi_addr, int addr_size, const ch } -int +size_t Stream::PutChar (char ch) { return Write (&ch, 1); @@ -189,7 +189,7 @@ Stream::PutChar (char ch) //------------------------------------------------------------------ // Print some formatted output to the stream. //------------------------------------------------------------------ -int +size_t Stream::Printf (const char *format, ...) { va_list args; @@ -202,7 +202,7 @@ Stream::Printf (const char *format, ...) //------------------------------------------------------------------ // Print some formatted output to the stream. //------------------------------------------------------------------ -int +size_t Stream::PrintfVarArg (const char *format, va_list args) { char str[1024]; @@ -210,7 +210,7 @@ Stream::PrintfVarArg (const char *format, va_list args) va_copy (args_copy, args); - int bytes_written = 0; + size_t bytes_written = 0; // Try and format our string into a fixed buffer first and see if it fits size_t length = ::vsnprintf (str, sizeof(str), format, args); if (length < sizeof(str)) @@ -244,7 +244,7 @@ Stream::PrintfVarArg (const char *format, va_list args) //------------------------------------------------------------------ // Print and End of Line character to the stream //------------------------------------------------------------------ -int +size_t Stream::EOL() { return PutChar ('\n'); @@ -254,7 +254,7 @@ Stream::EOL() // Indent the current line using the current indentation level and // print an optional string following the idenatation spaces. //------------------------------------------------------------------ -int +size_t Stream::Indent(const char *s) { return Printf ("%*.*s%s", m_indent_level, m_indent_level, "", s ? s : ""); @@ -412,7 +412,7 @@ Stream::IndentLess (int amount) //------------------------------------------------------------------ // Get the address size in bytes //------------------------------------------------------------------ -uint8_t +uint32_t Stream::GetAddressByteSize() const { return m_addr_size; @@ -422,7 +422,7 @@ Stream::GetAddressByteSize() const // Set the address size in bytes //------------------------------------------------------------------ void -Stream::SetAddressByteSize(uint8_t addr_size) +Stream::SetAddressByteSize(uint32_t addr_size) { m_addr_size = addr_size; } @@ -473,7 +473,7 @@ Stream::GetByteOrder() const return m_byte_order; } -int +size_t Stream::PrintfAsRawHex8 (const char *format, ...) { va_list args; @@ -482,7 +482,7 @@ Stream::PrintfAsRawHex8 (const char *format, ...) va_copy (args, args_copy); // Copy this so we char str[1024]; - int bytes_written = 0; + size_t bytes_written = 0; // Try and format our string into a fixed buffer first and see if it fits size_t length = ::vsnprintf (str, sizeof(str), format, args); if (length < sizeof(str)) @@ -511,19 +511,19 @@ Stream::PrintfAsRawHex8 (const char *format, ...) return bytes_written; } -int +size_t Stream::PutNHex8 (size_t n, uint8_t uvalue) { - int bytes_written = 0; + size_t bytes_written = 0; for (size_t i=0; i<n; ++i) bytes_written += _PutHex8 (uvalue, m_flags.Test(eAddPrefix)); return bytes_written; } -int +size_t Stream::_PutHex8 (uint8_t uvalue, bool add_prefix) { - int bytes_written = 0; + size_t bytes_written = 0; if (m_flags.Test(eBinary)) { bytes_written = Write (&uvalue, 1); @@ -542,76 +542,76 @@ Stream::_PutHex8 (uint8_t uvalue, bool add_prefix) return bytes_written; } -int +size_t Stream::PutHex8 (uint8_t uvalue) { return _PutHex8 (uvalue, m_flags.Test(eAddPrefix)); } -int +size_t Stream::PutHex16 (uint16_t uvalue, ByteOrder byte_order) { if (byte_order == eByteOrderInvalid) byte_order = m_byte_order; bool add_prefix = m_flags.Test(eAddPrefix); - int bytes_written = 0; + size_t bytes_written = 0; if (byte_order == eByteOrderLittle) { for (size_t byte = 0; byte < sizeof(uvalue); ++byte, add_prefix = false) - bytes_written += _PutHex8 (uvalue >> (byte * 8), add_prefix); + bytes_written += _PutHex8 ((uint8_t)(uvalue >> (byte * 8)), add_prefix); } else { for (size_t byte = sizeof(uvalue)-1; byte < sizeof(uvalue); --byte, add_prefix = false) - bytes_written += _PutHex8 (uvalue >> (byte * 8), add_prefix); + bytes_written += _PutHex8 ((uint8_t)(uvalue >> (byte * 8)), add_prefix); } return bytes_written; } -int +size_t Stream::PutHex32(uint32_t uvalue, ByteOrder byte_order) { if (byte_order == eByteOrderInvalid) byte_order = m_byte_order; bool add_prefix = m_flags.Test(eAddPrefix); - int bytes_written = 0; + size_t bytes_written = 0; if (byte_order == eByteOrderLittle) { for (size_t byte = 0; byte < sizeof(uvalue); ++byte, add_prefix = false) - bytes_written += _PutHex8 (uvalue >> (byte * 8), add_prefix); + bytes_written += _PutHex8 ((uint8_t)(uvalue >> (byte * 8)), add_prefix); } else { for (size_t byte = sizeof(uvalue)-1; byte < sizeof(uvalue); --byte, add_prefix = false) - bytes_written += _PutHex8 (uvalue >> (byte * 8), add_prefix); + bytes_written += _PutHex8 ((uint8_t)(uvalue >> (byte * 8)), add_prefix); } return bytes_written; } -int +size_t Stream::PutHex64(uint64_t uvalue, ByteOrder byte_order) { if (byte_order == eByteOrderInvalid) byte_order = m_byte_order; bool add_prefix = m_flags.Test(eAddPrefix); - int bytes_written = 0; + size_t bytes_written = 0; if (byte_order == eByteOrderLittle) { for (size_t byte = 0; byte < sizeof(uvalue); ++byte, add_prefix = false) - bytes_written += _PutHex8 (uvalue >> (byte * 8), add_prefix); + bytes_written += _PutHex8 ((uint8_t)(uvalue >> (byte * 8)), add_prefix); } else { for (size_t byte = sizeof(uvalue)-1; byte < sizeof(uvalue); --byte, add_prefix = false) - bytes_written += _PutHex8 (uvalue >> (byte * 8), add_prefix); + bytes_written += _PutHex8 ((uint8_t)(uvalue >> (byte * 8)), add_prefix); } return bytes_written; } -int +size_t Stream::PutMaxHex64 ( uint64_t uvalue, @@ -621,21 +621,21 @@ Stream::PutMaxHex64 { switch (byte_size) { - case 1: return PutHex8 (uvalue); - case 2: return PutHex16 (uvalue); - case 4: return PutHex32 (uvalue); + case 1: return PutHex8 ((uint8_t)uvalue); + case 2: return PutHex16 ((uint16_t)uvalue); + case 4: return PutHex32 ((uint32_t)uvalue); case 8: return PutHex64 (uvalue); } return 0; } -int +size_t Stream::PutPointer (void *ptr) { return PutRawBytes (&ptr, sizeof(ptr), lldb::endian::InlHostByteOrder(), lldb::endian::InlHostByteOrder()); } -int +size_t Stream::PutFloat(float f, ByteOrder byte_order) { if (byte_order == eByteOrderInvalid) @@ -644,7 +644,7 @@ Stream::PutFloat(float f, ByteOrder byte_order) return PutRawBytes (&f, sizeof(f), lldb::endian::InlHostByteOrder(), byte_order); } -int +size_t Stream::PutDouble(double d, ByteOrder byte_order) { if (byte_order == eByteOrderInvalid) @@ -653,7 +653,7 @@ Stream::PutDouble(double d, ByteOrder byte_order) return PutRawBytes (&d, sizeof(d), lldb::endian::InlHostByteOrder(), byte_order); } -int +size_t Stream::PutLongDouble(long double ld, ByteOrder byte_order) { if (byte_order == eByteOrderInvalid) @@ -662,7 +662,7 @@ Stream::PutLongDouble(long double ld, ByteOrder byte_order) return PutRawBytes (&ld, sizeof(ld), lldb::endian::InlHostByteOrder(), byte_order); } -int +size_t Stream::PutRawBytes (const void *s, size_t src_len, ByteOrder src_byte_order, ByteOrder dst_byte_order) { if (src_byte_order == eByteOrderInvalid) @@ -671,7 +671,7 @@ Stream::PutRawBytes (const void *s, size_t src_len, ByteOrder src_byte_order, By if (dst_byte_order == eByteOrderInvalid) dst_byte_order = m_byte_order; - int bytes_written = 0; + size_t bytes_written = 0; const uint8_t *src = (const uint8_t *)s; bool binary_was_set = m_flags.Test (eBinary); if (!binary_was_set) @@ -692,7 +692,7 @@ Stream::PutRawBytes (const void *s, size_t src_len, ByteOrder src_byte_order, By return bytes_written; } -int +size_t Stream::PutBytesAsRawHex8 (const void *s, size_t src_len, ByteOrder src_byte_order, ByteOrder dst_byte_order) { if (src_byte_order == eByteOrderInvalid) @@ -701,7 +701,7 @@ Stream::PutBytesAsRawHex8 (const void *s, size_t src_len, ByteOrder src_byte_ord if (dst_byte_order == eByteOrderInvalid) dst_byte_order = m_byte_order; - int bytes_written = 0; + size_t bytes_written = 0; const uint8_t *src = (const uint8_t *)s; bool binary_is_set = m_flags.Test(eBinary); m_flags.Clear(eBinary); @@ -721,10 +721,10 @@ Stream::PutBytesAsRawHex8 (const void *s, size_t src_len, ByteOrder src_byte_ord return bytes_written; } -int +size_t Stream::PutCStringAsRawHex8 (const char *s) { - int bytes_written = 0; + size_t bytes_written = 0; bool binary_is_set = m_flags.Test(eBinary); m_flags.Clear(eBinary); do |