diff options
author | Alon Zakai <azakai@google.com> | 2019-05-01 14:48:41 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-01 14:48:41 -0700 |
commit | 2bd3758a22131cfd6925b3fd995657b211095c90 (patch) | |
tree | 2a38a48ab68c00ed1b55e885f86014bbdda92ff2 /src/support/archive.cpp | |
parent | 73709b4da08d285c2237c8c23a54ba53274c0c7f (diff) | |
download | binaryen-2bd3758a22131cfd6925b3fd995657b211095c90.tar.gz binaryen-2bd3758a22131cfd6925b3fd995657b211095c90.tar.bz2 binaryen-2bd3758a22131cfd6925b3fd995657b211095c90.zip |
clang-tidy braces changes (#2075)
Applies the changes in #2065, and temprarily disables the hook since it's too slow to run on a change this large. We should re-enable it in a later commit.
Diffstat (limited to 'src/support/archive.cpp')
-rw-r--r-- | src/support/archive.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/support/archive.cpp b/src/support/archive.cpp index 66f9c192a..1704fd88e 100644 --- a/src/support/archive.cpp +++ b/src/support/archive.cpp @@ -46,8 +46,9 @@ std::string ArchiveMemberHeader::getName() const { } auto* end = static_cast<const uint8_t*>(memchr(fileName, endChar, sizeof(fileName))); - if (!end) + if (!end) { end = fileName + sizeof(fileName); + } return std::string((char*)(fileName), end - fileName); } @@ -81,16 +82,18 @@ Archive::Archive(Buffer& b, bool& error) return; } child_iterator end = child_end(); - if (it == end) + if (it == end) { return; // Empty archive. + } const Child* c = &*it; auto increment = [&]() { ++it; error = it.hasError(); - if (error) + if (error) { return true; + } c = &*it; return false; }; @@ -98,15 +101,17 @@ Archive::Archive(Buffer& b, bool& error) std::string name = c->getRawName(); if (name == "/") { symbolTable = c->getBuffer(); - if (increment() || it == end) + if (increment() || it == end) { return; + } name = c->getRawName(); } if (name == "//") { stringTable = c->getBuffer(); - if (increment() || it == end) + if (increment() || it == end) { return; + } setFirstRegular(*c); return; } @@ -120,8 +125,9 @@ Archive::Archive(Buffer& b, bool& error) Archive::Child::Child(const Archive* parent, const uint8_t* data, bool* error) : parent(parent), data(data) { - if (!data) + if (!data) { return; + } len = sizeof(ArchiveMemberHeader) + getHeader()->getSize(); startOfFile = sizeof(ArchiveMemberHeader); } @@ -180,8 +186,9 @@ std::string Archive::Child::getName() const { } Archive::child_iterator Archive::child_begin(bool SkipInternal) const { - if (data.size() == 0) + if (data.size() == 0) { return child_end(); + } if (SkipInternal) { child_iterator it; |