aboutsummaryrefslogtreecommitdiff
path: root/build_msvc
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2021-05-05 18:21:50 +0200
committerMarcoFalke <falke.marco@gmail.com>2021-05-05 18:24:09 +0200
commit32f1f021bf998f4f9de733d9570cfbf0404f6935 (patch)
tree7447e3e5c66349082524792fd81cdede66937742 /build_msvc
parent1b9a5236e99f57fcd736b5b4ce09095c2c51aa49 (diff)
parentfac30eec42c486ec1bfd696293040a7aa0f04625 (diff)
downloadbitcoin-32f1f021bf998f4f9de733d9570cfbf0404f6935.tar.xz
Merge bitcoin/bitcoin#21817: refactor: Replace &foo[0] with foo.data()
fac30eec42c486ec1bfd696293040a7aa0f04625 refactor: Replace &foo[0] with foo.data() (MarcoFalke) faece47c4706783e0460ed977390a44630b2d44c refactor: Avoid &foo[0] on C-Style arrays (MarcoFalke) face9611093377e8502d91f2ff56f9319a56357c refactor: Use only one temporary buffer in CreateObfuscateKey (MarcoFalke) fa05dddc42770809fdae4d9c35155f8117960019 refactor: Use CPubKey vector constructor where possible (MarcoFalke) fabb6dfe6e734eadd91448122f2ce8c1612c39a6 script: Replace address-of idiom with vector data() method (Guido Vranken) Pull request description: The main theme of this refactor is to replace `&foo[0]` with `foo.data()`. The first commit is taken from #21781 with the rationale: * In CSignatureCache::ComputeEntryECDSA, change the way a vector pointer is resolved to prevent invoking undefined behavior if the vector is empty. The other commits aim to remove all `&foo[0]`, where `foo` is any kind of byte representation. The rationale: * Sometimes alternative code without any raw data pointers is easier to read (refer to the respective commit message for details) * If the raw data pointer is needed, `foo.data()` should be preferred, as pointed out in the developer notes. This addresses the instances that have been missed in commit 592404f03f2b734351d734f0c9ca1fdce997321b, and https://github.com/bitcoin/bitcoin/pull/9804 ACKs for top commit: laanwj: Code review ACK fac30eec42c486ec1bfd696293040a7aa0f04625 practicalswift: cr ACK fac30eec42c486ec1bfd696293040a7aa0f04625: patch looks correct promag: Code review ACK fac30eec42c486ec1bfd696293040a7aa0f04625. Tree-SHA512: e7e73146edbc78911a8e8c728b0a1c6b0ed9a88a008e650aa5dbffe72425bd42c76df70199a9cf7e02637448d7593e0eac52fd0f91f59240283e1390ee21bfa5
Diffstat (limited to 'build_msvc')
-rw-r--r--build_msvc/testconsensus/testconsensus.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/build_msvc/testconsensus/testconsensus.cpp b/build_msvc/testconsensus/testconsensus.cpp
index 115c92792d..f3c8517130 100644
--- a/build_msvc/testconsensus/testconsensus.cpp
+++ b/build_msvc/testconsensus/testconsensus.cpp
@@ -45,7 +45,7 @@ int main()
stream << vanillaSpendTx;
bitcoinconsensus_error err;
- auto op0Result = bitcoinconsensus_verify_script_with_amount(pubKeyScript.data(), pubKeyScript.size(), amount, (const unsigned char*)&stream[0], stream.size(), 0, bitcoinconsensus_SCRIPT_FLAGS_VERIFY_ALL, &err);
+ auto op0Result = bitcoinconsensus_verify_script_with_amount(pubKeyScript.data(), pubKeyScript.size(), amount, stream.data(), stream.size(), 0, bitcoinconsensus_SCRIPT_FLAGS_VERIFY_ALL, &err);
std::cout << "Op0 result: " << op0Result << ", error code " << err << std::endl;
getchar();