Skip to content
This repository has been archived by the owner on Apr 16, 2023. It is now read-only.

Commit

Permalink
excluded common/StringTools.cpp from format.js cause otherwise it bre…
Browse files Browse the repository at this point in the history
…akts it
  • Loading branch information
mrrovot committed Aug 15, 2020
1 parent baf9518 commit 7bb64f1
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 30 deletions.
8 changes: 6 additions & 2 deletions scripts/format.js
Expand Up @@ -86,9 +86,13 @@ async function getFiles(directory) {

async function formatFile(filePath) {
try {
console.log(`Formatting ${filePath}`);

await exec(`${binaryName} -i ${filePath}`);
if (filePath === "src/common/StringTools.cpp") {
console.log(`Didn't format ${filePath}`)
} else {
console.log(`Formatting ${filePath}`);
await exec(`${binaryName} -i ${filePath}`);
}
} catch (err) {
console.log(`Error formatting ${filePath}: ${err}`);
}
Expand Down
18 changes: 9 additions & 9 deletions src/common/StringTools.cpp
Expand Up @@ -81,9 +81,9 @@ namespace Common
throw std::runtime_error("fromHex: invalid buffer size");
}

// clang-format off
for (uint64_t i = 0; i < text.size() > > 1; ++i)
// clang-format on
/* clang-format off */
for (uint64_t i = 0; i < text.size() >> 1; ++i)
/* clang-format on */
{
static_cast<uint8_t *>(data)[i] = fromHex(text[i << 1]) << 4 | fromHex(text[(i << 1) + 1]);
}
Expand All @@ -103,9 +103,9 @@ namespace Common
return false;
}

// clang-format off
for (uint64_t i = 0; i < text.size() > > 1; ++i)
// clang-format on
/* clang-format off */
for (uint64_t i = 0; i < text.size() >> 1; ++i)
/* clang-format on */
{
uint8_t value1;
if (!fromHex(text[i << 1], value1))
Expand Down Expand Up @@ -149,9 +149,9 @@ namespace Common
return false;
}

// clang-format off
for (uint64_t i = 0; i < text.size() > > 1; ++i)
// clang-format on
/* clang-format off */
for (uint64_t i = 0; i < text.size() >> 1; ++i)
/* clang-format on */
{
uint8_t value1;
if (!fromHex(text[i << 1], value1))
Expand Down
40 changes: 21 additions & 19 deletions src/walletapi/ParseArguments.cpp
Expand Up @@ -30,6 +30,7 @@ ApiConfig parseArguments(int argc, char **argv)

std::string logFilePath;

// clang-format off
options.add_options("Core")(
"h,help", "Display this help message", cxxopts::value<bool>(help)->implicit_value("true"))

Expand All @@ -38,28 +39,28 @@ ApiConfig parseArguments(int argc, char **argv)
cxxopts::value<int>(logLevel)->default_value(std::to_string(config.logLevel)),
"#")

("log-file",
"Specify filepath to log to. Logging to file is disabled by default",
cxxopts::value<std::string>(logFilePath),
"<file>")
("log-file",
"Specify filepath to log to. Logging to file is disabled by default",
cxxopts::value<std::string>(logFilePath),
"<file>")

("no-console",
"If set, will not provide an interactive console",
cxxopts::value<bool>(noConsole)->default_value("false")->implicit_value("true"))
("no-console",
"If set, will not provide an interactive console",
cxxopts::value<bool>(noConsole)->default_value("false")->implicit_value("true"))

("scan-coinbase-transactions",
"Scan miner/coinbase transactions",
cxxopts::value<bool>(scanCoinbaseTransactions)->default_value("false")->implicit_value("true"))
("scan-coinbase-transactions",
"Scan miner/coinbase transactions",
cxxopts::value<bool>(scanCoinbaseTransactions)->default_value("false")->implicit_value("true"))

("threads",
"Specify number of wallet sync threads",
cxxopts::value<unsigned int>(threads)->default_value(
std::to_string(std::max(1u, std::thread::hardware_concurrency()))),
"#")
("threads",
"Specify number of wallet sync threads",
cxxopts::value<unsigned int>(threads)->default_value(
std::to_string(std::max(1u, std::thread::hardware_concurrency()))),
"#")

("v,version",
"Output software version information",
cxxopts::value<bool>(version)->default_value("false")->implicit_value("true"));
("v,version",
"Output software version information",
cxxopts::value<bool>(version)->default_value("false")->implicit_value("true"));

options.add_options("Network")(
"p,port",
Expand All @@ -82,7 +83,8 @@ ApiConfig parseArguments(int argc, char **argv)
"Specify the <password> to access the RPC server.",
cxxopts::value<std::string>(config.rpcPassword),
"<password>");

// clang-format off

try
{
const auto result = options.parse(argc, argv);
Expand Down

0 comments on commit 7bb64f1

Please sign in to comment.