From 2b029213f97910692d1e48e097cc5cc1ad3b44b7 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 9 Nov 2019 12:14:29 +0100 Subject: Fix various clang-tidy warnings --- pugl/detail/implementation.c | 22 +++++++++++----------- pugl/detail/implementation.h | 2 +- pugl/detail/x11.c | 2 +- pugl/detail/x11_gl.c | 8 ++++---- 4 files changed, 17 insertions(+), 17 deletions(-) (limited to 'pugl') diff --git a/pugl/detail/implementation.c b/pugl/detail/implementation.c index a2ff2ec..df87276 100644 --- a/pugl/detail/implementation.c +++ b/pugl/detail/implementation.c @@ -259,22 +259,22 @@ puglDecodeUTF8(const uint8_t* buf) } else if (buf[0] < 0xC2) { return 0xFFFD; } else if (buf[0] < 0xE0) { - FAIL_IF((buf[1] & 0xC0) != 0x80); - return (buf[0] << 6) + buf[1] - 0x3080u; + FAIL_IF((buf[1] & 0xC0u) != 0x80); + return (buf[0] << 6u) + buf[1] - 0x3080u; } else if (buf[0] < 0xF0) { - FAIL_IF((buf[1] & 0xC0) != 0x80); + FAIL_IF((buf[1] & 0xC0u) != 0x80); FAIL_IF(buf[0] == 0xE0 && buf[1] < 0xA0); - FAIL_IF((buf[2] & 0xC0) != 0x80); - return (buf[0] << 12) + (buf[1] << 6) + buf[2] - 0xE2080u; + FAIL_IF((buf[2] & 0xC0u) != 0x80); + return (buf[0] << 12u) + (buf[1] << 6u) + buf[2] - 0xE2080u; } else if (buf[0] < 0xF5) { - FAIL_IF((buf[1] & 0xC0) != 0x80); + FAIL_IF((buf[1] & 0xC0u) != 0x80); FAIL_IF(buf[0] == 0xF0 && buf[1] < 0x90); FAIL_IF(buf[0] == 0xF4 && buf[1] >= 0x90); - FAIL_IF((buf[2] & 0xC0) != 0x80); - FAIL_IF((buf[3] & 0xC0) != 0x80); - return ((buf[0] << 18) + - (buf[1] << 12) + - (buf[2] << 6) + + FAIL_IF((buf[2] & 0xC0u) != 0x80u); + FAIL_IF((buf[3] & 0xC0u) != 0x80u); + return ((buf[0] << 18u) + + (buf[1] << 12u) + + (buf[2] << 6u) + buf[3] - 0x3C82080u); } return 0xFFFD; diff --git a/pugl/detail/implementation.h b/pugl/detail/implementation.h index 874e7e1..b1ff264 100644 --- a/pugl/detail/implementation.h +++ b/pugl/detail/implementation.h @@ -32,7 +32,7 @@ extern "C" { #endif /** Set `blob` to `data` with length `len`, reallocating if necessary. */ -void puglSetBlob(PuglBlob* blob, const void* data, size_t len); +void puglSetBlob(PuglBlob* dest, const void* data, size_t len); /** Reallocate and set `*dest` to `string`. */ void puglSetString(char** dest, const char* string); diff --git a/pugl/detail/x11.c b/pugl/detail/x11.c index 37280cd..847c092 100644 --- a/pugl/detail/x11.c +++ b/pugl/detail/x11.c @@ -123,7 +123,7 @@ puglPollEvents(PuglWorld* world, const double timeout) const int nfds = fd + 1; int ret = 0; fd_set fds; - FD_ZERO(&fds); + FD_ZERO(&fds); // NOLINT FD_SET(fd, &fds); if (timeout < 0.0) { diff --git a/pugl/detail/x11_gl.c b/pugl/detail/x11_gl.c index ea34fc3..d64916b 100644 --- a/pugl/detail/x11_gl.c +++ b/pugl/detail/x11_gl.c @@ -47,9 +47,9 @@ puglX11GlHintValue(const int value) } static PuglStatus -puglX11GlGetAttrib(Display* const display, - const GLXFBConfig fb_config, - const int attrib) +puglX11GlGetAttrib(Display* const display, + GLXFBConfig fb_config, + const int attrib) { int value = 0; glXGetFBConfigAttrib(display, fb_config, attrib, &value); @@ -115,7 +115,7 @@ puglX11GlCreate(PuglView* view) PuglInternals* const impl = view->impl; PuglX11GlSurface* const surface = (PuglX11GlSurface*)impl->surface; Display* const display = impl->display; - const GLXFBConfig fb_config = surface->fb_config; + GLXFBConfig fb_config = surface->fb_config; const int ctx_attrs[] = { GLX_CONTEXT_MAJOR_VERSION_ARB, view->hints[PUGL_CONTEXT_VERSION_MAJOR], -- cgit v1.2.1