From a1d22a063b2a9de47cf3f23cac1cd73777eea321 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 16 Aug 2010 20:23:53 +0000 Subject: SWORD25: Fix warnings svn-id: r53254 --- engines/sword25/gfx/animation.cpp | 4 +--- engines/sword25/gfx/animationresource.cpp | 4 ++-- engines/sword25/gfx/graphicengine.h | 4 ++-- engines/sword25/gfx/graphicengine_script.cpp | 8 -------- engines/sword25/gfx/image/pngloader.cpp | 3 +++ engines/sword25/gfx/image/vectorimage.cpp | 14 +++++++------- engines/sword25/gfx/renderobject.cpp | 2 ++ engines/sword25/input/inputengine_script.cpp | 2 +- engines/sword25/kernel/kernel.cpp | 3 ++- engines/sword25/kernel/resmanager.cpp | 2 +- engines/sword25/math/polygon.cpp | 14 +++++++------- engines/sword25/package/packagemanager.h | 2 +- engines/sword25/package/scummvmpackagemanager.cpp | 2 +- engines/sword25/package/scummvmpackagemanager.h | 2 +- engines/sword25/script/luascript.cpp | 8 ++++---- engines/sword25/script/luascript.h | 2 +- 16 files changed, 36 insertions(+), 40 deletions(-) (limited to 'engines') diff --git a/engines/sword25/gfx/animation.cpp b/engines/sword25/gfx/animation.cpp index 333bc986d6..1790e24c03 100644 --- a/engines/sword25/gfx/animation.cpp +++ b/engines/sword25/gfx/animation.cpp @@ -247,8 +247,6 @@ void BS_Animation::FrameNotification(int TimeElapsed) { // Nur wenn die Animation läuft wird sie auch weiterbewegt if (m_Running) { - int OldFrame = m_CurrentFrame; - // Gesamte vergangene Zeit bestimmen (inkl. Restzeit des aktuellen Frames) m_CurrentFrameTime += TimeElapsed; @@ -317,7 +315,7 @@ void BS_Animation::FrameNotification(int TimeElapsed) { } } - if (m_CurrentFrame != TmpCurFrame) { + if ((int)m_CurrentFrame != TmpCurFrame) { ForceRefresh(); if (animationDescriptionPtr->GetFrame(m_CurrentFrame).Action != "") { diff --git a/engines/sword25/gfx/animationresource.cpp b/engines/sword25/gfx/animationresource.cpp index 614bbc3e65..f492daa93c 100644 --- a/engines/sword25/gfx/animationresource.cpp +++ b/engines/sword25/gfx/animationresource.cpp @@ -169,7 +169,7 @@ BS_AnimationResource::BS_AnimationResource(const Common::String &FileName) : bool BS_AnimationResource::ParseAnimationTag(TiXmlElement &AnimationTag, int &FPS, BS_Animation::ANIMATION_TYPES &AnimationType) { // FPS einlesen const char *FPSString; - if (FPSString = AnimationTag.Attribute("fps")) { + if ((FPSString = AnimationTag.Attribute("fps"))) { int TempFPS; if (!BS_String::ToInt(Common::String(FPSString), TempFPS) || TempFPS < MIN_FPS || TempFPS > MAX_FPS) { BS_LOG_WARNINGLN("Illegal fps value (\"%s\") in tag in \"%s\". Assuming default (\"%d\"). " @@ -181,7 +181,7 @@ bool BS_AnimationResource::ParseAnimationTag(TiXmlElement &AnimationTag, int &FP // Loop-Typ einlesen const char *LoopTypeString; - if (LoopTypeString = AnimationTag.Attribute("type")) { + if ((LoopTypeString = AnimationTag.Attribute("type"))) { if (strcmp(LoopTypeString, "oneshot") == 0) AnimationType = BS_Animation::AT_ONESHOT; else if (strcmp(LoopTypeString, "loop") == 0) diff --git a/engines/sword25/gfx/graphicengine.h b/engines/sword25/gfx/graphicengine.h index 225abcadf4..aaa3db64b4 100644 --- a/engines/sword25/gfx/graphicengine.h +++ b/engines/sword25/gfx/graphicengine.h @@ -323,9 +323,9 @@ public: case BS_GraphicEngine::CF_ARGB32: return 4; + default: + return -1; } - - return -1; } /** diff --git a/engines/sword25/gfx/graphicengine_script.cpp b/engines/sword25/gfx/graphicengine_script.cpp index d009916f32..af558e6578 100644 --- a/engines/sword25/gfx/graphicengine_script.cpp +++ b/engines/sword25/gfx/graphicengine_script.cpp @@ -754,14 +754,6 @@ static int RO_AddAnimation(lua_State *L) { // ----------------------------------------------------------------------------- -static int RO_Remove(lua_State *L) { - BS_RenderObjectPtr ROPtr = CheckRenderObject(L); - ROPtr.Erase(); - return 0; -} - -// ----------------------------------------------------------------------------- - static const luaL_reg RENDEROBJECT_METHODS[] = { {"AddAnimation", RO_AddAnimation}, {"AddText", RO_AddText}, diff --git a/engines/sword25/gfx/image/pngloader.cpp b/engines/sword25/gfx/image/pngloader.cpp index 605dca8635..8c323f9453 100644 --- a/engines/sword25/gfx/image/pngloader.cpp +++ b/engines/sword25/gfx/image/pngloader.cpp @@ -237,6 +237,9 @@ bool BS_PNGLoader::DoDecodeImage(const char *FileDataPtr, unsigned int FileSize, for (i = 0; i < Height; i++) memcpy(&UncompressedDataPtr[i * Pitch], &RawDataBuffer[i * png_get_rowbytes(png_ptr, info_ptr)], Pitch); break; + default: + error("Unhandled case in DoDecodeImage"); + break; } } diff --git a/engines/sword25/gfx/image/vectorimage.cpp b/engines/sword25/gfx/image/vectorimage.cpp index 549ef96d39..f55833eccb 100644 --- a/engines/sword25/gfx/image/vectorimage.cpp +++ b/engines/sword25/gfx/image/vectorimage.cpp @@ -267,8 +267,8 @@ BS_VectorImage::BS_VectorImage(const unsigned char *pFileData, unsigned int File BS_Rect MovieRect = FlashRectToBSRect(bs); // Framerate und Frameanzahl auslesen - u32 FrameRate = bs.GetU16(); - u32 FrameCount = bs.GetU16(); + /* u32 FrameRate = */bs.GetU16(); + /* u32 FrameCount = */bs.GetU16(); // Tags parsen // Da wir uns nur für das erste DefineShape-Tag interessieren @@ -310,7 +310,7 @@ BS_VectorImage::BS_VectorImage(const unsigned char *pFileData, unsigned int File // ----------------------------------------------------------------------------- bool BS_VectorImage::ParseDefineShape(unsigned int ShapeType, SWFBitStream &bs) { - u32 ShapeID = bs.GetU16(); + /*u32 ShapeID = */bs.GetU16(); // Bounding Box auslesen m_BoundingBox = FlashRectToBSRect(bs); @@ -411,10 +411,10 @@ bool BS_VectorImage::ParseDefineShape(unsigned int ShapeType, SWFBitStream &bs) // Curved edge if (EdgeFlag == 0) { - s32 ControlDeltaX = bs.GetSignedBits(NumBits); - s32 ControlDeltaY = bs.GetSignedBits(NumBits); - s32 AnchorDeltaX = bs.GetSignedBits(NumBits); - s32 AnchorDeltaY = bs.GetSignedBits(NumBits); + /* s32 ControlDeltaX = */bs.GetSignedBits(NumBits); + /* s32 ControlDeltaY = */bs.GetSignedBits(NumBits); + /* s32 AnchorDeltaX = */bs.GetSignedBits(NumBits); + /* s32 AnchorDeltaY = */bs.GetSignedBits(NumBits); #if 0 // TODO double ControlX = m_Elements.back().m_Paths.last_x() + ControlDeltaX; diff --git a/engines/sword25/gfx/renderobject.cpp b/engines/sword25/gfx/renderobject.cpp index 4909569ca0..913aa9ef82 100644 --- a/engines/sword25/gfx/renderobject.cpp +++ b/engines/sword25/gfx/renderobject.cpp @@ -71,6 +71,8 @@ BS_RenderObject::BS_RenderObject(BS_RenderObjectPtr ParentPtr, m_InitSuccess(false), m_RefreshForced(true), m_Handle(0) { + m_OldBBox = BS_Rect(0, 0); + // Renderobject registrieren, abhängig vom Handle-Parameter entweder mit beliebigem oder vorgegebenen Handle. if (Handle == 0) m_Handle = BS_RenderObjectRegistry::GetInstance().RegisterObject(this); diff --git a/engines/sword25/input/inputengine_script.cpp b/engines/sword25/input/inputengine_script.cpp index 6b91c4b73e..d373cdac19 100644 --- a/engines/sword25/input/inputengine_script.cpp +++ b/engines/sword25/input/inputengine_script.cpp @@ -328,7 +328,7 @@ static const lua_constant_reg PACKAGE_CONSTANTS[] = { X(ADD), X(SEPARATOR), X(SUBTRACT), X(DECIMAL), X(DIVIDE), X(F1), X(F2), X(F3), X(F4), X(F5), X(F6), X(F7), X(F8), X(F9), X(F10), X(F11), X(F12), X(NUMLOCK), X(SCROLL), X(LSHIFT), X(RSHIFT), X(LCONTROL), X(RCONTROL), Y(ENTER), Y(LEFT), Y(RIGHT), Y(HOME), Y(END), Y(BACKSPACE), Y(TAB), Y(INSERT), Y(DELETE), - 0, 0, + {0, 0} }; #undef X #undef Y diff --git a/engines/sword25/kernel/kernel.cpp b/engines/sword25/kernel/kernel.cpp index 6150024e20..eb57a23232 100644 --- a/engines/sword25/kernel/kernel.cpp +++ b/engines/sword25/kernel/kernel.cpp @@ -157,11 +157,12 @@ Common::String BS_Kernel::Superclass::GetServiceIdentifier(unsigned int Number) unsigned int CurServiceOrd = 0; for (unsigned int i = 0; i < BS_SERVICE_COUNT; i++) { - if (BS_SERVICE_TABLE[i].SuperclassIdentifier == _Identifier) + if (BS_SERVICE_TABLE[i].SuperclassIdentifier == _Identifier) { if (Number == CurServiceOrd) return BS_SERVICE_TABLE[i].ServiceIdentifier; else CurServiceOrd++; + } } return Common::String(""); diff --git a/engines/sword25/kernel/resmanager.cpp b/engines/sword25/kernel/resmanager.cpp index 1e232ca63b..dd7a38b753 100644 --- a/engines/sword25/kernel/resmanager.cpp +++ b/engines/sword25/kernel/resmanager.cpp @@ -162,7 +162,7 @@ BS_Resource *BS_ResourceManager::RequestResource(const Common::String &FileName) if (m_LogCacheMiss) BS_LOG_WARNINGLN("\"%s\" was not precached.", UniqueFileName.c_str()); BS_Resource *pResource; - if (pResource = LoadResource(UniqueFileName)) { + if ((pResource = LoadResource(UniqueFileName))) { pResource->AddReference(); return pResource; } diff --git a/engines/sword25/math/polygon.cpp b/engines/sword25/math/polygon.cpp index a972596d29..57a6a37cf4 100644 --- a/engines/sword25/math/polygon.cpp +++ b/engines/sword25/math/polygon.cpp @@ -50,8 +50,8 @@ namespace Sword25 { BS_Polygon::BS_Polygon() : VertexCount(0), Vertecies(NULL) { } -BS_Polygon::BS_Polygon(int VertexCount, const BS_Vertex *Vertecies) : VertexCount(0), Vertecies(NULL) { - Init(VertexCount, Vertecies); +BS_Polygon::BS_Polygon(int VertexCount_, const BS_Vertex *Vertecies_) : VertexCount(0), Vertecies(NULL) { + Init(VertexCount_, Vertecies_); } BS_Polygon::BS_Polygon(const BS_Polygon &Other) : VertexCount(0), Vertecies(NULL) { @@ -69,20 +69,20 @@ BS_Polygon::~BS_Polygon() { // Initialisation // --------------- -bool BS_Polygon::Init(int VertexCount, const BS_Vertex *Vertecies) { +bool BS_Polygon::Init(int VertexCount_, const BS_Vertex *Vertecies_) { // Rember the old obstate to restore it if an error occurs whilst initialising it with the new data int OldVertexCount = this->VertexCount; BS_Vertex *OldVertecies = this->Vertecies; - this->VertexCount = VertexCount; - this->Vertecies = new BS_Vertex[VertexCount + 1]; - memcpy(this->Vertecies, Vertecies, sizeof(BS_Vertex) * VertexCount); + this->VertexCount = VertexCount_; + this->Vertecies = new BS_Vertex[VertexCount_ + 1]; + memcpy(this->Vertecies, Vertecies_, sizeof(BS_Vertex) * VertexCount_); // TODO: // Duplicate and remove redundant vertecies (Superflous = 3 co-linear verts) // _WeedRepeatedVertecies(); // The first vertex is repeated at the end of the vertex array; this simplifies // some algorithms, running through the edges and thus can save the overflow control. - this->Vertecies[VertexCount] = this->Vertecies[0]; + this->Vertecies[VertexCount_] = this->Vertecies[0]; // If the polygon is self-intersecting, the object state is restore, and an error signalled if (CheckForSelfIntersection()) { diff --git a/engines/sword25/package/packagemanager.h b/engines/sword25/package/packagemanager.h index 73601b1f68..9ef3ab066a 100644 --- a/engines/sword25/package/packagemanager.h +++ b/engines/sword25/package/packagemanager.h @@ -100,7 +100,7 @@ public: * @return Specifies a pointer to the loaded data of the file * @remark The client must not forget to release the data of the file using BE_DELETE_A. */ - virtual void *GetFile(const Common::String &FileName, unsigned int *pFileSize = NULL) = 0; + virtual byte *GetFile(const Common::String &FileName, unsigned int *pFileSize = NULL) = 0; /** * Returns the path to the current directory. * @return Returns a string containing the path to the current directory. diff --git a/engines/sword25/package/scummvmpackagemanager.cpp b/engines/sword25/package/scummvmpackagemanager.cpp index f3cbc93b61..0792116a4b 100644 --- a/engines/sword25/package/scummvmpackagemanager.cpp +++ b/engines/sword25/package/scummvmpackagemanager.cpp @@ -130,7 +130,7 @@ bool BS_ScummVMPackageManager::LoadDirectoryAsPackage(const Common::String &dire } } -void *BS_ScummVMPackageManager::GetFile(const Common::String &fileName, unsigned int *fileSizePtr) { +byte *BS_ScummVMPackageManager::GetFile(const Common::String &fileName, unsigned int *fileSizePtr) { Common::SeekableReadStream *in; Common::ArchiveMemberPtr fileNode = GetArchiveMember(normalizePath(fileName, _currentDirectory)); if (!fileNode) diff --git a/engines/sword25/package/scummvmpackagemanager.h b/engines/sword25/package/scummvmpackagemanager.h index e15cedade4..8ad454d0eb 100644 --- a/engines/sword25/package/scummvmpackagemanager.h +++ b/engines/sword25/package/scummvmpackagemanager.h @@ -72,7 +72,7 @@ public: virtual bool LoadPackage(const Common::String &fileName, const Common::String &mountPosition); virtual bool LoadDirectoryAsPackage(const Common::String &directoryName, const Common::String &mountPosition); - virtual void *GetFile(const Common::String &fileName, unsigned int *fileSizePtr = 0); + virtual byte *GetFile(const Common::String &fileName, unsigned int *fileSizePtr = 0); virtual Common::String GetCurrentDirectory(); virtual bool ChangeDirectory(const Common::String &directory); virtual Common::String GetAbsolutePath(const Common::String &fileName); diff --git a/engines/sword25/script/luascript.cpp b/engines/sword25/script/luascript.cpp index 38363df94b..6d2816ae13 100644 --- a/engines/sword25/script/luascript.cpp +++ b/engines/sword25/script/luascript.cpp @@ -158,7 +158,7 @@ bool BS_LuaScriptEngine::ExecuteFile(const Common::String &FileName) { // File read unsigned int FileSize; - char *FileData = static_cast(pPackage->GetFile(FileName, &FileSize)); + byte *FileData = pPackage->GetFile(FileName, &FileSize); if (!FileData) { BS_LOG_ERRORLN("Couldn't read \"%s\".", FileName.c_str()); #ifdef DEBUG @@ -190,7 +190,7 @@ bool BS_LuaScriptEngine::ExecuteFile(const Common::String &FileName) { // ----------------------------------------------------------------------------- bool BS_LuaScriptEngine::ExecuteString(const Common::String &Code) { - return ExecuteBuffer(Code.c_str(), Code.size(), "???"); + return ExecuteBuffer((byte *)Code.c_str(), Code.size(), "???"); } // ----------------------------------------------------------------------------- @@ -220,9 +220,9 @@ bool BS_LuaScriptEngine::RegisterStandardLibs() { // ----------------------------------------------------------------------------- -bool BS_LuaScriptEngine::ExecuteBuffer(const char *Data, unsigned int Size, const Common::String &Name) const { +bool BS_LuaScriptEngine::ExecuteBuffer(const byte *Data, unsigned int Size, const Common::String &Name) const { // Compile buffer - if (luaL_loadbuffer(m_State, Data, Size, Name.c_str()) != 0) { + if (luaL_loadbuffer(m_State, (const char *)Data, Size, Name.c_str()) != 0) { BS_LOG_ERRORLN("Couldn't compile \"%s\":\n%s", Name.c_str(), lua_tostring(m_State, -1)); lua_pop(m_State, 1); diff --git a/engines/sword25/script/luascript.h b/engines/sword25/script/luascript.h index 228625a67b..39fa9ebec4 100644 --- a/engines/sword25/script/luascript.h +++ b/engines/sword25/script/luascript.h @@ -124,7 +124,7 @@ private: bool RegisterStandardLibs(); bool RegisterStandardLibExtensions(); - bool ExecuteBuffer(const char *Data, unsigned int Size, const Common::String &Name) const; + bool ExecuteBuffer(const byte *Data, unsigned int Size, const Common::String &Name) const; }; } // End of namespace Sword25 -- cgit v1.2.3