Merge #10735: Avoid static analyzer warnings regarding uninitialized arguments
commit565494619d809655fa94d274bb2202d25553e485
authorPieter Wuille <pieter.wuille@gmail.com>
Sun, 16 Jul 2017 19:07:34 +0000 (16 12:07 -0700)
committerPieter Wuille <pieter.wuille@gmail.com>
Sun, 16 Jul 2017 19:15:11 +0000 (16 12:15 -0700)
tree9fc0e1eb206225773d936d380040141f4d5e2375
parentad6fce67b9bb6eee864c8431ad3291aebaa2e5d2
parent6835cb0ab26c913423cc2307c989579d05aabdcb
Merge #10735: Avoid static analyzer warnings regarding uninitialized arguments

6835cb0ab Avoid static analyzer warnings regarding uninitialized arguments (practicalswift)

Pull request description:

  Avoid static analyzer warnings regarding _"Function call argument is a pointer to uninitialized value"_ in cases where we are intentionally using such arguments.

  This is achieved by using `f(b.begin(), b.end())` (`std::array<char, N>`) instead of `f(b, b + N)` (`char b[N]`).

  Rationale:
  * Reduce false positives by guiding static analyzers regarding our intentions.

  Before this commit:

  ```shell
  $ clang-tidy-3.5 -checks=* src/bench/base58.cpp
  bench/base58.cpp:23:9: warning: Function call argument is a pointer to uninitialized value [clang-analyzer-core.CallAndMessage]
          EncodeBase58(b, b + 32);
          ^
  $ clang-tidy-3.5 -checks=* src/bench/verify_script.cpp
  bench/verify_script.cpp:59:5: warning: Function call argument is a pointer to uninitialized value [clang-analyzer-core.CallAndMessage]
      key.Set(vchKey, vchKey + 32, false);
      ^
  $
  ```

  After this commit:

  ```shell
  $ clang-tidy-3.5 -checks=* src/bench/base58.cpp
  $ clang-tidy-3.5 -checks=* src/bench/verify_script.cpp
  $
  ```

Tree-SHA512: 5814a320ca8b959d0954bb64393424bcad73f942d2e988de1cd6788f39153b93900325532f2e340de02d740a3953385d212ae08e7ec72bb4c394a40475f251df