aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJeremy Rubin <jeremy.l.rubin@gmail.com>2017-03-28 11:37:06 -0400
committerJeremy Rubin <jeremy.l.rubin@gmail.com>2017-07-08 13:33:01 -0700
commit4cac0d1e041db1d7c7eebd6f022f120d08a1610f (patch)
treee77bdd57a58013f64cacc029cf8314e8b183169b /src
parentac658e55ff75ed5689f87060087f2ed815c34fe0 (diff)
Fix subscript[0] in validation.cpp
Diffstat (limited to 'src')
-rw-r--r--src/serialize.h12
-rw-r--r--src/validation.cpp2
2 files changed, 7 insertions, 7 deletions
diff --git a/src/serialize.h b/src/serialize.h
index e82ddf2c5a..8b86a07a76 100644
--- a/src/serialize.h
+++ b/src/serialize.h
@@ -450,7 +450,7 @@ public:
}
string.resize(size);
if (size != 0)
- s.read((char*)&string[0], size);
+ s.read((char*)string.data(), size);
}
template<typename Stream>
@@ -458,7 +458,7 @@ public:
{
WriteCompactSize(s, string.size());
if (!string.empty())
- s.write((char*)&string[0], string.size());
+ s.write((char*)string.data(), string.size());
}
};
@@ -556,7 +556,7 @@ void Serialize(Stream& os, const std::basic_string<C>& str)
{
WriteCompactSize(os, str.size());
if (!str.empty())
- os.write((char*)&str[0], str.size() * sizeof(str[0]));
+ os.write((char*)str.data(), str.size() * sizeof(C));
}
template<typename Stream, typename C>
@@ -565,7 +565,7 @@ void Unserialize(Stream& is, std::basic_string<C>& str)
unsigned int nSize = ReadCompactSize(is);
str.resize(nSize);
if (nSize != 0)
- is.read((char*)&str[0], nSize * sizeof(str[0]));
+ is.read((char*)str.data(), nSize * sizeof(C));
}
@@ -578,7 +578,7 @@ void Serialize_impl(Stream& os, const prevector<N, T>& v, const unsigned char&)
{
WriteCompactSize(os, v.size());
if (!v.empty())
- os.write((char*)&v[0], v.size() * sizeof(T));
+ os.write((char*)v.data(), v.size() * sizeof(T));
}
template<typename Stream, unsigned int N, typename T, typename V>
@@ -646,7 +646,7 @@ void Serialize_impl(Stream& os, const std::vector<T, A>& v, const unsigned char&
{
WriteCompactSize(os, v.size());
if (!v.empty())
- os.write((char*)&v[0], v.size() * sizeof(T));
+ os.write((char*)v.data(), v.size() * sizeof(T));
}
template<typename Stream, typename T, typename A, typename V>
diff --git a/src/validation.cpp b/src/validation.cpp
index 09288be1ca..a21367848b 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -2890,7 +2890,7 @@ std::vector<unsigned char> GenerateCoinbaseCommitment(CBlock& block, const CBloc
if (consensusParams.vDeployments[Consensus::DEPLOYMENT_SEGWIT].nTimeout != 0) {
if (commitpos == -1) {
uint256 witnessroot = BlockWitnessMerkleRoot(block, NULL);
- CHash256().Write(witnessroot.begin(), 32).Write(&ret[0], 32).Finalize(witnessroot.begin());
+ CHash256().Write(witnessroot.begin(), 32).Write(ret.data(), 32).Finalize(witnessroot.begin());
CTxOut out;
out.nValue = 0;
out.scriptPubKey.resize(38);