Browse Source

Avoid some VC++ compiler warnings

Alex Szpakowski 10 years ago
parent
commit
cf0968fc6d

+ 1 - 5
readme.md

@@ -28,11 +28,7 @@ Then use the Xcode project found at `platform/xcode/love.xcodeproj` to build the
 Download the required libraries from [here][dependencies-ios] and place the `include` and `libraries` folders
 into the `platform/xcode/ios` folder.
 
-Then use the Xcode project found at `platform/xcode/love.xcodeproj` to build the `love-ios` target.
-
-Note that you must be registered in the [iOS Developer Program][iosdeveloper] in order to build for physical iOS devices.
-
-The iOS version is currently a work-in-progress.
+Then use the Xcode project found at `platform/xcode/love.xcodeproj` to build the `love-ios` target. Note that you must be registered in the [iOS Developer Program][iosdeveloper] in order to build for physical iOS devices.
 
 Repository information
 ----------------------

+ 1 - 1
src/common/Exception.cpp

@@ -18,8 +18,8 @@
  * 3. This notice may not be removed or altered from any source distribution.
  **/
 
-#include "Exception.h"
 #include "common/config.h"
+#include "Exception.h"
 
 #include <iostream>
 

+ 1 - 1
src/common/runtime.cpp

@@ -133,7 +133,7 @@ bool luax_boolflag(lua_State *L, int table_index, const char *key, bool defaultV
 	if (lua_isnoneornil(L, -1))
 		retval = defaultValue;
 	else
-		retval = lua_toboolean(L, -1);
+		retval = lua_toboolean(L, -1) != 0;
 
 	lua_pop(L, 1);
 	return retval;

+ 3 - 3
src/modules/filesystem/physfs/Filesystem.cpp

@@ -312,7 +312,7 @@ bool Filesystem::mount(const char *archive, const char *mountpoint, bool appendT
 	if (realPath.length() == 0)
 		return false;
 
-	return PHYSFS_mount(realPath.c_str(), mountpoint, appendToPath);
+	return PHYSFS_mount(realPath.c_str(), mountpoint, appendToPath) != 0;
 }
 
 bool Filesystem::unmount(const char *archive)
@@ -353,7 +353,7 @@ bool Filesystem::unmount(const char *archive)
 	if (!mountPoint)
 		return false;
 
-	return PHYSFS_removeFromSearchPath(realPath.c_str());
+	return PHYSFS_removeFromSearchPath(realPath.c_str()) != 0;
 }
 
 love::filesystem::File *Filesystem::newFile(const char *filename) const
@@ -485,7 +485,7 @@ std::string Filesystem::getRealDirectory(const char *filename) const
 
 bool Filesystem::isDirectory(const char *dir) const
 {
-	return PHYSFS_isDirectory(dir);
+	return PHYSFS_isDirectory(dir) != 0;
 }
 
 bool Filesystem::isFile(const char *file) const

+ 1 - 1
src/modules/filesystem/wrap_File.cpp

@@ -110,7 +110,7 @@ int w_File_read(lua_State *L)
 	File *file = luax_checkfile(L, 1);
 	Data *d = 0;
 
-	int64 size = (int64)luaL_optnumber(L, 2, File::ALL);
+	int64 size = (int64) luaL_optnumber(L, 2, (lua_Number) File::ALL);
 
 	try
 	{

+ 1 - 1
src/modules/graphics/opengl/Canvas.cpp

@@ -396,7 +396,7 @@ void Canvas::setupGrab()
 	gl.setViewport({0, 0, width, height});
 
 	// Set up the projection matrix
-	gl.matrices.projection.push_back(Matrix::ortho(0.0, width, 0.0, height));
+	gl.matrices.projection.push_back(Matrix::ortho(0.0, (float) width, 0.0, (float) height));
 
 	// Make sure the correct sRGB setting is used when drawing to the canvas.
 	if (GLAD_VERSION_1_0 || GLAD_EXT_sRGB_write_control)

+ 1 - 1
src/modules/graphics/opengl/Graphics.cpp

@@ -226,7 +226,7 @@ void Graphics::setViewportSize(int width, int height)
 	Canvas::systemViewport = gl.getViewport();
 
 	// Set up the projection matrix
-	gl.matrices.projection.back() = Matrix::ortho(0.0, width, height, 0.0);
+	gl.matrices.projection.back() = Matrix::ortho(0.0, (float) width, (float) height, 0.0);
 
 	// Restore the previously active Canvas.
 	setCanvas(canvases);

+ 1 - 1
src/modules/graphics/opengl/Image.cpp

@@ -586,7 +586,7 @@ GLenum Image::getCompressedFormat(image::CompressedImageData::Format cformat) co
 
 bool Image::hasAnisotropicFilteringSupport()
 {
-	return GLAD_EXT_texture_filter_anisotropic;
+	return GLAD_EXT_texture_filter_anisotropic != GL_FALSE;
 }
 
 bool Image::hasCompressedTextureSupport(image::CompressedImageData::Format format, bool sRGB)

+ 1 - 1
src/modules/graphics/opengl/Polyline.cpp

@@ -49,7 +49,7 @@ void Polyline::render(const float *coords, size_t count, size_t size_hint, float
 
 	// prepare vertex arrays
 	if (draw_overdraw)
-		halfwidth -= pixel_size * .3;
+		halfwidth -= pixel_size * 0.3f;
 
 	// compute sleeve
 	bool is_looping = (coords[0] == coords[count - 2]) && (coords[1] == coords[count - 1]);

+ 2 - 2
src/modules/graphics/opengl/wrap_Graphics.cpp

@@ -494,8 +494,8 @@ int w_newShader(lua_State *L)
 		}
 	}
 
-	bool has_arg1 = lua_isstring(L, 1);
-	bool has_arg2 = lua_isstring(L, 2);
+	bool has_arg1 = lua_isstring(L, 1) != 0;
+	bool has_arg2 = lua_isstring(L, 2) != 0;
 
 	// require at least one string argument
 	if (!(has_arg1 || has_arg2))

+ 2 - 2
src/modules/keyboard/sdl/Keyboard.cpp

@@ -137,12 +137,12 @@ void Keyboard::setTextInput(bool enable, double x, double y, double w, double h)
 
 bool Keyboard::hasTextInput() const
 {
-	return SDL_IsTextInputActive();
+	return SDL_IsTextInputActive() != SDL_FALSE;
 }
 
 bool Keyboard::hasScreenKeyboard() const
 {
-	return SDL_HasScreenKeyboardSupport();
+	return SDL_HasScreenKeyboardSupport() != SDL_FALSE;
 }
 
 bool Keyboard::getConstant(Scancode in, SDL_Scancode &out)

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

@@ -76,7 +76,7 @@ EdgeShape *ChainShape::getChildEdge(int index) const
 	{
 		c->GetChildEdge(e, index);
 	}
-	catch (love::Exception &ex)
+	catch (love::Exception &)
 	{
 		delete e;
 		throw;

+ 9 - 6
src/modules/window/sdl/Window.cpp

@@ -252,7 +252,10 @@ bool Window::createWindowAndContext(int x, int y, int w, int h, Uint32 windowfla
 			setGLFramebufferAttributes(0, false);
 			window = SDL_CreateWindow(title.c_str(), x, y, w, h, windowflags);
 			if (window)
-				curSRGB = curMSAA = 0;
+			{
+				curMSAA = 0;
+				curSRGB = false;
+			}
 		}
 
 		// Immediately try the next context profile if window creation failed.
@@ -839,7 +842,7 @@ void Window::setMouseGrab(bool grab)
 bool Window::isMouseGrabbed() const
 {
 	if (window)
-		return (bool) SDL_GetWindowGrab(window);
+		return SDL_GetWindowGrab(window) != SDL_FALSE;
 	else
 		return mouseGrabbed;
 }
@@ -936,17 +939,17 @@ int Window::showMessageBox(const MessageBoxData &data)
 
 	std::vector<SDL_MessageBoxButtonData> sdlbuttons;
 
-	for (size_t i = 0; i < data.buttons.size(); i++)
+	for (int i = 0; i < (int) data.buttons.size(); i++)
 	{
 		SDL_MessageBoxButtonData sdlbutton = {};
 
-		sdlbutton.buttonid = (int) i;
+		sdlbutton.buttonid = i;
 		sdlbutton.text = data.buttons[i].c_str();
 
-		if ((int) i == data.enterButtonIndex)
+		if (i == data.enterButtonIndex)
 			sdlbutton.flags |= SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT;
 
-		if ((int) i == data.escapeButtonIndex)
+		if (i == data.escapeButtonIndex)
 			sdlbutton.flags |= SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT;
 
 		sdlbuttons.push_back(sdlbutton);