Browse Source

Fixed some compiler warnings

Alex Szpakowski 11 years ago
parent
commit
2ee869b0e8

+ 1 - 1
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);

+ 2 - 2
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;

+ 1 - 1
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);

+ 1 - 1
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++)

+ 6 - 6
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<char *>(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);

+ 2 - 2
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
 		{

+ 2 - 2
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);

+ 3 - 3
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;

+ 1 - 1
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