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

Commit

Permalink
finally find out how to avoid clang-format error on StringTools.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
mrrovot committed Aug 15, 2020
1 parent 7bb64f1 commit 9cb4a09
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 16 deletions.
11 changes: 4 additions & 7 deletions scripts/format.js
Expand Up @@ -86,13 +86,10 @@ async function getFiles(directory) {

async function formatFile(filePath) {
try {

if (filePath === "src/common/StringTools.cpp") {
console.log(`Didn't format ${filePath}`)
} else {
console.log(`Formatting ${filePath}`);
await exec(`${binaryName} -i ${filePath}`);
}

console.log(`Formatting ${filePath}`);
await exec(`${binaryName} -i ${filePath}`);

} catch (err) {
console.log(`Error formatting ${filePath}: ${err}`);
}
Expand Down
12 changes: 3 additions & 9 deletions src/common/StringTools.cpp
Expand Up @@ -81,9 +81,7 @@ 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 */
for (uint64_t i = 0; i < (text.size() >> 1); ++i)
{
static_cast<uint8_t *>(data)[i] = fromHex(text[i << 1]) << 4 | fromHex(text[(i << 1) + 1]);
}
Expand All @@ -103,9 +101,7 @@ namespace Common
return false;
}

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

/* clang-format off */
for (uint64_t i = 0; i < text.size() >> 1; ++i)
/* clang-format on */
for (uint64_t i = 0; i < (text.size() >> 1); ++i)
{
uint8_t value1;
if (!fromHex(text[i << 1], value1))
Expand Down

0 comments on commit 9cb4a09

Please sign in to comment.