From 73aba4bdd4c6152ab87ac9f95f6bbe0870abde7d Mon Sep 17 00:00:00 2001 From: Bill Meltsner Date: Tue, 9 Feb 2010 13:21:25 -0500 Subject: [PATCH] eliminated a whole bunch of gcc warnings --- .../macosx/love.xcodeproj/project.pbxproj | 8 +- src/common/StringMap.h | 66 ++++---- src/modules/audio/openal/Source.cpp | 144 +++++++++--------- src/modules/event/sdl/Event.cpp | 62 ++++---- src/modules/event/sdl/wrap_Event.cpp | 138 +++++++++-------- src/modules/filesystem/physfs/File.cpp | 2 + src/modules/graphics/opengl/Glyph.cpp | 2 +- src/modules/graphics/opengl/ImageFont.cpp | 38 ++--- src/modules/image/EncodedImageData.cpp | 2 +- src/modules/image/devil/ImageData.cpp | 8 +- src/modules/physics/box2d/Shape.cpp | 2 +- 11 files changed, 242 insertions(+), 230 deletions(-) diff --git a/platform/macosx/love.xcodeproj/project.pbxproj b/platform/macosx/love.xcodeproj/project.pbxproj index a54810ecb..df3288a3c 100644 --- a/platform/macosx/love.xcodeproj/project.pbxproj +++ b/platform/macosx/love.xcodeproj/project.pbxproj @@ -560,9 +560,9 @@ A93E6B9210420ACC007D418B /* wrap_Timer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_Timer.h; sourceTree = ""; }; A93E6B9410420ACC007D418B /* resources.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = resources.cpp; sourceTree = ""; }; A93E6B9510420ACC007D418B /* resources.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = resources.h; sourceTree = ""; }; - A93E6B9710420ACC007D418B /* boot.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = boot.lua; sourceTree = ""; }; + A93E6B9710420ACC007D418B /* boot.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lua; path = boot.lua; sourceTree = ""; }; A93E6B9810420ACC007D418B /* boot.lua.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = boot.lua.h; sourceTree = ""; }; - A93E6B9910420ACC007D418B /* graphics.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = graphics.lua; sourceTree = ""; }; + A93E6B9910420ACC007D418B /* graphics.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lua; path = graphics.lua; sourceTree = ""; }; A93E6B9A10420ACC007D418B /* graphics.lua.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = graphics.lua.h; sourceTree = ""; }; A93E6E4610420B4A007D418B /* OpenAL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenAL.framework; path = System/Library/Frameworks/OpenAL.framework; sourceTree = SDKROOT; }; A93E6E4710420B4A007D418B /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = ""; }; @@ -592,6 +592,8 @@ A9DEC1C01046EFA70049C70C /* LoveDocument.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = LoveDocument.icns; path = icons/LoveDocument.icns; sourceTree = ""; }; A9F16926109E7BAD00FC83D1 /* libmodplug.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = libmodplug.framework; path = /Library/Frameworks/libmodplug.framework; sourceTree = ""; }; A9F169A6109E824900FC83D1 /* mpg123.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = mpg123.framework; path = /Library/Frameworks/mpg123.framework; sourceTree = ""; }; + A9F8833511163C8C00831E98 /* audio.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lua; path = audio.lua; sourceTree = ""; }; + A9F8833611163C8C00831E98 /* audio.lua.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = audio.lua.h; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -1368,6 +1370,8 @@ A93E6B9610420ACC007D418B /* scripts */ = { isa = PBXGroup; children = ( + A9F8833511163C8C00831E98 /* audio.lua */, + A9F8833611163C8C00831E98 /* audio.lua.h */, A93E6B9710420ACC007D418B /* boot.lua */, A93E6B9810420ACC007D418B /* boot.lua.h */, A93E6B9910420ACC007D418B /* graphics.lua */, diff --git a/src/common/StringMap.h b/src/common/StringMap.h index a922b0323..d83f7f6be 100644 --- a/src/common/StringMap.h +++ b/src/common/StringMap.h @@ -1,21 +1,21 @@ -/** -* Copyright (c) 2006-2010 LOVE Development Team -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. +/** +* Copyright (c) 2006-2010 LOVE Development Team +* +* This software is provided 'as-is', without any express or implied +* warranty. In no event will the authors be held liable for any damages +* arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute it +* freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; you must not +* claim that you wrote the original software. If you use this software +* in a product, an acknowledgment in the product documentation would be +* appreciated but is not required. +* 2. Altered source versions must be plainly marked as such, and must not be +* misrepresented as being the original software. +* 3. This notice may not be removed or altered from any source distribution. **/ #ifndef LOVE_STRING_MAP_H @@ -65,8 +65,8 @@ namespace love } } - bool streq(const char * a, const char * b) - { + bool streq(const char * a, const char * b) + { while(*a != 0 && *b != 0) { if(*a != *b) @@ -75,16 +75,16 @@ namespace love ++b; } - return (*a == 0 && *b == 0); + return (*a == 0 && *b == 0); } bool find(const char * key, T & t) { - unsigned str_hash = djb2(key); + //unsigned str_hash = djb2(key); for(unsigned i = 0; i < MAX; ++i) { - unsigned str_i = (str_hash + i) % MAX; + //unsigned str_i = (str_hash + i) % MAX; //this isn't used, is this intentional? if(records[i].set && streq(records[i].key, key)) { @@ -145,16 +145,16 @@ namespace love return inserted; } - - unsigned djb2(const char * key) - { - unsigned hash = 5381; - int c; - - while (c = *key++) - hash = ((hash << 5) + hash) + c; - - return hash; + + unsigned djb2(const char * key) + { + unsigned hash = 5381; + int c; + + while ((c = *key++)) + hash = ((hash << 5) + hash) + c; + + return hash; } }; // StringMap diff --git a/src/modules/audio/openal/Source.cpp b/src/modules/audio/openal/Source.cpp index d2c937aec..8c82b4984 100644 --- a/src/modules/audio/openal/Source.cpp +++ b/src/modules/audio/openal/Source.cpp @@ -1,21 +1,21 @@ -/** -* Copyright (c) 2006-2010 LOVE Development Team -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. +/** +* Copyright (c) 2006-2010 LOVE Development Team +* +* This software is provided 'as-is', without any express or implied +* warranty. In no event will the authors be held liable for any damages +* arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute it +* freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; you must not +* claim that you wrote the original software. If you use this software +* in a product, an acknowledgment in the product documentation would be +* appreciated but is not required. +* 2. Altered source versions must be plainly marked as such, and must not be +* misrepresented as being the original software. +* 3. This notice may not be removed or altered from any source distribution. **/ #include "Source.h" @@ -33,8 +33,8 @@ namespace openal { Source::Source(Pool * pool, love::sound::SoundData * soundData) - : love::audio::Source(Source::TYPE_STATIC), pool(pool), pitch(1.0f), - volume(1.0f), looping(false), decoder(0), valid(false) + : love::audio::Source(Source::TYPE_STATIC), pool(pool), valid(false), + pitch(1.0f), volume(1.0f), looping(false), decoder(0) { alGenBuffers(1, buffers); ALenum fmt = getFormat(soundData->getChannels(), soundData->getBits()); @@ -48,8 +48,8 @@ namespace openal } Source::Source(Pool * pool, love::sound::Decoder * decoder) - : love::audio::Source(Source::TYPE_STREAM), pool(pool), pitch(1.0f), - volume(1.0f), looping(false), decoder(decoder), valid(false) + : love::audio::Source(Source::TYPE_STREAM), pool(pool), valid(false), + pitch(1.0f), volume(1.0f), looping(false), decoder(decoder) { decoder->retain(); alGenBuffers(MAX_BUFFERS, buffers); @@ -65,13 +65,13 @@ namespace openal { stop(); alDeleteBuffers((type == TYPE_STATIC) ? 1 : MAX_BUFFERS, buffers); - } - - love::audio::Source * Source::copy() - { - return 0; - } - + } + + love::audio::Source * Source::copy() + { + return 0; + } + void Source::play() { valid = pool->play(this, source); @@ -84,7 +84,7 @@ namespace openal { pool->stop(this); } - + void Source::pause() { pool->pause(); @@ -99,13 +99,13 @@ namespace openal { pool->rewind(); } - + bool Source::isStopped() const { if(valid) { - ALenum state; - alGetSourcei(source, AL_SOURCE_STATE, &state); + ALenum state; + alGetSourcei(source, AL_SOURCE_STATE, &state); return (state == AL_STOPPED); } @@ -143,7 +143,7 @@ namespace openal } } } - + void Source::setPitch(float pitch) { if(valid) @@ -151,7 +151,7 @@ namespace openal this->pitch = pitch; } - + float Source::getPitch() const { if(valid) @@ -164,7 +164,7 @@ namespace openal // In case the Source isn't playing. return pitch; } - + void Source::setVolume(float volume) { if(valid) @@ -174,7 +174,7 @@ namespace openal this->volume = volume; } - + float Source::getVolume() const { if(valid) @@ -194,40 +194,40 @@ namespace openal alSourcefv(source, AL_POSITION, v); setFloatv(position, v); - } - + } + void Source::getPosition(float * v) const { if(valid) alGetSourcefv(source, AL_POSITION, v); else setFloatv(v, position); - } - + } + void Source::setVelocity(float * v) { if(valid) alSourcefv(source, AL_VELOCITY, v); setFloatv(velocity, v); - } - + } + void Source::getVelocity(float * v) const { if(valid) alGetSourcefv(source, AL_VELOCITY, v); else setFloatv(v, velocity); - } - + } + void Source::setDirection(float * v) { if(valid) alSourcefv(source, AL_DIRECTION, v); else setFloatv(direction, v); - } - + } + void Source::getDirection(float * v) const { if(valid) @@ -236,17 +236,17 @@ namespace openal setFloatv(v, direction); } - void Source::setLooping(bool looping) - { - if(valid && type == TYPE_STATIC) - alSourcei(source, AL_LOOPING, looping ? AL_TRUE : AL_FALSE); - - this->looping = looping; - } - - bool Source::isLooping() const - { - return looping; + void Source::setLooping(bool looping) + { + if(valid && type == TYPE_STATIC) + alSourcei(source, AL_LOOPING, looping ? AL_TRUE : AL_FALSE); + + this->looping = looping; + } + + bool Source::isLooping() const + { + return looping; } void Source::playAtomic() @@ -259,15 +259,15 @@ namespace openal { int usedBuffers = 0; - for(int i = 0; i < MAX_BUFFERS; i++) - { - int decoded = streamAtomic(buffers[i], decoder); - ++usedBuffers; - if(decoded < decoder->getSize()) - break; - } - - if(usedBuffers > 0) + for(unsigned int i = 0; i < MAX_BUFFERS; i++) + { + int decoded = streamAtomic(buffers[i], decoder); + ++usedBuffers; + if(decoded < decoder->getSize()) + break; + } + + if(usedBuffers > 0) alSourceQueueBuffers(source, usedBuffers, buffers); } @@ -294,10 +294,10 @@ namespace openal int queued = 0; alGetSourcei(source, AL_BUFFERS_QUEUED, &queued); - while(queued--) - { - ALuint buffer; - alSourceUnqueueBuffers(source, 1, &buffer); + while(queued--) + { + ALuint buffer; + alSourceUnqueueBuffers(source, 1, &buffer); } } @@ -306,7 +306,7 @@ namespace openal rewindAtomic(); valid = false; } - + void Source::pauseAtomic() { if(valid) diff --git a/src/modules/event/sdl/Event.cpp b/src/modules/event/sdl/Event.cpp index a545a1544..206b306a7 100644 --- a/src/modules/event/sdl/Event.cpp +++ b/src/modules/event/sdl/Event.cpp @@ -1,21 +1,21 @@ -/** -* Copyright (c) 2006-2010 LOVE Development Team -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. +/** +* Copyright (c) 2006-2010 LOVE Development Team +* +* This software is provided 'as-is', without any express or implied +* warranty. In no event will the authors be held liable for any damages +* arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute it +* freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; you must not +* claim that you wrote the original software. If you use this software +* in a product, an acknowledgment in the product documentation would be +* appreciated but is not required. +* 2. Altered source versions must be plainly marked as such, and must not be +* misrepresented as being the original software. +* 3. This notice may not be removed or altered from any source distribution. **/ #include "Event.h" @@ -33,12 +33,12 @@ namespace sdl { return "love.event.sdl"; } - - Event::Event() - { - SDL_EnableUNICODE(1); - } - + + Event::Event() + { + SDL_EnableUNICODE(1); + } + void Event::pump() { SDL_PumpEvents(); @@ -66,12 +66,12 @@ namespace sdl return ok && convert(e, message); } - bool Event::push(Message & message) - { - static SDL_Event e; - bool ok = convert(message, e); - return ok && (SDL_PushEvent(&e) == 0); - } + bool Event::push(Message & message) + { + static SDL_Event e; + bool ok = convert(message, e); + return ok && (SDL_PushEvent(&e) == 0); + } bool Event::convert(SDL_Event & e, Message & m) { @@ -130,6 +130,8 @@ namespace sdl case Event::TYPE_QUIT: e.type = SDL_QUIT; return true; + default: + return true; } return true; diff --git a/src/modules/event/sdl/wrap_Event.cpp b/src/modules/event/sdl/wrap_Event.cpp index dacbe0aae..0b6a95ff0 100644 --- a/src/modules/event/sdl/wrap_Event.cpp +++ b/src/modules/event/sdl/wrap_Event.cpp @@ -41,31 +41,33 @@ namespace sdl if(!Event::getConstant(str, msg.type)) return false; - switch(msg.type) - { - case Event::TYPE_KEY_PRESSED: - if(!Event::getConstant(luaL_checkstring(L, 2), msg.keyboard.k)) - return false; - msg.keyboard.u = (unsigned short)luaL_optint(L, 3, 0); - return true; - case Event::TYPE_KEY_RELEASED: - if(!Event::getConstant(luaL_checkstring(L, 2), msg.keyboard.k)) - return false; - return true; - case Event::TYPE_MOUSE_PRESSED: - case Event::TYPE_MOUSE_RELEASED: - if(!Event::getConstant(luaL_checkstring(L, 2), msg.mouse.b)) - return false; - msg.mouse.x = luaL_checkint(L, 3); - msg.mouse.y = luaL_checkint(L, 4); - return true; - case Event::TYPE_JOYSTICK_PRESSED: - case Event::TYPE_JOYSTICK_RELEASED: - msg.joystick.index = luaL_checkint(L, 2); - msg.joystick.button = luaL_checkint(L, 3); - return true; - case Event::TYPE_QUIT: - return true; + switch(msg.type) + { + case Event::TYPE_KEY_PRESSED: + if(!Event::getConstant(luaL_checkstring(L, 2), msg.keyboard.k)) + return false; + msg.keyboard.u = (unsigned short)luaL_optint(L, 3, 0); + return true; + case Event::TYPE_KEY_RELEASED: + if(!Event::getConstant(luaL_checkstring(L, 2), msg.keyboard.k)) + return false; + return true; + case Event::TYPE_MOUSE_PRESSED: + case Event::TYPE_MOUSE_RELEASED: + if(!Event::getConstant(luaL_checkstring(L, 2), msg.mouse.b)) + return false; + msg.mouse.x = luaL_checkint(L, 3); + msg.mouse.y = luaL_checkint(L, 4); + return true; + case Event::TYPE_JOYSTICK_PRESSED: + case Event::TYPE_JOYSTICK_RELEASED: + msg.joystick.index = luaL_checkint(L, 2); + msg.joystick.button = luaL_checkint(L, 3); + return true; + case Event::TYPE_QUIT: + return true; + default: + return false; } return false; @@ -80,52 +82,54 @@ namespace sdl lua_pushstring(L, str); - switch(msg.type) - { - case Event::TYPE_KEY_PRESSED: - if(!Event::getConstant(msg.keyboard.k, str)) - return 0; - lua_pushstring(L, str); - lua_pushinteger(L, msg.keyboard.u); - return 3; - case Event::TYPE_KEY_RELEASED: - if(!Event::getConstant(msg.keyboard.k, str)) - return 0; - lua_pushstring(L, str); - return 2; - case Event::TYPE_MOUSE_PRESSED: - case Event::TYPE_MOUSE_RELEASED: - if(!Event::getConstant(msg.mouse.b, str)) - return 0; - lua_pushinteger(L, msg.mouse.x); - lua_pushinteger(L, msg.mouse.y); - lua_pushstring(L, str); - return 4; - case Event::TYPE_JOYSTICK_PRESSED: - case Event::TYPE_JOYSTICK_RELEASED: - lua_pushinteger(L, msg.joystick.index); - lua_pushinteger(L, msg.joystick.button); - return 3; - case Event::TYPE_QUIT: - return 1; + switch(msg.type) + { + case Event::TYPE_KEY_PRESSED: + if(!Event::getConstant(msg.keyboard.k, str)) + return 0; + lua_pushstring(L, str); + lua_pushinteger(L, msg.keyboard.u); + return 3; + case Event::TYPE_KEY_RELEASED: + if(!Event::getConstant(msg.keyboard.k, str)) + return 0; + lua_pushstring(L, str); + return 2; + case Event::TYPE_MOUSE_PRESSED: + case Event::TYPE_MOUSE_RELEASED: + if(!Event::getConstant(msg.mouse.b, str)) + return 0; + lua_pushinteger(L, msg.mouse.x); + lua_pushinteger(L, msg.mouse.y); + lua_pushstring(L, str); + return 4; + case Event::TYPE_JOYSTICK_PRESSED: + case Event::TYPE_JOYSTICK_RELEASED: + lua_pushinteger(L, msg.joystick.index); + lua_pushinteger(L, msg.joystick.button); + return 3; + case Event::TYPE_QUIT: + return 1; + default: + return 0; } return 0; } - static int poll_i(lua_State * L) - { - static Event::Message m; - - while(instance->poll(m)) - { + static int poll_i(lua_State * L) + { + static Event::Message m; + + while(instance->poll(m)) + { int args = push_message(L, m); if(args > 0) return args; } // No pending events. - return 0; + return 0; } int w_pump(lua_State * L) @@ -190,13 +194,13 @@ namespace sdl } } - WrappedModule w; - w.module = instance; - w.name = "event"; - w.flags = MODULE_T; - w.functions = functions; - w.types = 0; - + WrappedModule w; + w.module = instance; + w.name = "event"; + w.flags = MODULE_T; + w.functions = functions; + w.types = 0; + return luax_register_module(L, w); } diff --git a/src/modules/filesystem/physfs/File.cpp b/src/modules/filesystem/physfs/File.cpp index 1c06fa161..b436bc193 100644 --- a/src/modules/filesystem/physfs/File.cpp +++ b/src/modules/filesystem/physfs/File.cpp @@ -74,6 +74,8 @@ namespace physfs case WRITE: file = PHYSFS_openWrite(filename.c_str()); break; + default: + break; } return (file != 0); diff --git a/src/modules/graphics/opengl/Glyph.cpp b/src/modules/graphics/opengl/Glyph.cpp index a071ef30f..390b471bb 100644 --- a/src/modules/graphics/opengl/Glyph.cpp +++ b/src/modules/graphics/opengl/Glyph.cpp @@ -31,7 +31,7 @@ namespace opengl { Glyph::Glyph(love::font::GlyphData * data) - : data(data), texture(0), width((float)data->getWidth()), height((float)data->getHeight()) + : data(data), width((float)data->getWidth()), height((float)data->getHeight()), texture(0) { data->retain(); data->getWidth(); diff --git a/src/modules/graphics/opengl/ImageFont.cpp b/src/modules/graphics/opengl/ImageFont.cpp index 21409a6bb..c74ec8015 100644 --- a/src/modules/graphics/opengl/ImageFont.cpp +++ b/src/modules/graphics/opengl/ImageFont.cpp @@ -1,21 +1,21 @@ -/** -* Copyright (c) 2006-2010 LOVE Development Team -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would be -* appreciated but is not required. -* 2. Altered source versions must be plainly marked as such, and must not be -* misrepresented as being the original software. -* 3. This notice may not be removed or altered from any source distribution. +/** +* Copyright (c) 2006-2010 LOVE Development Team +* +* This software is provided 'as-is', without any express or implied +* warranty. In no event will the authors be held liable for any damages +* arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute it +* freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; you must not +* claim that you wrote the original software. If you use this software +* in a product, an acknowledgment in the product documentation would be +* appreciated but is not required. +* 2. Altered source versions must be plainly marked as such, and must not be +* misrepresented as being the original software. +* 3. This notice may not be removed or altered from any source distribution. **/ #include "ImageFont.h" @@ -31,7 +31,7 @@ namespace graphics namespace opengl { ImageFont::ImageFont(Image * image, std::string glyphs) - : Font(0), glyphs(glyphs), image(image) + : Font(0), image(image), glyphs(glyphs) { image->retain(); diff --git a/src/modules/image/EncodedImageData.cpp b/src/modules/image/EncodedImageData.cpp index ba215c023..386caf9cb 100644 --- a/src/modules/image/EncodedImageData.cpp +++ b/src/modules/image/EncodedImageData.cpp @@ -25,7 +25,7 @@ namespace love namespace image { EncodedImageData::EncodedImageData(void * d, Format f, int s) - : data(d), format(f), size(s) + : data(d), size(s), format(f) { } diff --git a/src/modules/image/devil/ImageData.cpp b/src/modules/image/devil/ImageData.cpp index e1711957f..6b66db54a 100644 --- a/src/modules/image/devil/ImageData.cpp +++ b/src/modules/image/devil/ImageData.cpp @@ -154,16 +154,16 @@ namespace devil void ImageData::setPixel(int x, int y, pixel c) { - int tx = x > width-1 ? width-1 : x; - int ty = y > height-1 ? height-1 : y; + //int tx = x > width-1 ? width-1 : x; + //int ty = y > height-1 ? height-1 : y; // not using these seems to not break anything pixel * pixels = (pixel *)getData(); pixels[y*width+x] = c; } pixel ImageData::getPixel(int x, int y) const { - int tx = x > width-1 ? width-1 : x; - int ty = y > height-1 ? height-1 : y; + //int tx = x > width-1 ? width-1 : x; + //int ty = y > height-1 ? height-1 : y; // not using these seems to not break anything pixel * pixels = (pixel *)getData(); return pixels[y*width+x]; } diff --git a/src/modules/physics/box2d/Shape.cpp b/src/modules/physics/box2d/Shape.cpp index 625c8f2db..8ae4a174f 100644 --- a/src/modules/physics/box2d/Shape.cpp +++ b/src/modules/physics/box2d/Shape.cpp @@ -218,7 +218,7 @@ namespace box2d for(int i = 1;i<=argc;i++) { size_t bpos = (size_t)(lua_tointeger(L, i)-1); - if(bpos < 0 || bpos > 16) + if(bpos > 16) return luaL_error(L, "Values must be in range 1-16."); b.set(bpos, true); }