aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-03-08 12:32:12 +0100
committerDavid Robillard <d@drobilla.net>2020-03-08 14:40:51 +0100
commit3a3e6c2834b5b43018bfcb7ab75f562a1666b8af (patch)
treed00143c53ede5373df59ace1b4506cc8d2935068
parent5fc409c5d2e12f005f092fc83800a93a101dd567 (diff)
Cleanup: Fix some conversion warnings
-rw-r--r--pugl/detail/win.h4
-rw-r--r--pugl/detail/x11.c12
-rw-r--r--test/pugl_gl3_test.c14
3 files changed, 15 insertions, 15 deletions
diff --git a/pugl/detail/win.h b/pugl/detail/win.h
index 4219a36..283f39e 100644
--- a/pugl/detail/win.h
+++ b/pugl/detail/win.h
@@ -49,7 +49,7 @@ puglWinGetPixelFormatDescriptor(const PuglHints hints)
hints[PUGL_GREEN_BITS] + //
hints[PUGL_BLUE_BITS]);
- const DWORD dwFlags = hints[PUGL_DOUBLE_BUFFER] ? PFD_DOUBLEBUFFER : 0;
+ const DWORD dwFlags = hints[PUGL_DOUBLE_BUFFER] ? PFD_DOUBLEBUFFER : 0u;
PuglWinPFD pfd;
ZeroMemory(&pfd, sizeof(pfd));
@@ -72,7 +72,7 @@ static inline unsigned
puglWinGetWindowFlags(const PuglView* const view)
{
const bool resizable = view->hints[PUGL_RESIZABLE];
- const unsigned sizeFlags = resizable ? (WS_SIZEBOX | WS_MAXIMIZEBOX) : 0;
+ const unsigned sizeFlags = resizable ? (WS_SIZEBOX | WS_MAXIMIZEBOX) : 0u;
return (WS_CLIPCHILDREN | WS_CLIPSIBLINGS |
(view->parent
diff --git a/pugl/detail/x11.c b/pugl/detail/x11.c
index 8dc27e7..cc77f29 100644
--- a/pugl/detail/x11.c
+++ b/pugl/detail/x11.c
@@ -798,15 +798,15 @@ puglPostRedisplayRect(PuglView* view, PuglRect rect)
mergeExposeEvents(&view->impl->pendingExpose, (const PuglEvent*)&event);
} else if (view->visible) {
// Not dispatching events, send an X expose so we wake up next time
- const int x = (int)floor(rect.x);
- const int y = (int)floor(rect.y);
- const int w = (int)ceil(rect.x + rect.width) - x;
- const int h = (int)ceil(rect.y + rect.height) - y;
+ const double x = floor(rect.x);
+ const double y = floor(rect.y);
+ const double w = ceil(rect.x + rect.width) - x;
+ const double h = ceil(rect.y + rect.height) - y;
XExposeEvent ev = {Expose, 0, True,
view->impl->display, view->impl->win,
- x, y,
- w, h,
+ (int)x, (int)y,
+ (int)w, (int)h,
0};
XSendEvent(view->impl->display, view->impl->win, False, 0, (XEvent*)&ev);
diff --git a/test/pugl_gl3_test.c b/test/pugl_gl3_test.c
index 8b05665..d214f20 100644
--- a/test/pugl_gl3_test.c
+++ b/test/pugl_gl3_test.c
@@ -144,14 +144,14 @@ onExpose(PuglView* view)
glBufferSubData(GL_ARRAY_BUFFER,
0,
- app->numRects * sizeof(Rect),
+ (GLsizeiptr)(app->numRects * sizeof(Rect)),
app->rects);
glDrawElementsInstanced(GL_TRIANGLE_STRIP,
4,
GL_UNSIGNED_INT,
NULL,
- (GLsizei)app->numRects * 4);
+ (GLsizei)(app->numRects * 4));
++app->framesDrawn;
}
@@ -189,8 +189,8 @@ makeRects(const size_t numRects)
Rect* rects = (Rect*)calloc(numRects, sizeof(Rect));
for (size_t i = 0; i < numRects; ++i) {
- const float s = (sinf(i) / 2.0f + 0.5f);
- const float c = (cosf(i) / 2.0f + 0.5f);
+ const float s = (sinf((float)i) / 2.0f + 0.5f);
+ const float c = (cosf((float)i) / 2.0f + 0.5f);
rects[i].size[0] = minSize + s * maxSize;
rects[i].size[1] = minSize + c * maxSize;
@@ -212,10 +212,10 @@ loadShader(const char* const path)
}
fseek(file, 0, SEEK_END);
- const long fileSize = ftell(file);
+ const size_t fileSize = (size_t)ftell(file);
fseek(file, 0, SEEK_SET);
- char* source = (char*)calloc(1, fileSize + 1);
+ char* source = (char*)calloc(1, fileSize + 1u);
fread(source, 1, fileSize, file);
fclose(file);
@@ -332,7 +332,7 @@ main(int argc, char** argv)
glGenBuffers(1, &app.instanceVbo);
glBindBuffer(GL_ARRAY_BUFFER, app.instanceVbo);
glBufferData(GL_ARRAY_BUFFER,
- app.numRects * sizeof(Rect),
+ (GLsizeiptr)(app.numRects * sizeof(Rect)),
app.rects,
GL_STREAM_DRAW);