diff options
author | Stefan Hacker <dd0t@users.sourceforge.net> | 2015-06-05 16:33:35 +0300 |
---|---|---|
committer | Stefan Hacker <dd0t@users.sourceforge.net> | 2015-07-04 16:12:49 +0300 |
commit | d3d6920da93088a768a7b054665ced387d68df6d (patch) | |
tree | a00ab6c0e2bc1c9f0a2747368335ee1be1653d70 /overlay_gl | |
parent | 75feffb302136543177a98f66d6cedfc8a7fdd46 (diff) |
Fix various warnings in Linux build
This patch fixes various warnings encountered
in the build when using gcc 4.9.
Diffstat (limited to 'overlay_gl')
-rw-r--r-- | overlay_gl/overlay.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/overlay_gl/overlay.c b/overlay_gl/overlay.c index 847270d06..99a2deb89 100644 --- a/overlay_gl/overlay.c +++ b/overlay_gl/overlay.c @@ -52,6 +52,7 @@ #include <math.h> #include <errno.h> #include <time.h> +#include <limits.h> #if defined(TARGET_UNIX) # define GLX_GLXEXT_LEGACY @@ -322,7 +323,7 @@ static void drawOverlay(Context *ctx, unsigned int width, unsigned int height) { // receive and process overlay messages while (1) { - if (ctx->omMsg.omh.iLength == -1) { + if (ctx->omMsg.omh.iLength < 0) { // receive the overlay message header ssize_t length = recv(ctx->iSocket, ctx->omMsg.headerbuffer, sizeof(struct OverlayMsgHeader), 0); if (length < 0) { @@ -337,7 +338,7 @@ static void drawOverlay(Context *ctx, unsigned int width, unsigned int height) { } } else { // receive the overlay message body - ssize_t length = recv(ctx->iSocket, ctx->omMsg.msgbuffer, ctx->omMsg.omh.iLength, 0); + ssize_t length = recv(ctx->iSocket, ctx->omMsg.msgbuffer, (size_t)ctx->omMsg.omh.iLength, 0); if (length < 0) { if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) break; @@ -362,8 +363,8 @@ static void drawOverlay(Context *ctx, unsigned int width, unsigned int height) { struct stat buf; fstat(fd, &buf); if (buf.st_size >= ctx->uiWidth * ctx->uiHeight * 4) { - ctx->uiMappedLength = buf.st_size; - ctx->a_ucTexture = mmap(NULL, buf.st_size, PROT_READ, MAP_SHARED, fd, 0); + ctx->uiMappedLength = (unsigned int)buf.st_size; + ctx->a_ucTexture = mmap(NULL, (size_t)buf.st_size, PROT_READ, MAP_SHARED, fd, 0); if (ctx->a_ucTexture != MAP_FAILED) { // mmap successfull; send a new bodyless sharedmemory overlay message and regenerate the overlay texture struct OverlayMsg om; @@ -508,7 +509,7 @@ static void drawContext(Context * ctx, int width, int height) { om.omh.uiMagic = OVERLAY_MAGIC_NUMBER; om.omh.uiType = OVERLAY_MSGTYPE_FPS; om.omh.iLength = sizeof(struct OverlayMsgFps); - om.omf.fps = ctx->frameCount / elapsed; + om.omf.fps = (float)ctx->frameCount / elapsed; sendMessage(ctx, &om); @@ -516,14 +517,14 @@ static void drawContext(Context * ctx, int width, int height) { ctx->timeT = t; } - GLint program; + GLuint program; GLint viewport[4]; int i; glPushAttrib(GL_ALL_ATTRIB_BITS); glPushClientAttrib(GL_ALL_ATTRIB_BITS); glGetIntegerv(GL_VIEWPORT, viewport); - glGetIntegerv(GL_CURRENT_PROGRAM, &program); + glGetIntegerv(GL_CURRENT_PROGRAM, (GLint *)&program); glViewport(0, 0, width, height); @@ -635,9 +636,9 @@ static void drawContext(Context * ctx, int width, int height) { glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY); - GLint bound = 0, vbobound = 0; - glGetIntegerv(GL_PIXEL_UNPACK_BUFFER_BINDING, &bound); - glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &vbobound); + GLuint bound = 0, vbobound = 0; + glGetIntegerv(GL_PIXEL_UNPACK_BUFFER_BINDING, (GLint *)&bound); + glGetIntegerv(GL_ARRAY_BUFFER_BINDING, (GLint *)&vbobound); if (bound != 0) { glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB, 0); |