mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 20:12:57 +01:00
Merge #15880: utils and libraries: Replace deprecated Boost Filesystem functions
a0a222eec Replace deprecated Boost Filesystem function (Hennadii Stepanov)
4f65af97b Remove dead code for walletFile check (Hennadii Stepanov)
Pull request description:
Boost Filesystem `basename()` and `extension()` functions are [deprecated since v1.36.0](https://www.boost.org/doc/libs/1_36_0/libs/filesystem/doc/reference.html#Convenience-functions).
See more: https://lists.boost.org/Archives/boost/2010/01/160905.php
Also this PR prevents further use of deprecated Boost Filesystem functions.
Ref: https://www.boost.org/doc/libs/1_64_0/libs/filesystem/doc/index.htm#Coding-guidelines
Note: On my Linux system Boost 1.65.1 header `/usr/include/boost/filesystem/convenience.hpp` contains:
```c++
# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
inline std::string extension(const path & p)
{
return p.extension().string();
}
inline std::string basename(const path & p)
{
return p.stem().string();
}
inline path change_extension( const path & p, const path & new_extension )
{
path new_p( p );
new_p.replace_extension( new_extension );
return new_p;
}
# endif
```
UPDATE:
Also removed unused code as [noted](https://github.com/bitcoin/bitcoin/pull/15880#discussion_r279386614) by **ryanofsky**.
ACKs for commit a0a222:
Empact:
utACK a0a222eec0
practicalswift:
utACK a0a222eec0b7f615a756e5e0dcec9b02296f999c
fanquake:
utACK a0a222e
ryanofsky:
utACK a0a222eec0b7f615a756e5e0dcec9b02296f999c. Only change is dropping assert and squashing first two commits.
Tree-SHA512: bc54355441c49957507eb8d3a5782b92d65674504d69779bc16b1b997b2e7424d5665eb6bfb6e10b430a6cacd2aca70af2f94e5f7f10bea24624202834ad35c7
This commit is contained in:
parent
698ca44c98
commit
037830d21f
@ -115,7 +115,7 @@ static leveldb::Options GetOptions(size_t nCacheSize)
|
|||||||
}
|
}
|
||||||
|
|
||||||
CDBWrapper::CDBWrapper(const fs::path& path, size_t nCacheSize, bool fMemory, bool fWipe, bool obfuscate)
|
CDBWrapper::CDBWrapper(const fs::path& path, size_t nCacheSize, bool fMemory, bool fWipe, bool obfuscate)
|
||||||
: m_name(fs::basename(path))
|
: m_name{path.stem().string()}
|
||||||
{
|
{
|
||||||
penv = nullptr;
|
penv = nullptr;
|
||||||
readoptions.verify_checksums = true;
|
readoptions.verify_checksums = true;
|
||||||
|
1
src/fs.h
1
src/fs.h
@ -11,6 +11,7 @@
|
|||||||
#include <ext/stdio_filebuf.h>
|
#include <ext/stdio_filebuf.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define BOOST_FILESYSTEM_NO_DEPRECATED
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
#include <boost/filesystem/fstream.hpp>
|
#include <boost/filesystem/fstream.hpp>
|
||||||
#include <boost/filesystem/detail/utf8_codecvt_facet.hpp>
|
#include <boost/filesystem/detail/utf8_codecvt_facet.hpp>
|
||||||
|
@ -341,13 +341,6 @@ bool BerkeleyBatch::VerifyEnvironment(const fs::path& file_path, std::string& er
|
|||||||
LogPrintf("Using BerkeleyDB version %s\n", BerkeleyDatabaseVersion());
|
LogPrintf("Using BerkeleyDB version %s\n", BerkeleyDatabaseVersion());
|
||||||
LogPrintf("Using wallet %s\n", walletFile);
|
LogPrintf("Using wallet %s\n", walletFile);
|
||||||
|
|
||||||
// Wallet file must be a plain filename without a directory
|
|
||||||
if (walletFile != fs::basename(walletFile) + fs::extension(walletFile))
|
|
||||||
{
|
|
||||||
errorStr = strprintf(_("Wallet %s resides outside wallet directory %s"), walletFile, walletDir.string());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!env->Open(true /* retry */)) {
|
if (!env->Open(true /* retry */)) {
|
||||||
errorStr = strprintf(_("Error initializing wallet database environment %s!"), walletDir);
|
errorStr = strprintf(_("Error initializing wallet database environment %s!"), walletDir);
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user