From 2ee869b0e83304d2de7501661fe375329d8cc667 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Sat, 7 Dec 2013 05:07:54 -0400 Subject: [PATCH] Fixed some compiler warnings --- src/common/b64.cpp | 2 +- src/modules/graphics/opengl/Font.cpp | 4 ++-- src/modules/graphics/opengl/Font.h | 2 +- src/modules/graphics/opengl/OpenGL.cpp | 2 +- src/modules/graphics/opengl/VertexBuffer.cpp | 12 ++++++------ src/modules/image/magpie/DevilHandler.cpp | 4 ++-- src/modules/math/wrap_Math.cpp | 4 ++-- src/modules/sound/lullaby/WaveDecoder.cpp | 6 +++--- src/modules/timer/sdl/Timer.cpp | 2 +- 9 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/common/b64.cpp b/src/common/b64.cpp index 96f805967..84766744b 100644 --- a/src/common/b64.cpp +++ b/src/common/b64.cpp @@ -25,7 +25,7 @@ namespace love static const char cd64[]="|$$$}rstuvwxyz{$$$$$$$>?@ABCDEFGHIJKLMNOPQRSTUVW$$$$$$XYZ[\\]^_`abcdefghijklmnopq"; -void b64_decode_block(char in[4], char out[3]) +static void b64_decode_block(char in[4], char out[3]) { out[0] = (char)(in[0] << 2 | in[1] >> 4); out[1] = (char)(in[1] << 4 | in[2] >> 2); diff --git a/src/modules/graphics/opengl/Font.cpp b/src/modules/graphics/opengl/Font.cpp index 3fd5acb86..3bf0e96fd 100644 --- a/src/modules/graphics/opengl/Font.cpp +++ b/src/modules/graphics/opengl/Font.cpp @@ -94,7 +94,7 @@ Font::~Font() unloadVolatile(); } -bool Font::initializeTexture(GLint format) +bool Font::initializeTexture(GLenum format) { GLint internalformat = (format == GL_LUMINANCE_ALPHA) ? GL_LUMINANCE8_ALPHA8 : GL_RGBA8; @@ -130,7 +130,7 @@ void Font::createTexture() glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - GLint format = (type == FONT_TRUETYPE ? GL_LUMINANCE_ALPHA : GL_RGBA); + GLenum format = (type == FONT_TRUETYPE ? GL_LUMINANCE_ALPHA : GL_RGBA); // Initialize the texture, attempting smaller sizes if initialization fails. bool initialized = false; diff --git a/src/modules/graphics/opengl/Font.h b/src/modules/graphics/opengl/Font.h index 109343afa..5610c42ee 100644 --- a/src/modules/graphics/opengl/Font.h +++ b/src/modules/graphics/opengl/Font.h @@ -177,7 +177,7 @@ private: }; }; - bool initializeTexture(GLint format); + bool initializeTexture(GLenum format); void createTexture(); Glyph *addGlyph(uint32 glyph); Glyph *findGlyph(uint32 glyph); diff --git a/src/modules/graphics/opengl/OpenGL.cpp b/src/modules/graphics/opengl/OpenGL.cpp index baf2368c4..173473896 100644 --- a/src/modules/graphics/opengl/OpenGL.cpp +++ b/src/modules/graphics/opengl/OpenGL.cpp @@ -90,7 +90,7 @@ void OpenGL::initContext() GLenum curgltextureunit; glGetIntegerv(GL_ACTIVE_TEXTURE, (GLint *) &curgltextureunit); - state.curTextureUnit = curgltextureunit - GL_TEXTURE0; + state.curTextureUnit = (int) curgltextureunit - GL_TEXTURE0; // Retrieve currently bound textures for each texture unit. for (size_t i = 0; i < state.textureUnits.size(); i++) diff --git a/src/modules/graphics/opengl/VertexBuffer.cpp b/src/modules/graphics/opengl/VertexBuffer.cpp index fa45a8bbb..d007cbdc9 100644 --- a/src/modules/graphics/opengl/VertexBuffer.cpp +++ b/src/modules/graphics/opengl/VertexBuffer.cpp @@ -160,7 +160,7 @@ void *VBO::map() if (is_dirty) { - glGetBufferSubDataARB(getTarget(), 0, getSize(), memory_map); + glGetBufferSubDataARB(getTarget(), 0, (GLsizeiptr) getSize(), memory_map); is_dirty = false; } @@ -184,8 +184,8 @@ void VBO::unmap() // "orphan" current buffer to avoid implicit synchronisation on the GPU: // http://www.seas.upenn.edu/~pcozzi/OpenGLInsights/OpenGLInsights-AsynchronousBufferTransfers.pdf - glBufferDataARB(getTarget(), getSize(), NULL, getUsage()); - glBufferDataARB(getTarget(), getSize(), memory_map, getUsage()); + glBufferDataARB(getTarget(), (GLsizeiptr) getSize(), NULL, getUsage()); + glBufferDataARB(getTarget(), (GLsizeiptr) getSize(), memory_map, getUsage()); is_mapped = false; } @@ -225,7 +225,7 @@ void VBO::fill(size_t offset, size_t size, const void *data) // Now we tell the driver it only needs to deal with the data // we changed. memcpy(static_cast(mapdata) + offset, data, size); - glFlushMappedBufferRangeAPPLE(getTarget(), offset, size); + glFlushMappedBufferRangeAPPLE(getTarget(), (GLintptr) offset, (GLsizei) size); } glUnmapBufferARB(getTarget()); @@ -233,7 +233,7 @@ void VBO::fill(size_t offset, size_t size, const void *data) else { // Fall back to a possibly slower SubData (more chance of syncing.) - glBufferSubDataARB(getTarget(), offset, size, data); + glBufferSubDataARB(getTarget(), (GLintptr) offset, (GLsizeiptr) size, data); } if (getMemoryBacking() != BACKING_FULL) @@ -275,7 +275,7 @@ bool VBO::load(bool restore) glBufferParameteriAPPLE(getTarget(), GL_BUFFER_FLUSHING_UNMAP_APPLE, GL_FALSE); // Note that if 'src' is '0', no data will be copied. - glBufferDataARB(getTarget(), getSize(), src, getUsage()); + glBufferDataARB(getTarget(), (GLsizeiptr) getSize(), src, getUsage()); GLenum err = glGetError(); return (GL_NO_ERROR == err); diff --git a/src/modules/image/magpie/DevilHandler.cpp b/src/modules/image/magpie/DevilHandler.cpp index a2e148ab3..3f10c3a77 100644 --- a/src/modules/image/magpie/DevilHandler.cpp +++ b/src/modules/image/magpie/DevilHandler.cpp @@ -97,7 +97,7 @@ DevilHandler::DecodedImage DevilHandler::decode(love::filesystem::FileData *data try { - bool success = ilLoadL(IL_TYPE_UNKNOWN, (void *)data->getData(), data->getSize()) == IL_TRUE; + bool success = ilLoadL(IL_TYPE_UNKNOWN, (void *)data->getData(), (ILuint) data->getSize()) == IL_TRUE; if (!success) throw love::Exception("Could not decode image!"); @@ -113,7 +113,7 @@ DevilHandler::DecodedImage DevilHandler::decode(love::filesystem::FileData *data if (bpp != sizeof(pixel)) throw love::Exception("Could not convert image!"); - img.size = ilGetInteger(IL_IMAGE_SIZE_OF_DATA); + img.size = (size_t) ilGetInteger(IL_IMAGE_SIZE_OF_DATA); try { diff --git a/src/modules/math/wrap_Math.cpp b/src/modules/math/wrap_Math.cpp index d96d69f98..6500b8230 100644 --- a/src/modules/math/wrap_Math.cpp +++ b/src/modules/math/wrap_Math.cpp @@ -223,9 +223,9 @@ int w_isConvex(lua_State *L) } else { - size_t top = lua_gettop(L); + int top = lua_gettop(L); vertices.reserve(top / 2); - for (size_t i = 1; i <= top; i += 2) + for (int i = 1; i <= top; i += 2) { Vertex v; v.x = (float) luaL_checknumber(L, i); diff --git a/src/modules/sound/lullaby/WaveDecoder.cpp b/src/modules/sound/lullaby/WaveDecoder.cpp index d38f4098e..d065c949f 100644 --- a/src/modules/sound/lullaby/WaveDecoder.cpp +++ b/src/modules/sound/lullaby/WaveDecoder.cpp @@ -32,7 +32,7 @@ namespace lullaby { // Callbacks -wuff_sint32 read_callback(void *userdata, wuff_uint8 *buffer, size_t *size) +static wuff_sint32 read_callback(void *userdata, wuff_uint8 *buffer, size_t *size) { WaveFile *input = (WaveFile *) userdata; size_t bytes_left = input->size - input->offset; @@ -43,14 +43,14 @@ wuff_sint32 read_callback(void *userdata, wuff_uint8 *buffer, size_t *size) return WUFF_SUCCESS; } -wuff_sint32 seek_callback(void *userdata, wuff_uint64 offset) +static wuff_sint32 seek_callback(void *userdata, wuff_uint64 offset) { WaveFile *input = (WaveFile *)userdata; input->offset = (size_t) (offset < input->size ? offset : input->size); return WUFF_SUCCESS; } -wuff_sint32 tell_callback(void *userdata, wuff_uint64 *offset) +static wuff_sint32 tell_callback(void *userdata, wuff_uint64 *offset) { WaveFile *input = (WaveFile *)userdata; *offset = input->offset; diff --git a/src/modules/timer/sdl/Timer.cpp b/src/modules/timer/sdl/Timer.cpp index 75ac877fa..481ec4e0c 100644 --- a/src/modules/timer/sdl/Timer.cpp +++ b/src/modules/timer/sdl/Timer.cpp @@ -114,7 +114,7 @@ void Timer::step() void Timer::sleep(double seconds) const { if (seconds > 0) - delay((int)(seconds*1000)); + delay((unsigned int)(seconds*1000)); } double Timer::getDelta() const