diff options
author | David Robillard <d@drobilla.net> | 2019-07-27 21:44:53 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2019-07-29 01:59:23 +0200 |
commit | 29940c35f257fe00cbf6ddebd5b56314c728958e (patch) | |
tree | 935b14c1b4d5667fe3c5115776252662f134f857 | |
parent | c74467ae07cc419b913998d96315d0f7ef5d2b21 (diff) |
Fix various clang-tidy warnings
-rw-r--r-- | pugl/detail/win.c | 26 | ||||
-rw-r--r-- | pugl/detail/x11.c | 2 | ||||
-rw-r--r-- | pugl/detail/x11_gl.c | 2 | ||||
-rw-r--r-- | wscript | 14 |
4 files changed, 26 insertions, 18 deletions
diff --git a/pugl/detail/win.c b/pugl/detail/win.c index 953c620..cd7a781 100644 --- a/pugl/detail/win.c +++ b/pugl/detail/win.c @@ -395,35 +395,35 @@ constrainAspect(const PuglView* const view, RECT* const size, const WPARAM wParam) { - const float minAspect = view->min_aspect_x / (float)view->min_aspect_y; - const float maxAspect = view->max_aspect_x / (float)view->max_aspect_y; - const int w = size->right - size->left; - const int h = size->bottom - size->top; - const float a = w / (float)h; + const float minA = (float)view->min_aspect_x / (float)view->min_aspect_y; + const float maxA = (float)view->max_aspect_x / (float)view->max_aspect_y; + const int w = size->right - size->left; + const int h = size->bottom - size->top; + const float a = (float)w / (float)h; switch (wParam) { case WMSZ_TOP: - size->top = (a < minAspect ? (LONG)(size->bottom - w * minAspect) : - a > maxAspect ? (LONG)(size->bottom - w * maxAspect) : + size->top = (a < minA ? (LONG)(size->bottom - w * minA) : + a > maxA ? (LONG)(size->bottom - w * maxA) : size->top); break; case WMSZ_TOPRIGHT: case WMSZ_RIGHT: case WMSZ_BOTTOMRIGHT: - size->right = (a < minAspect ? (LONG)(size->left + h * minAspect) : - a > maxAspect ? (LONG)(size->left + h * maxAspect) : + size->right = (a < minA ? (LONG)(size->left + h * minA) : + a > maxA ? (LONG)(size->left + h * maxA) : size->right); break; case WMSZ_BOTTOM: - size->bottom = (a < minAspect ? (LONG)(size->top + w * minAspect) : - a > maxAspect ? (LONG)(size->top + w * maxAspect) : + size->bottom = (a < minA ? (LONG)(size->top + w * minA) : + a > maxA ? (LONG)(size->top + w * maxA) : size->bottom); break; case WMSZ_BOTTOMLEFT: case WMSZ_LEFT: case WMSZ_TOPLEFT: - size->left = (a < minAspect ? (LONG)(size->right - h * minAspect) : - a > maxAspect ? (LONG)(size->right - h * maxAspect) : + size->left = (a < minA ? (LONG)(size->right - h * minA) : + a > maxA ? (LONG)(size->right - h * maxA) : size->left); break; } diff --git a/pugl/detail/x11.c b/pugl/detail/x11.c index 70341ea..8b4c136 100644 --- a/pugl/detail/x11.c +++ b/pugl/detail/x11.c @@ -452,7 +452,7 @@ puglRequestAttention(PuglView* view) root, False, SubstructureNotifyMask | SubstructureRedirectMask, - (XEvent*)&event); + &event); } PuglStatus diff --git a/pugl/detail/x11_gl.c b/pugl/detail/x11_gl.c index 7fcf169..929d3a5 100644 --- a/pugl/detail/x11_gl.c +++ b/pugl/detail/x11_gl.c @@ -25,8 +25,8 @@ #include <GL/gl.h> #include <GL/glx.h> -#include <stdlib.h> #include <stdio.h> +#include <stdlib.h> typedef struct { GLXFBConfig fb_config; @@ -207,13 +207,21 @@ def lint(ctx): shell=True) cmd = ("clang-tidy -p=. -header-filter=.* -checks=\"*," + + "-bugprone-suspicious-string-compare," + "-clang-analyzer-alpha.*," + + "-cppcoreguidelines-avoid-magic-numbers," + "-google-readability-todo," + + "-hicpp-multiway-paths-covered," + + "-hicpp-signed-bitwise," + + "-hicpp-uppercase-literal-suffix," + "-llvm-header-guard," + + "-misc-misplaced-const," + "-misc-unused-parameters," + - "-hicpp-signed-bitwise," + # FIXME? - "-readability-else-after-return\" " + - "../pugl/detail/*.c ../test/*.c") + "-readability-else-after-return," + + "-readability-magic-numbers," + + "-readability-uppercase-literal-suffix\" " + + "../pugl/detail/*.c") + subprocess.call(cmd, cwd='build', shell=True) # Alias .m files to be compiled like .c files, gcc will do the right thing. |