From 8ae61a897cafca56a3caca46d7ad8d98a1c87e93 Mon Sep 17 00:00:00 2001 From: Amorilia <amorilia@users.sourceforge.net> Date: Sat, 6 Jun 2009 10:54:50 +0000 Subject: [PATCH] niflib: fix some compiler warnings (contributed by guidoj, see issue #2788600) --- include/nif_math.h | 2 +- src/Inertia.cpp | 4 +--- src/NIF_IO.cpp | 6 ++---- src/ObjectRegistry.cpp | 4 +--- src/niflib.cpp | 5 ++--- 5 files changed, 7 insertions(+), 14 deletions(-) diff --git a/include/nif_math.h b/include/nif_math.h index fe8eae69..8ff3a6b6 100644 --- a/include/nif_math.h +++ b/include/nif_math.h @@ -18,7 +18,7 @@ namespace Niflib { #endif #ifndef _countof -#define _countof(x) ((sizeof (x))/(sizeof((x)[0]))) +#define _countof(x) (int)((sizeof (x))/(sizeof((x)[0]))) #endif //Forward declarations diff --git a/src/Inertia.cpp b/src/Inertia.cpp index af073fe2..fe51530d 100644 --- a/src/Inertia.cpp +++ b/src/Inertia.cpp @@ -207,8 +207,6 @@ void Inertia::CalcMassPropertiesPolyhedron(const vector<Vector3>& vertices, Matrix33 covariance_canonical( 2.0f, 1.0f, 1.0f, 1.0f, 2.0f, 1.0f, 1.0f, 1.0f, 2.0f ); - float covariance_correction = 1.0f/120.0f; - vector<Matrix44> covariances; vector<float> masses; vector<Vector3> centers; @@ -347,4 +345,4 @@ void Inertia::CombineMassProperties( inertia *= inertias[i]; } -} \ No newline at end of file +} diff --git a/src/NIF_IO.cpp b/src/NIF_IO.cpp index 7a4e0aff..b70dff24 100644 --- a/src/NIF_IO.cpp +++ b/src/NIF_IO.cpp @@ -408,10 +408,6 @@ void NifStream( HeaderString const & val, ostream& out, const NifInfo & info ) { } header_string << FormatVersionString(info.version); - - char * byte_ver = (char*)&(info.version); - int int_ver[4] = { byte_ver[3], byte_ver[2], byte_ver[1], byte_ver[0] }; - out << header_string.str() << "\n"; }; @@ -830,6 +826,8 @@ std::streampos NifStreamBuf::seekoff(std::streamoff offset, std::ios_base::seekd case std::ios_base::end: pos = size - offset; return (pos >= 0 && pos < size) ? (streampos(-1)) : pos; + default: + return streampos(-1); } return streampos(-1); } diff --git a/src/ObjectRegistry.cpp b/src/ObjectRegistry.cpp index c7bbf46b..573f5b44 100644 --- a/src/ObjectRegistry.cpp +++ b/src/ObjectRegistry.cpp @@ -12,8 +12,6 @@ void ObjectRegistry::RegisterObject( const string & type_name, obj_factory_func } NiObject * ObjectRegistry::CreateObject( const string & type_name ) { - NiObject * object = NULL; - map<string, obj_factory_func>::iterator it; it = object_map.find(type_name); @@ -26,4 +24,4 @@ NiObject * ObjectRegistry::CreateObject( const string & type_name ) { } } -} //End namespace Niflib \ No newline at end of file +} //End namespace Niflib diff --git a/src/niflib.cpp b/src/niflib.cpp index 0b16e576..08732582 100644 --- a/src/niflib.cpp +++ b/src/niflib.cpp @@ -422,8 +422,7 @@ void WriteNifTree( ostream & out, list<NiObjectRef> const & roots, const NifInfo types[it->second] = it->first; } - unsigned version = info.version; - unsigned user_version = info.userVersion; + unsigned int version = info.version; //--Write Header--// Header header; @@ -454,7 +453,7 @@ void WriteNifTree( ostream & out, list<NiObjectRef> const & roots, const NifInfo } // Set object sizes and accumulate string types - if (header.version >= VER_20_1_0_3) + if (version >= VER_20_1_0_3) { // Zero string information header.maxStringLength = 0; -- GitLab