Skip to content

Commit b7e64a5

Browse files
JeremyRubinfurszy
authored andcommitted
Fix subscript[0] in validation.cpp
1 parent 2f7b73b commit b7e64a5

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/serialize.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -535,15 +535,15 @@ class LimitedString
535535
}
536536
string.resize(size);
537537
if (size != 0)
538-
s.read((char*)&string[0], size);
538+
s.read((char*)string.data(), size);
539539
}
540540

541541
template <typename Stream>
542542
void Serialize(Stream& s) const
543543
{
544544
WriteCompactSize(s, string.size());
545545
if (!string.empty())
546-
s.write((char*)&string[0], string.size());
546+
s.write((char*)string.data(), string.size());
547547
}
548548
};
549549

@@ -740,7 +740,7 @@ void Serialize(Stream& os, const std::basic_string<C>& str)
740740
{
741741
WriteCompactSize(os, str.size());
742742
if (!str.empty())
743-
os.write((char*)&str[0], str.size() * sizeof(str[0]));
743+
os.write((char*)str.data(), str.size() * sizeof(C));
744744
}
745745

746746
template <typename Stream, typename C>
@@ -749,7 +749,7 @@ void Unserialize(Stream& is, std::basic_string<C>& str)
749749
unsigned int nSize = ReadCompactSize(is);
750750
str.resize(nSize);
751751
if (nSize != 0)
752-
is.read((char*)&str[0], nSize * sizeof(str[0]));
752+
is.read((char*)str.data(), nSize * sizeof(C));
753753
}
754754

755755
/**
@@ -798,7 +798,7 @@ void Serialize_impl(Stream& os, const prevector<N, T>& v, const unsigned char&)
798798
{
799799
WriteCompactSize(os, v.size());
800800
if (!v.empty())
801-
os.write((char*)&v[0], v.size() * sizeof(T));
801+
os.write((char*)v.data(), v.size() * sizeof(T));
802802
}
803803

804804
template<typename Stream, unsigned int N, typename T, typename V>
@@ -866,7 +866,7 @@ void Serialize_impl(Stream& os, const std::vector<T, A>& v, const unsigned char&
866866
{
867867
WriteCompactSize(os, v.size());
868868
if (!v.empty())
869-
os.write((char*)&v[0], v.size() * sizeof(T));
869+
os.write((char*)v.data(), v.size() * sizeof(T));
870870
}
871871

872872
template <typename Stream, typename T, typename A, typename V>

0 commit comments

Comments
 (0)