From db3aea4b18792858ed9258bc2126a9b963aae247 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Sun, 28 Jun 2015 21:06:20 +0200 Subject: [PATCH] Remove finding from code analysis. --- code/3DSLoader.cpp | 6 +++--- code/B3DImporter.cpp | 6 ++++-- code/BaseImporter.cpp | 24 ++++++++++++++++-------- 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/code/3DSLoader.cpp b/code/3DSLoader.cpp index 914648ae8..18f927fe6 100644 --- a/code/3DSLoader.cpp +++ b/code/3DSLoader.cpp @@ -49,11 +49,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef ASSIMP_BUILD_NO_3DS_IMPORTER // internal headers -#include "3DSLoader.h" -#include "Macros.h" +#include "3DSLoader.h" +#include "Macros.h" #include "../include/assimp/IOSystem.hpp" #include "../include/assimp/scene.h" -#include "../include/assimp/DefaultLogger.hpp" +#include "../include/assimp/DefaultLogger.hpp" #include "StringComparison.h" using namespace Assimp; diff --git a/code/B3DImporter.cpp b/code/B3DImporter.cpp index a2f8b5593..148f9c5ad 100644 --- a/code/B3DImporter.cpp +++ b/code/B3DImporter.cpp @@ -239,8 +239,10 @@ unsigned B3DImporter::ChunkSize(){ template T *B3DImporter::to_array( const vector &v ){ - if( !v.size() ) return 0; - T *p=new T[v.size()]; + if( v.empty() ) { + return 0; + } + T *p=new T[ v.size() ]; for( size_t i=0;i& extensions) // read 200 characters from the file boost::scoped_array _buffer (new char[searchBytes+1 /* for the '\0' */]); char* buffer = _buffer.get(); + if( NULL == buffer ) { + return false; + } const size_t read = pStream->Read(buffer,1,searchBytes); - if (!read) - return false; + if( !read ) { + return false; + } - for (size_t i = 0; i < read; ++i) - buffer[i] = ::tolower(buffer[i]); + for( size_t i = 0; i < read; ++i ) { + buffer[ i ] = ::tolower( buffer[ i ] ); + } // It is not a proper handling of unicode files here ... // ehm ... but it works in most cases. char* cur = buffer,*cur2 = buffer,*end = &buffer[read]; while (cur != end) { - if (*cur) - *cur2++ = *cur; + if( *cur ) { + *cur2++ = *cur; + } ++cur; } *cur2 = '\0'; @@ -177,8 +183,9 @@ void BaseImporter::GetExtensionList(std::set& extensions) const char* r = strstr(buffer,tokens[i]); - if (!r) - continue; + if( !r ) { + continue; + } // We got a match, either we don't care where it is, or it happens to // be in the beginning of the file / line if (!tokensSol || r == buffer || r[-1] == '\r' || r[-1] == '\n') { @@ -187,6 +194,7 @@ void BaseImporter::GetExtensionList(std::set& extensions) } } } + return false; }