Skip to content

Commit

Permalink
[FOLD] Provide explicit template parameters to std::array
Browse files Browse the repository at this point in the history
  • Loading branch information
undertome committed Nov 4, 2021
1 parent 122b851 commit 683dafd
Showing 1 changed file with 33 additions and 3 deletions.
36 changes: 33 additions & 3 deletions src/ripple/app/main/DBInit.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,22 @@ inline constexpr std::array<char const*, 5> LgrDBInit{
// Transaction database holds transactions and public keys
inline constexpr auto TxDBName{"transaction.db"};

inline constexpr std::array TxDBPragma
// Omitting the explicit template parameters
// seemed to caused undefined behaviour
inline constexpr std::array<char const*, 4> TxDBPragma
{
"PRAGMA page_size=4096;", "PRAGMA journal_size_limit=1582080;",
"PRAGMA max_page_count=2147483646;",

#if (ULONG_MAX > UINT_MAX) && !defined(NO_SQLITE_MMAP)
"PRAGMA mmap_size=17179869184;"
#else

// Provide an explicit `no-np` SQL statement
// in order to keep the size of the array
// constant regardless of the preprocessor
// condition evaluation
"PRAGMA sqlite_noop_statement;"
#endif
};

Expand Down Expand Up @@ -117,12 +127,22 @@ inline constexpr std::array<char const*, 8> TxDBInit{
// The Ledger Meta database maps ledger hashes to shard indexes
inline constexpr auto LgrMetaDBName{"ledger_meta.db"};

inline constexpr std::array LgrMetaDBPragma
// Omitting the explicit template parameters
// seemed to caused undefined behaviour
inline constexpr std::array<char const*, 4> LgrMetaDBPragma
{
"PRAGMA page_size=4096;", "PRAGMA journal_size_limit=1582080;",
"PRAGMA max_page_count=2147483646;",

#if (ULONG_MAX > UINT_MAX) && !defined(NO_SQLITE_MMAP)
"PRAGMA mmap_size=17179869184;"
#else

// Provide an explicit `no-np` SQL statement
// in order to keep the size of the array
// constant regardless of the preprocessor
// condition evaluation
"PRAGMA sqlite_noop_statement;"
#endif
};

Expand All @@ -141,12 +161,22 @@ inline constexpr std::array<char const*, 3> LgrMetaDBInit{
// Transaction Meta database maps transaction IDs to shard indexes
inline constexpr auto TxMetaDBName{"transaction_meta.db"};

inline constexpr std::array TxMetaDBPragma
// Omitting the explicit template parameters
// seemed to caused undefined behaviour
inline constexpr std::array<char const*, 4> TxMetaDBPragma
{
"PRAGMA page_size=4096;", "PRAGMA journal_size_limit=1582080;",
"PRAGMA max_page_count=2147483646;",

#if (ULONG_MAX > UINT_MAX) && !defined(NO_SQLITE_MMAP)
"PRAGMA mmap_size=17179869184;"
#else

// Provide an explicit `no-np` SQL statement
// in order to keep the size of the array
// constant regardless of the preprocessor
// condition evaluation
"PRAGMA sqlite_noop_statement;"
#endif
};

Expand Down

0 comments on commit 683dafd

Please sign in to comment.