mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-06 14:19:59 -05:00
Merge bitcoin/bitcoin#28741: refactor: Fix bugprone-string-constructor warning
fa56067a8f
refactor: Fix bugprone-string-constructor warning (MarcoFalke) Pull request description: String literals in C++ have a trailing null character, so the current code is fine to rely on that implicitly. However, * the sqlite documentation explicitly mentions the null character * code readers may wonder if the code is intentional * clang-tidy warns about the code via `bugprone-string-constructor` Address the points by putting the null character into the code and enable the clang-tidy `bugprone-string-constructor` check. ACKs for top commit: stickies-v: ACKfa56067a8f
Tree-SHA512: da519184d792a885a8151ffc44c8da5781f5aaae12ef768a187cc6d9e542ca8952aebc2ec6c1a05f673f29a86ef44902ee96e7b491af7b4705ad38e14624882e
This commit is contained in:
commit
4458ae811a
2 changed files with 3 additions and 2 deletions
|
@ -2,6 +2,7 @@ Checks: '
|
|||
-*,
|
||||
bitcoin-*,
|
||||
bugprone-argument-comment,
|
||||
bugprone-string-constructor,
|
||||
bugprone-use-after-move,
|
||||
bugprone-lambda-function-name,
|
||||
misc-unused-using-decls,
|
||||
|
|
|
@ -129,9 +129,9 @@ bool IsSQLiteFile(const fs::path& path)
|
|||
|
||||
file.close();
|
||||
|
||||
// Check the magic, see https://sqlite.org/fileformat2.html
|
||||
// Check the magic, see https://sqlite.org/fileformat.html
|
||||
std::string magic_str(magic, 16);
|
||||
if (magic_str != std::string("SQLite format 3", 16)) {
|
||||
if (magic_str != std::string{"SQLite format 3\000", 16}) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue