Skip to content

Commit

Permalink
Fix darwin namespace-comments and brace lint issues (#29828)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmagman authored Nov 19, 2021
1 parent d581efc commit be90369
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 18 deletions.
12 changes: 8 additions & 4 deletions flow/display_list_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,14 +229,18 @@ class BoundsAccumulator {
public:
void accumulate(const SkPoint& p) { accumulate(p.fX, p.fY); }
void accumulate(SkScalar x, SkScalar y) {
if (min_x_ > x)
if (min_x_ > x) {
min_x_ = x;
if (min_y_ > y)
}
if (min_y_ > y) {
min_y_ = y;
if (max_x_ < x)
}
if (max_x_ < x) {
max_x_ = x;
if (max_y_ < y)
}
if (max_y_ < y) {
max_y_ = y;
}
}
void accumulate(const SkRect& r) {
if (r.fLeft <= r.fRight && r.fTop <= r.fBottom) {
Expand Down
9 changes: 6 additions & 3 deletions fml/command_line.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,15 @@ inline CommandLine CommandLineFromIteratorsFindFirstPositionalArg(
InputIterator first,
InputIterator last,
InputIterator* first_positional_arg) {
if (first_positional_arg)
if (first_positional_arg) {
*first_positional_arg = last;
}
internal::CommandLineBuilder builder;
for (auto it = first; it < last; ++it) {
if (builder.ProcessArg(*it)) {
if (first_positional_arg)
if (first_positional_arg) {
*first_positional_arg = it;
}
}
}
return builder.Build();
Expand All @@ -213,8 +215,9 @@ inline CommandLine CommandLineFromIteratorsWithArgv0(const std::string& argv0,
InputIterator last) {
internal::CommandLineBuilder builder;
builder.ProcessArg(argv0);
for (auto it = first; it < last; ++it)
for (auto it = first; it < last; ++it) {
builder.ProcessArg(*it);
}
return builder.Build();
}

Expand Down
3 changes: 2 additions & 1 deletion fml/memory/ref_counted.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,9 @@ class RefCountedThreadSafe : public internal::RefCountedThreadSafeBase {
// Releases a reference to this object. This will destroy this object once the
// last reference is released.
void Release() const {
if (internal::RefCountedThreadSafeBase::Release())
if (internal::RefCountedThreadSafeBase::Release()) {
delete static_cast<const T*>(this);
}
}

// Returns true if there is exactly one reference to this object. Use of this
Expand Down
15 changes: 10 additions & 5 deletions fml/platform/darwin/scoped_block.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,21 @@ class ScopedBlock {
explicit ScopedBlock(B block = nullptr,
OwnershipPolicy policy = OwnershipPolicy::Assume)
: block_(block) {
if (block_ && policy == OwnershipPolicy::Retain)
if (block_ && policy == OwnershipPolicy::Retain) {
block_ = Block_copy(block);
}
}

ScopedBlock(const ScopedBlock<B>& that) : block_(that.block_) {
if (block_)
if (block_) {
block_ = Block_copy(block_);
}
}

~ScopedBlock() {
if (block_)
if (block_) {
Block_release(block_);
}
}

ScopedBlock& operator=(const ScopedBlock<B>& that) {
Expand All @@ -51,10 +54,12 @@ class ScopedBlock {

void reset(B block = nullptr,
OwnershipPolicy policy = OwnershipPolicy::Assume) {
if (block && policy == OwnershipPolicy::Retain)
if (block && policy == OwnershipPolicy::Retain) {
block = Block_copy(block);
if (block_)
}
if (block_) {
Block_release(block_);
}
block_ = block;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
FML_DISALLOW_COPY_AND_ASSIGN(MachThreads);
};

}
} // namespace

namespace flutter {
namespace {
Expand Down
2 changes: 1 addition & 1 deletion shell/platform/darwin/ios/ios_switchable_gl_context.mm
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@
FML_DCHECK_CREATION_THREAD_IS_CURRENT(checker);
return [EAGLContext setCurrentContext:previous_context_];
};
}
} // namespace flutter
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@
EXPECT_TRUE(status == GL_FRAMEBUFFER_COMPLETE);
}

} // flutter::testing
} // namespace flutter::testing
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@
ASSERT_TRUE(flag);
}

} // flutter::testing
} // namespace flutter::testing
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@
ASSERT_EQ(texture.height, 600u);
}

} // flutter::testing
} // namespace flutter::testing

0 comments on commit be90369

Please sign in to comment.