aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pugl/detail/implementation.c22
-rw-r--r--pugl/detail/implementation.h2
-rw-r--r--pugl/detail/x11.c2
-rw-r--r--pugl/detail/x11_gl.c8
-rw-r--r--test/pugl_test.c4
5 files changed, 20 insertions, 18 deletions
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],
diff --git a/test/pugl_test.c b/test/pugl_test.c
index 6558bf6..f895184 100644
--- a/test/pugl_test.c
+++ b/test/pugl_test.c
@@ -70,6 +70,8 @@ onReshape(PuglView* view, int width, int height)
{
(void)view;
+ const float aspect = (float)width / (float)height;
+
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LESS);
glClearColor(0.2f, 0.2f, 0.2f, 1.0f);
@@ -79,7 +81,7 @@ onReshape(PuglView* view, int width, int height)
glViewport(0, 0, width, height);
float projection[16];
- perspective(projection, 1.8f, width / (float)height, 1.0, 100.0f);
+ perspective(projection, 1.8f, aspect, 1.0f, 100.0f);
glLoadMatrixf(projection);
}