mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-10 14:48:46 +02:00
Merge #10793: Changing &var[0] to var.data()
592404f03 Changing &vec[0] to vec.data(), what 9804 missed (MeshCollider)
Pull request description:
This just continues the work of https://github.com/bitcoin/bitcoin/pull/9804
Modifies a lot of `&vector[]`'s to `vector.data()`'s across all the files including tests, just the stuff that 9804 missed
Tree-SHA512: dd1a9dffb999dea4fba78dcc91fe02f90250db86f5c74948e1ff3e8b4036b2154b600555eaa04dece5368920aae3513bc36425dc96e4319ca1041b0928a6b656
This commit is contained in:
@@ -24,7 +24,7 @@ X509 *parse_b64der_cert(const char* cert_data)
|
||||
{
|
||||
std::vector<unsigned char> data = DecodeBase64(cert_data);
|
||||
assert(data.size() > 0);
|
||||
const unsigned char* dptr = &data[0];
|
||||
const unsigned char* dptr = data.data();
|
||||
X509 *cert = d2i_X509(nullptr, &dptr, data.size());
|
||||
assert(cert);
|
||||
return cert;
|
||||
@@ -43,7 +43,7 @@ static SendCoinsRecipient handleRequest(PaymentServer* server, std::vector<unsig
|
||||
// Write data to a temp file:
|
||||
QTemporaryFile f;
|
||||
f.open();
|
||||
f.write((const char*)&data[0], data.size());
|
||||
f.write((const char*)data.data(), data.size());
|
||||
f.close();
|
||||
|
||||
// Create a QObject, install event filter from PaymentServer
|
||||
@@ -139,7 +139,7 @@ void PaymentServerTests::paymentServerTests()
|
||||
|
||||
// Contains a testnet paytoaddress, so payment request network doesn't match client network:
|
||||
data = DecodeBase64(paymentrequest1_cert2_BASE64);
|
||||
byteArray = QByteArray((const char*)&data[0], data.size());
|
||||
byteArray = QByteArray((const char*)data.data(), data.size());
|
||||
r.paymentRequest.parse(byteArray);
|
||||
// Ensure the request is initialized, because network "main" is default, even for
|
||||
// uninitialized payment requests and that will fail our test here.
|
||||
@@ -148,7 +148,7 @@ void PaymentServerTests::paymentServerTests()
|
||||
|
||||
// Expired payment request (expires is set to 1 = 1970-01-01 00:00:01):
|
||||
data = DecodeBase64(paymentrequest2_cert2_BASE64);
|
||||
byteArray = QByteArray((const char*)&data[0], data.size());
|
||||
byteArray = QByteArray((const char*)data.data(), data.size());
|
||||
r.paymentRequest.parse(byteArray);
|
||||
// Ensure the request is initialized
|
||||
QVERIFY(r.paymentRequest.IsInitialized());
|
||||
@@ -159,7 +159,7 @@ void PaymentServerTests::paymentServerTests()
|
||||
// 9223372036854775807 (uint64), 9223372036854775807 (int64_t) and -1 (int32_t)
|
||||
// -1 is 1969-12-31 23:59:59 (for a 32 bit time values)
|
||||
data = DecodeBase64(paymentrequest3_cert2_BASE64);
|
||||
byteArray = QByteArray((const char*)&data[0], data.size());
|
||||
byteArray = QByteArray((const char*)data.data(), data.size());
|
||||
r.paymentRequest.parse(byteArray);
|
||||
// Ensure the request is initialized
|
||||
QVERIFY(r.paymentRequest.IsInitialized());
|
||||
@@ -170,7 +170,7 @@ void PaymentServerTests::paymentServerTests()
|
||||
// 9223372036854775808 (uint64), -9223372036854775808 (int64_t) and 0 (int32_t)
|
||||
// 0 is 1970-01-01 00:00:00 (for a 32 bit time values)
|
||||
data = DecodeBase64(paymentrequest4_cert2_BASE64);
|
||||
byteArray = QByteArray((const char*)&data[0], data.size());
|
||||
byteArray = QByteArray((const char*)data.data(), data.size());
|
||||
r.paymentRequest.parse(byteArray);
|
||||
// Ensure the request is initialized
|
||||
QVERIFY(r.paymentRequest.IsInitialized());
|
||||
@@ -190,7 +190,7 @@ void PaymentServerTests::paymentServerTests()
|
||||
|
||||
// Payment request with amount overflow (amount is set to 21000001 BTC):
|
||||
data = DecodeBase64(paymentrequest5_cert2_BASE64);
|
||||
byteArray = QByteArray((const char*)&data[0], data.size());
|
||||
byteArray = QByteArray((const char*)data.data(), data.size());
|
||||
r.paymentRequest.parse(byteArray);
|
||||
// Ensure the request is initialized
|
||||
QVERIFY(r.paymentRequest.IsInitialized());
|
||||
|
||||
Reference in New Issue
Block a user