Skip to content

Commit

Permalink
[clang-format] Add clang-format off/on regions + arrange comments
Browse files Browse the repository at this point in the history
Some minor changes to get better results with clang-format with the
current formatting.
  • Loading branch information
dacap committed Dec 14, 2024
1 parent d109c79 commit 8aa0cba
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
4 changes: 4 additions & 0 deletions base/base64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

namespace base {

// clang-format off

static const char base64Table[] = "ABCDEFGHIJKLMNOP"
"QRSTUVWXYZabcdef"
"ghijklmnopqrstuv"
Expand All @@ -36,6 +38,8 @@ static const int invBase64Table[] = {
// From 112 to 122 'z'
41,42,43,44,45,46,47,48,49,50,51 };

// clang-format on

static inline char base64Char(int index)
{
ASSERT(index >= 0 && index < 64);
Expand Down
3 changes: 2 additions & 1 deletion base/scoped_value.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ namespace base {
public:
ScopedValue(T& instance, const U inValue)
: m_instance(instance)
, m_outValue(instance) { // Restore the current value
// Restore the current value
, m_outValue(instance) {
m_instance = inValue;
}

Expand Down
9 changes: 7 additions & 2 deletions os/win/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,9 @@ static PointerType wt_packet_pkcursor_to_pointer_type(int pkCursor)
case 0: return PointerType::Cursor;
case 1: return PointerType::Pen;
case 2: return PointerType::Eraser;
// TODO check if pkCursor=6 to notify about an inverted
// stylus/eraser if we enable EnableMouseInPointer()
default:
// TODO check if pkCursor=6 to notify about an inverted
// stylus/eraser if we enable EnableMouseInPointer()
}
// Impossible case (negative pkCursor?)
ASSERT(false);
Expand Down Expand Up @@ -789,6 +790,7 @@ std::string WindowWin::getLayout()
WINDOWPLACEMENT wp;
wp.length = sizeof(WINDOWPLACEMENT);
if (GetWindowPlacement(m_hwnd, &wp)) {
// clang-format off
std::ostringstream s;
s << 1 << ' '
<< wp.flags << ' '
Expand All @@ -802,6 +804,7 @@ std::string WindowWin::getLayout()
<< wp.rcNormalPosition.right << ' '
<< wp.rcNormalPosition.bottom;
return s.str();
// clang-format on
}
return "";
}
Expand All @@ -815,6 +818,7 @@ void WindowWin::setLayout(const std::string& layout)
int ver;
s >> ver;
if (ver == 1) {
// clang-format off
s >> wp.flags
>> wp.showCmd
>> wp.ptMinPosition.x
Expand All @@ -825,6 +829,7 @@ void WindowWin::setLayout(const std::string& layout)
>> wp.rcNormalPosition.top
>> wp.rcNormalPosition.right
>> wp.rcNormalPosition.bottom;
// clang-format on
}
else
return;
Expand Down

0 comments on commit 8aa0cba

Please sign in to comment.