From b11932b92db3294b076c28380c5bf86cf8b87f4e Mon Sep 17 00:00:00 2001 From: SoftCoder Date: Sat, 14 Dec 2013 03:03:19 -0800 Subject: [PATCH] - cleanup from cppcheck report --- source/glest_game/world/map.cpp | 5 +- .../sources/graphics/gl2/shader_gl.cpp | 244 ------------------ .../sources/platform/sdl/thread.cpp | 1 - 3 files changed, 4 insertions(+), 246 deletions(-) delete mode 100644 source/shared_lib/sources/graphics/gl2/shader_gl.cpp diff --git a/source/glest_game/world/map.cpp b/source/glest_game/world/map.cpp index 4ab4c9c5..f88fda3c 100644 --- a/source/glest_game/world/map.cpp +++ b/source/glest_game/world/map.cpp @@ -500,9 +500,12 @@ Checksum Map::load(const string &path, TechTree *techTree, Tileset *tileset) { } } else { + if(f) fclose(f); + f = NULL; + throw megaglest_runtime_error("Can't open file"); } - fclose(f); + if(f) fclose(f); } catch(const exception &e){ SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what()); diff --git a/source/shared_lib/sources/graphics/gl2/shader_gl.cpp b/source/shared_lib/sources/graphics/gl2/shader_gl.cpp deleted file mode 100644 index 5d134b9a..00000000 --- a/source/shared_lib/sources/graphics/gl2/shader_gl.cpp +++ /dev/null @@ -1,244 +0,0 @@ -// ============================================================== -// This file is part of Glest Shared Library (www.glest.org) -// -// Copyright (C) 2001-2008 MartiƱo Figueroa -// -// You can redistribute this code and/or modify it under -// the terms of the GNU General Public License as published -// by the Free Software Foundation; either version 2 of the -// License, or (at your option) any later version -// ============================================================== - -#include "shader_gl.h" - -#include - -#include "opengl.h" -#include "leak_dumper.h" - -using namespace std; - -namespace Shared{ namespace Graphics{ namespace Gl{ - -// ===================================================== -// class ShaderProgramGl -// ===================================================== - -ShaderProgramGl::ShaderProgramGl(){ - inited= false; - vertexShader=0; - fragmentShader=0; - handle=0; -} - -void ShaderProgramGl::init(){ - if(!inited){ - assertGl(); - handle= glCreateProgramObjectARB(); - assertGl(); - inited= true; - } -} - -void ShaderProgramGl::end(){ - if(inited){ - assertGl(); - glDeleteObjectARB(handle); - assertGl(); - inited= false; - } -} - -void ShaderProgramGl::attach(VertexShader *vertexShader, FragmentShader *fragmentShader){ - this->vertexShader= vertexShader; - this->fragmentShader= fragmentShader; -} - -bool ShaderProgramGl::link(string &messages){ - assertGl(); - - VertexShaderGl *vertexShaderGl= static_cast(vertexShader); - FragmentShaderGl *fragmentShaderGl= static_cast(fragmentShader); - - const ShaderSource *vss= vertexShaderGl->getSource(); - const ShaderSource *fss= fragmentShaderGl->getSource(); - messages= "Linking program: " + vss->getPathInfo() + ", " + fss->getPathInfo() + "\n"; - - //attach - glAttachObjectARB(handle, vertexShaderGl->getHandle()); - glAttachObjectARB(handle, fragmentShaderGl->getHandle()); - - assertGl(); - - //bind attributes - for(int i=0; igetUniqueID().c_str() : "n/a")); delete thread; - thread = NULL; if(Thread::getEnableVerboseMode()) printf("!!!! cleanupPendingThread Line: %d thread = NULL [%s]\n",__LINE__,(base_thread != NULL ? base_thread->getUniqueID().c_str() : "n/a")); }