mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-09 09:51:08 +02:00
refactor: shift CopyrightHolders() and LicenseInfo() to clientversion.cpp
This commit is contained in:
@ -3,9 +3,13 @@
|
|||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
#include <clientversion.h>
|
#include <clientversion.h>
|
||||||
|
#include <util/translation.h>
|
||||||
|
|
||||||
#include <tinyformat.h>
|
#include <tinyformat.h>
|
||||||
|
|
||||||
|
#include <sstream>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Name of client reported in the 'version' message. Report the same name
|
* Name of client reported in the 'version' message. Report the same name
|
||||||
@ -72,3 +76,32 @@ std::string FormatSubVersion(const std::string& name, int nClientVersion, const
|
|||||||
ss << "/";
|
ss << "/";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string CopyrightHolders(const std::string& strPrefix)
|
||||||
|
{
|
||||||
|
const auto copyright_devs = strprintf(_(COPYRIGHT_HOLDERS).translated, COPYRIGHT_HOLDERS_SUBSTITUTION);
|
||||||
|
std::string strCopyrightHolders = strPrefix + copyright_devs;
|
||||||
|
|
||||||
|
// Make sure Bitcoin Core copyright is not removed by accident
|
||||||
|
if (copyright_devs.find("Bitcoin Core") == std::string::npos) {
|
||||||
|
strCopyrightHolders += "\n" + strPrefix + "The Bitcoin Core developers";
|
||||||
|
}
|
||||||
|
return strCopyrightHolders;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string LicenseInfo()
|
||||||
|
{
|
||||||
|
const std::string URL_SOURCE_CODE = "<https://github.com/bitcoin/bitcoin>";
|
||||||
|
|
||||||
|
return CopyrightHolders(strprintf(_("Copyright (C) %i-%i").translated, 2009, COPYRIGHT_YEAR) + " ") + "\n" +
|
||||||
|
"\n" +
|
||||||
|
strprintf(_("Please contribute if you find %s useful. "
|
||||||
|
"Visit %s for further information about the software.").translated, PACKAGE_NAME, "<" PACKAGE_URL ">") +
|
||||||
|
"\n" +
|
||||||
|
strprintf(_("The source code is available from %s.").translated, URL_SOURCE_CODE) +
|
||||||
|
"\n" +
|
||||||
|
"\n" +
|
||||||
|
_("This is experimental software.").translated + "\n" +
|
||||||
|
strprintf(_("Distributed under the MIT software license, see the accompanying file %s or %s").translated, "COPYING", "<https://opensource.org/licenses/MIT>") +
|
||||||
|
"\n";
|
||||||
|
}
|
||||||
|
@ -41,6 +41,11 @@ extern const std::string CLIENT_NAME;
|
|||||||
std::string FormatFullVersion();
|
std::string FormatFullVersion();
|
||||||
std::string FormatSubVersion(const std::string& name, int nClientVersion, const std::vector<std::string>& comments);
|
std::string FormatSubVersion(const std::string& name, int nClientVersion, const std::vector<std::string>& comments);
|
||||||
|
|
||||||
|
std::string CopyrightHolders(const std::string& strPrefix);
|
||||||
|
|
||||||
|
/** Returns licensing information (for -version) */
|
||||||
|
std::string LicenseInfo();
|
||||||
|
|
||||||
#endif // WINDRES_PREPROC
|
#endif // WINDRES_PREPROC
|
||||||
|
|
||||||
#endif // BITCOIN_CLIENTVERSION_H
|
#endif // BITCOIN_CLIENTVERSION_H
|
||||||
|
19
src/init.cpp
19
src/init.cpp
@ -594,25 +594,6 @@ void SetupServerArgs(ArgsManager& argsman)
|
|||||||
argsman.AddHiddenArgs(hidden_args);
|
argsman.AddHiddenArgs(hidden_args);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string LicenseInfo()
|
|
||||||
{
|
|
||||||
const std::string URL_SOURCE_CODE = "<https://github.com/bitcoin/bitcoin>";
|
|
||||||
|
|
||||||
return CopyrightHolders(strprintf(_("Copyright (C) %i-%i").translated, 2009, COPYRIGHT_YEAR) + " ") + "\n" +
|
|
||||||
"\n" +
|
|
||||||
strprintf(_("Please contribute if you find %s useful. "
|
|
||||||
"Visit %s for further information about the software.").translated,
|
|
||||||
PACKAGE_NAME, "<" PACKAGE_URL ">") +
|
|
||||||
"\n" +
|
|
||||||
strprintf(_("The source code is available from %s.").translated,
|
|
||||||
URL_SOURCE_CODE) +
|
|
||||||
"\n" +
|
|
||||||
"\n" +
|
|
||||||
_("This is experimental software.").translated + "\n" +
|
|
||||||
strprintf(_("Distributed under the MIT software license, see the accompanying file %s or %s").translated, "COPYING", "<https://opensource.org/licenses/MIT>") +
|
|
||||||
"\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool fHaveGenesis = false;
|
static bool fHaveGenesis = false;
|
||||||
static Mutex g_genesis_wait_mutex;
|
static Mutex g_genesis_wait_mutex;
|
||||||
static std::condition_variable g_genesis_wait_cv;
|
static std::condition_variable g_genesis_wait_cv;
|
||||||
|
@ -70,7 +70,4 @@ bool AppInitMain(node::NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip
|
|||||||
*/
|
*/
|
||||||
void SetupServerArgs(ArgsManager& argsman);
|
void SetupServerArgs(ArgsManager& argsman);
|
||||||
|
|
||||||
/** Returns licensing information (for -version) */
|
|
||||||
std::string LicenseInfo();
|
|
||||||
|
|
||||||
#endif // BITCOIN_INIT_H
|
#endif // BITCOIN_INIT_H
|
||||||
|
@ -1342,18 +1342,6 @@ int GetNumCores()
|
|||||||
return std::thread::hardware_concurrency();
|
return std::thread::hardware_concurrency();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CopyrightHolders(const std::string& strPrefix)
|
|
||||||
{
|
|
||||||
const auto copyright_devs = strprintf(_(COPYRIGHT_HOLDERS).translated, COPYRIGHT_HOLDERS_SUBSTITUTION);
|
|
||||||
std::string strCopyrightHolders = strPrefix + copyright_devs;
|
|
||||||
|
|
||||||
// Make sure Bitcoin Core copyright is not removed by accident
|
|
||||||
if (copyright_devs.find("Bitcoin Core") == std::string::npos) {
|
|
||||||
strCopyrightHolders += "\n" + strPrefix + "The Bitcoin Core developers";
|
|
||||||
}
|
|
||||||
return strCopyrightHolders;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Obtain the application startup time (used for uptime calculation)
|
// Obtain the application startup time (used for uptime calculation)
|
||||||
int64_t GetStartupTime()
|
int64_t GetStartupTime()
|
||||||
{
|
{
|
||||||
|
@ -512,8 +512,6 @@ std::string HelpMessageOpt(const std::string& option, const std::string& message
|
|||||||
*/
|
*/
|
||||||
int GetNumCores();
|
int GetNumCores();
|
||||||
|
|
||||||
std::string CopyrightHolders(const std::string& strPrefix);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* On platforms that support it, tell the kernel the calling thread is
|
* On platforms that support it, tell the kernel the calling thread is
|
||||||
* CPU-intensive and non-interactive. See SCHED_BATCH in sched(7) for details.
|
* CPU-intensive and non-interactive. See SCHED_BATCH in sched(7) for details.
|
||||||
|
@ -16,7 +16,7 @@ FALSE_POSITIVES = [
|
|||||||
("src/dbwrapper.cpp", "vsnprintf(p, limit - p, format, backup_ap)"),
|
("src/dbwrapper.cpp", "vsnprintf(p, limit - p, format, backup_ap)"),
|
||||||
("src/index/base.cpp", "FatalError(const char* fmt, const Args&... args)"),
|
("src/index/base.cpp", "FatalError(const char* fmt, const Args&... args)"),
|
||||||
("src/netbase.cpp", "LogConnectFailure(bool manual_connection, const char* fmt, const Args&... args)"),
|
("src/netbase.cpp", "LogConnectFailure(bool manual_connection, const char* fmt, const Args&... args)"),
|
||||||
("src/util/system.cpp", "strprintf(_(COPYRIGHT_HOLDERS).translated, COPYRIGHT_HOLDERS_SUBSTITUTION)"),
|
("src/clientversion.cpp", "strprintf(_(COPYRIGHT_HOLDERS).translated, COPYRIGHT_HOLDERS_SUBSTITUTION)"),
|
||||||
("src/validationinterface.cpp", "LogPrint(BCLog::VALIDATION, fmt \"\\n\", __VA_ARGS__)"),
|
("src/validationinterface.cpp", "LogPrint(BCLog::VALIDATION, fmt \"\\n\", __VA_ARGS__)"),
|
||||||
("src/wallet/wallet.h", "WalletLogPrintf(std::string fmt, Params... parameters)"),
|
("src/wallet/wallet.h", "WalletLogPrintf(std::string fmt, Params... parameters)"),
|
||||||
("src/wallet/wallet.h", "LogPrintf((\"%s \" + fmt).c_str(), GetDisplayName(), parameters...)"),
|
("src/wallet/wallet.h", "LogPrintf((\"%s \" + fmt).c_str(), GetDisplayName(), parameters...)"),
|
||||||
|
Reference in New Issue
Block a user