for (size_t i = 0; i < src_len; ++i)
_PutHex8(src[i], false);
} else {
- for (size_t i = src_len - 1; i < src_len; --i)
- _PutHex8(src[i], false);
+ for (size_t i = src_len; i > 0; --i)
+ _PutHex8(src[i - 1], false);
}
if (!binary_was_set)
m_flags.Clear(eBinary);
ByteOrder src_byte_order,
ByteOrder dst_byte_order) {
ByteDelta delta(*this);
+
if (src_byte_order == eByteOrderInvalid)
src_byte_order = m_byte_order;
for (size_t i = 0; i < src_len; ++i)
_PutHex8(src[i], false);
} else {
- for (size_t i = src_len - 1; i < src_len; --i)
- _PutHex8(src[i], false);
+ for (size_t i = src_len; i > 0; --i)
+ _PutHex8(src[i - 1], false);
}
if (binary_is_set)
m_flags.Set(eBinary);
#endif
}
+TEST_F(StreamTest, PutRawBytesZeroLenght) {
+ uint32_t value = 0x12345678;
+
+ s.PutRawBytes(static_cast<void *>(&value), 0, hostByteOrder,
+ lldb::eByteOrderLittle);
+ EXPECT_EQ(0U, s.GetWrittenBytes());
+
+ s.PutRawBytes(static_cast<void *>(&value), 0, hostByteOrder,
+ lldb::eByteOrderBig);
+ EXPECT_EQ(0U, s.GetWrittenBytes());
+}
+
+TEST_F(StreamTest, PutBytesAsRawHex8ZeroLenght) {
+ uint32_t value = 0x12345678;
+
+ s.PutBytesAsRawHex8(static_cast<void *>(&value), 0, hostByteOrder,
+ lldb::eByteOrderLittle);
+ EXPECT_EQ(0U, s.GetWrittenBytes());
+
+ s.PutBytesAsRawHex8(static_cast<void *>(&value), 0, hostByteOrder,
+ lldb::eByteOrderBig);
+ EXPECT_EQ(0U, s.GetWrittenBytes());
+}
+
// ULEB128 support for binary streams.
TEST_F(BinaryStreamTest, PutULEB128OneByte) {