Browse Source

Fixed some trivial compiler warnings

Alex Szpakowski 11 years ago
parent
commit
4faddcd9aa

+ 15 - 0
platform/macosx/love-framework.xcodeproj/project.pbxproj

@@ -2345,11 +2345,16 @@
 				ARCHS = "$(ARCHS_STANDARD_64_BIT)";
 				CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
 				CLANG_ENABLE_MODULES = YES;
+				CLANG_WARN_BOOL_CONVERSION = YES;
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
+				CLANG_WARN_ENUM_CONVERSION = YES;
+				CLANG_WARN_INT_CONVERSION = YES;
 				DEAD_CODE_STRIPPING = YES;
 				FRAMEWORK_SEARCH_PATHS = /Library/Frameworks;
 				GCC_OPTIMIZATION_LEVEL = 3;
 				GCC_PREPROCESSOR_DEFINITIONS = LOVE_MACOSX_USE_FRAMEWORKS;
 				GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES;
+				GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
 				GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES;
 				GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES;
@@ -2381,11 +2386,16 @@
 				ARCHS = "$(ARCHS_STANDARD_64_BIT)";
 				CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
 				CLANG_ENABLE_MODULES = YES;
+				CLANG_WARN_BOOL_CONVERSION = YES;
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
+				CLANG_WARN_ENUM_CONVERSION = YES;
+				CLANG_WARN_INT_CONVERSION = YES;
 				COPY_PHASE_STRIP = NO;
 				FRAMEWORK_SEARCH_PATHS = /Library/Frameworks;
 				GCC_OPTIMIZATION_LEVEL = 0;
 				GCC_PREPROCESSOR_DEFINITIONS = LOVE_MACOSX_USE_FRAMEWORKS;
 				GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES;
+				GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
 				GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES;
 				GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES;
@@ -2417,11 +2427,16 @@
 				ARCHS = "$(ARCHS_STANDARD_64_BIT)";
 				CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
 				CLANG_ENABLE_MODULES = YES;
+				CLANG_WARN_BOOL_CONVERSION = YES;
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
+				CLANG_WARN_ENUM_CONVERSION = YES;
+				CLANG_WARN_INT_CONVERSION = YES;
 				DEAD_CODE_STRIPPING = YES;
 				FRAMEWORK_SEARCH_PATHS = /Library/Frameworks;
 				GCC_OPTIMIZATION_LEVEL = 3;
 				GCC_PREPROCESSOR_DEFINITIONS = LOVE_MACOSX_USE_FRAMEWORKS;
 				GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES;
+				GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
 				GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES;
 				GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES;

+ 2 - 2
src/modules/audio/openal/Source.cpp

@@ -468,8 +468,8 @@ void Source::getDirection(float *v) const
 
 void Source::setCone(float innerAngle, float outerAngle, float outerVolume)
 {
-	cone.innerAngle = LOVE_TODEG(innerAngle);
-	cone.outerAngle = LOVE_TODEG(outerAngle);
+	cone.innerAngle = (int) LOVE_TODEG(innerAngle);
+	cone.outerAngle = (int) LOVE_TODEG(outerAngle);
 	cone.outerVolume = outerVolume;
 
 	if (valid)

+ 13 - 13
src/modules/math/MathModule.cpp

@@ -198,14 +198,14 @@ bool Math::isConvex(const std::vector<Vertex> &polygon)
  **/
 float Math::gammaToLinear(float c) const
 {
-	if (c > 1.0)
-		return 1.0;
-	else if (c < 0.0)
-		return 0.0;
+	if (c > 1.0f)
+		return 1.0f;
+	else if (c < 0.0f)
+		return 0.0f;
 	else if (c <= 0.04045)
-		return c / 12.92;
+		return c / 12.92f;
 	else
-		return powf((c + 0.055) / 1.055, 2.4);
+		return powf((c + 0.055f) / 1.055f, 2.4f);
 }
 
 /**
@@ -213,14 +213,14 @@ float Math::gammaToLinear(float c) const
  **/
 float Math::linearToGamma(float c) const
 {
-	if (c > 1.0)
-		return 1.0;
-	else if (c < 0.0)
-		return 0.0;
-	else if (c < 0.0031308)
-		return c * 12.92;
+	if (c > 1.0f)
+		return 1.0f;
+	else if (c < 0.0f)
+		return 0.0f;
+	else if (c < 0.0031308f)
+		return c * 12.92f;
 	else
-		return 1.055 * powf(c, 0.41666) - 0.055;
+		return 1.055f * powf(c, 0.41666f) - 0.055f;
 }
 
 } // math

+ 2 - 2
src/modules/math/wrap_Math.cpp

@@ -259,7 +259,7 @@ static int getGammaArgs(lua_State *L, float color[4])
 		for (int i = 1; i <= n && i <= 4; i++)
 		{
 			lua_rawgeti(L, 1, i);
-			color[i - 1] = (float) luaL_checknumber(L, -1) / 255.0;
+			color[i - 1] = (float) luaL_checknumber(L, -1) / 255.0f;
 			numcomponents++;
 		}
 
@@ -270,7 +270,7 @@ static int getGammaArgs(lua_State *L, float color[4])
 		int n = lua_gettop(L);
 		for (int i = 1; i <= n && i <= 4; i++)
 		{
-			color[i - 1] = (float) luaL_checknumber(L, i) / 255.0;
+			color[i - 1] = (float) luaL_checknumber(L, i) / 255.0f;
 			numcomponents++;
 		}
 	}

+ 1 - 1
src/modules/physics/box2d/Fixture.cpp

@@ -202,7 +202,7 @@ uint16 Fixture::getBits(lua_State *L)
 	{
 		size_t bpos = (size_t)(lua_tointeger(L, i)-1);
 		if (bpos >= 16)
-			return luaL_error(L, "Values must be in range 1-16.");
+			luaL_error(L, "Values must be in range 1-16.");
 		b.set(bpos, true);
 	}
 

+ 2 - 1
src/scripts/auto.lua

@@ -34,7 +34,8 @@ const unsigned char %s[] =
 {
 %s
 }; // [%s]
-} // love]]
+} // love
+]]
 --formatting parameters:
 -- - input file name
 -- - c variable name

+ 1 - 1
src/scripts/boot.lua.h

@@ -5388,4 +5388,4 @@ const unsigned char boot_lua[] =
 	0x65, 0x74, 0x76, 0x61, 0x6c, 0x29, 0x20, 0x6f, 0x72, 0x20, 0x30, 0x0a,
 	0x65, 0x6e, 0x64, 0x0a,
 }; // [boot.lua]
-} // love
+} // love

+ 1 - 1
src/scripts/graphics.lua.h

@@ -6626,4 +6626,4 @@ const unsigned char graphics_lua[] =
 	0x09, 0x65, 0x6e, 0x64, 0x0a,
 	0x65, 0x6e, 0x64, 0x0a,
 }; // [graphics.lua]
-} // love
+} // love