diff --git a/code/DefaultLogger.cpp b/code/DefaultLogger.cpp index 85e2b6702..39cc86285 100644 --- a/code/DefaultLogger.cpp +++ b/code/DefaultLogger.cpp @@ -80,8 +80,9 @@ struct LogStreamInfo // Creates the only singleton instance Logger *DefaultLogger::create(const std::string &name, LogSeverity severity) { - if ( NULL == m_pLogger ) - m_pLogger = new DefaultLogger( name, severity ); + if (m_pLogger && !isNullLogger() ) + delete m_pLogger; + m_pLogger = new DefaultLogger( name, severity ); return m_pLogger; } @@ -111,7 +112,7 @@ Logger *DefaultLogger::get() // Kills the only instance void DefaultLogger::kill() { - ai_assert (NULL != m_pLogger); + if (m_pLogger != &s_pNullLogger)return; delete m_pLogger; m_pLogger = &s_pNullLogger; } @@ -123,7 +124,7 @@ void DefaultLogger::debug( const std::string &message ) if ( m_Severity == Logger::NORMAL ) return; - const std::string msg( "Debug, thread " + getThreadID() + " :" + message ); + const std::string msg( "Debug, T" + getThreadID() + ": " + message ); writeToStreams( msg, Logger::DEBUGGING ); } @@ -131,7 +132,7 @@ void DefaultLogger::debug( const std::string &message ) // Logs an info void DefaultLogger::info( const std::string &message ) { - const std::string msg( "Info: " + getThreadID() + " :" + message ); + const std::string msg( "Info, T" + getThreadID() + ": " + message ); writeToStreams( msg , Logger::INFO ); } @@ -139,7 +140,7 @@ void DefaultLogger::info( const std::string &message ) // Logs a warning void DefaultLogger::warn( const std::string &message ) { - const std::string msg( "Warn: " + getThreadID() + " :"+ message ); + const std::string msg( "Warn, T" + getThreadID() + ": "+ message ); writeToStreams( msg, Logger::WARN ); } @@ -147,7 +148,7 @@ void DefaultLogger::warn( const std::string &message ) // Logs an error void DefaultLogger::error( const std::string &message ) { - const std::string msg( "Error: "+ getThreadID() + " :" + message ); + const std::string msg( "Error, T"+ getThreadID() + ": " + message ); writeToStreams( msg, Logger::ERR ); } @@ -232,10 +233,10 @@ DefaultLogger::DefaultLogger( const std::string &name, LogSeverity severity ) : { #ifdef WIN32 m_Streams.push_back( new Win32DebugLogStream() ); - if (name.empty()) - return; #endif + if (name.empty()) + return; m_Streams.push_back( new FileLogStream( name ) ); } @@ -293,7 +294,7 @@ std::string DefaultLogger::getThreadID() if ( hThread ) { std::stringstream thread_msg; - thread_msg << ::GetCurrentThreadId() << " "; + thread_msg << ::GetCurrentThreadId() /*<< " "*/; return thread_msg.str(); } else diff --git a/code/Importer.cpp b/code/Importer.cpp index f17e26baf..da784827c 100644 --- a/code/Importer.cpp +++ b/code/Importer.cpp @@ -299,7 +299,7 @@ aiReturn Importer::RegisterLoader(BaseImporter* pImp) pImp->GetExtensionList(st); #ifdef _DEBUG - const char* sz = ::strtok(st.c_str(),";"); + const char* sz = ::strtok(const_cast(st.c_str()),";"); while (sz) { if (IsExtensionSupported(std::string(sz))) diff --git a/code/LWOLoader.cpp b/code/LWOLoader.cpp index c368e441d..7987486f4 100644 --- a/code/LWOLoader.cpp +++ b/code/LWOLoader.cpp @@ -242,14 +242,14 @@ void LWOImporter::CountVertsAndFaces(unsigned int& verts, unsigned int& faces, { while (cursor < end && max--) { - uint16_t numIndices = *((uint16_t*)cursor);cursor+=2; + uint16_t numIndices = *((LE_NCONST uint16_t*)cursor);cursor+=2; verts += numIndices;faces++; cursor += numIndices*2; - int16_t surface = *((uint16_t*)cursor);cursor+=2; + int16_t surface = *((LE_NCONST uint16_t*)cursor);cursor+=2; if (surface < 0) { // there are detail polygons - numIndices = *((uint16_t*)cursor);cursor+=2; + numIndices = *((LE_NCONST uint16_t*)cursor);cursor+=2; CountVertsAndFaces(verts,faces,cursor,end,numIndices); } } @@ -263,13 +263,13 @@ void LWOImporter::CopyFaceIndices(LWOImporter::FaceList::iterator& it, while (cursor < end && max--) { LWO::Face& face = *it;++it; - if(face.mNumIndices = *((uint16_t*)cursor)) + if(face.mNumIndices = *((LE_NCONST uint16_t*)cursor)) { if (cursor + face.mNumIndices*2 + 4 >= end)break; face.mIndices = new unsigned int[face.mNumIndices]; for (unsigned int i = 0; i < face.mNumIndices;++i) { - face.mIndices[i] = *((uint16_t*)(cursor+=2)); + face.mIndices[i] = *((LE_NCONST uint16_t*)(cursor+=2)); if (face.mIndices[i] >= mTempPoints->size()) { face.mIndices[i] = mTempPoints->size()-1; @@ -279,13 +279,13 @@ void LWOImporter::CopyFaceIndices(LWOImporter::FaceList::iterator& it, } else DefaultLogger::get()->warn("LWO: Face has 0 indices"); cursor+=2; - int16_t surface = *((uint16_t*)cursor);cursor+=2; + int16_t surface = *((LE_NCONST uint16_t*)cursor);cursor+=2; if (surface < 0) { surface = -surface; // there are detail polygons - uint16_t numPolygons = *((uint16_t*)cursor);cursor+=2; + uint16_t numPolygons = *((LE_NCONST uint16_t*)cursor);cursor+=2; if (cursor < end)CopyFaceIndices(it,cursor,end,numPolygons); } face.surfaceIndex = surface-1; diff --git a/workspaces/vc8/assimp.vcproj b/workspaces/vc8/assimp.vcproj index 918d141fe..163f5941d 100644 --- a/workspaces/vc8/assimp.vcproj +++ b/workspaces/vc8/assimp.vcproj @@ -1094,6 +1094,10 @@ RelativePath="..\..\code\DefaultIOSystem.cpp" > + + @@ -1270,14 +1274,6 @@ > - - - -