From 468dbcfcd6b1fb229913271a8a7c96510eb33036 Mon Sep 17 00:00:00 2001
From: skyfox69 <fdueber@cat-gmbh.de>
Date: Tue, 1 May 2012 08:22:46 +0200
Subject: [PATCH] removed some compiler warnings

---
 include/NIF_IO.h                    |  2 +-
 include/niflib.h                    |  2 +-
 src/ComplexShape.cpp                | 26 +++++++++++++-------------
 src/obj/BSDismemberSkinInstance.cpp |  2 +-
 src/obj/NiBSplineData.cpp           |  8 ++++----
 src/obj/NiTriShapeData.cpp          |  1 +
 src/obj/bhkMoppBvTreeShape.cpp      |  3 +++
 7 files changed, 24 insertions(+), 20 deletions(-)

diff --git a/include/NIF_IO.h b/include/NIF_IO.h
index ed1456cf..fc1428a3 100644
--- a/include/NIF_IO.h
+++ b/include/NIF_IO.h
@@ -215,7 +215,7 @@ void NifStream( InertiaMatrix & val, istream& in, const NifInfo & info);
 void NifStream( InertiaMatrix const & val, ostream& out, const NifInfo & info);
 
 //ByteColor4
-class ByteColor4;
+struct ByteColor4;
 void NifStream( ByteColor4 & val, istream& in, const NifInfo & info);
 void NifStream( ByteColor4 const & val, ostream& out, const NifInfo & info);
 ostream & operator<<( ostream & out, ByteColor4 const & val );
diff --git a/include/niflib.h b/include/niflib.h
index 6d596278..6e45c184 100644
--- a/include/niflib.h
+++ b/include/niflib.h
@@ -61,7 +61,7 @@ class NiObject;
 class NiNode;
 class NiAVObject;
 class NiControllerSequence;
-class Header;
+struct Header;
 
 #ifndef NULL
 #define NULL 0  /*!< Definition used to detect null pointers. */ 
diff --git a/src/ComplexShape.cpp b/src/ComplexShape.cpp
index 307af656..920172d5 100644
--- a/src/ComplexShape.cpp
+++ b/src/ComplexShape.cpp
@@ -152,7 +152,7 @@ vector<int> ComplexShape::GetDismemberPartitionsFaces() const {
 void ComplexShape::SetDismemberPartitionsFaces(const vector<int>& value ) {
 	dismemberPartitionsFaces.resize(value.size());
 
-	for(int i = 0; i < dismemberPartitionsFaces.size(); i++) {
+	for(unsigned int i = 0; i < dismemberPartitionsFaces.size(); i++) {
 		dismemberPartitionsFaces[i] = value[i];
 	}
 }
@@ -552,11 +552,11 @@ void ComplexShape::Merge( NiAVObject * root ) {
 				vector<BodyPartList> current_body_parts;
 				vector<int> current_body_parts_faces;
 
-				for(int y = 0; y < dismember_skin->GetPartitions().size(); y++) {
+				for(unsigned int y = 0; y < dismember_skin->GetPartitions().size(); y++) {
 					current_body_parts.push_back(dismember_skin->GetPartitions().at(y));
 				}
 
-				for(int y = 0; y < shapeTris.size(); y++) {
+				for(unsigned int y = 0; y < shapeTris.size(); y++) {
 					current_body_parts_faces.push_back(0);
 				}
 
@@ -569,8 +569,8 @@ void ComplexShape::Merge( NiAVObject * root ) {
 						has_vertex_map = true;
 					}
 
-					for(int z = 0; z < partition_triangles.size(); z++) {
-						int w = faces.size() - shapeTris.size();
+					for(unsigned int z = 0; z < partition_triangles.size(); z++) {
+						unsigned int w = faces.size() - shapeTris.size();
 
 						int merged_x;
 						int merged_y;
@@ -628,10 +628,10 @@ void ComplexShape::Merge( NiAVObject * root ) {
 					}
 				}
 
-				for(int y = 0; y < current_body_parts.size(); y++) {
+				for(unsigned int y = 0; y < current_body_parts.size(); y++) {
 					int match_index = -1;
 
-					for(int z = 0; z < dismemberPartitionsBodyParts.size(); z++) {
+					for(unsigned int z = 0; z < dismemberPartitionsBodyParts.size(); z++) {
 						if(dismemberPartitionsBodyParts[z].bodyPart == current_body_parts[y].bodyPart 
 							&& dismemberPartitionsBodyParts[z].partFlag == current_body_parts[y].partFlag) {
 								match_index = z;
@@ -644,14 +644,14 @@ void ComplexShape::Merge( NiAVObject * root ) {
 						match_index = dismemberPartitionsBodyParts.size() - 1;
 					} 
 
-					for(int z = 0; z < current_body_parts_faces.size(); z++) {
+					for(unsigned int z = 0; z < current_body_parts_faces.size(); z++) {
 						if(current_body_parts_faces[z] == y) {
 							current_body_parts_faces[z] = match_index;
 						}
 					}
 				}
 
-				for(int x = 0; x < current_body_parts_faces.size(); x++) {
+				for(unsigned int x = 0; x < current_body_parts_faces.size(); x++) {
 					dismemberPartitionsFaces.push_back(current_body_parts_faces[x]);
 				}
 			}
@@ -904,16 +904,16 @@ Ref<NiAVObject> ComplexShape::Split( NiNode * parent, Matrix44 & transform, int
 		//if no face points to a certain dismember partition then that dismember partition must be removed
 		if(use_dismember_partitions == true) {
 			vector<bool> used_dismember_groups(current_dismember_partitions.size(), false);
-			for(int x = 0; x < current_dismember_partitions_faces.size(); x++) {
+			for(unsigned int x = 0; x < current_dismember_partitions_faces.size(); x++) {
 				if(used_dismember_groups[current_dismember_partitions_faces[x]] == false) {
 					used_dismember_groups[current_dismember_partitions_faces[x]] = true;
 				}	
 			}
 
 			vector<BodyPartList> cleaned_up_dismember_partitions;
-			for(int x = 0; x < current_dismember_partitions.size(); x++) {
+			for(unsigned int x = 0; x < current_dismember_partitions.size(); x++) {
 				if (used_dismember_groups[x] == false) {
-					for(int y = 0; y < current_dismember_partitions_faces.size(); y++) {
+					for(unsigned int y = 0; y < current_dismember_partitions_faces.size(); y++) {
 						if(current_dismember_partitions_faces[y] > x) {
 							current_dismember_partitions_faces[y]--;
 						}
@@ -1065,7 +1065,7 @@ Ref<NiAVObject> ComplexShape::Split( NiNode * parent, Matrix44 & transform, int
 
 			if(use_dismember_partitions == true ) {
 				int* face_map = new int[current_dismember_partitions_faces.size()];
-				for(int x = 0; x < current_dismember_partitions_faces.size(); x++) {
+				for(unsigned int x = 0; x < current_dismember_partitions_faces.size(); x++) {
 					face_map[x] = current_dismember_partitions_faces[x];
 				}
 				shapes[ shape_num]->GenHardwareSkinInfo( max_bones_per_partition, 4, stripify, face_map);
diff --git a/src/obj/BSDismemberSkinInstance.cpp b/src/obj/BSDismemberSkinInstance.cpp
index 6b0f3483..182cd7ed 100644
--- a/src/obj/BSDismemberSkinInstance.cpp
+++ b/src/obj/BSDismemberSkinInstance.cpp
@@ -128,7 +128,7 @@ vector<BodyPartList > BSDismemberSkinInstance::GetPartitions() const {
 
 void BSDismemberSkinInstance::SetPartitions( const vector<BodyPartList >& value ) {
    partitions.clear();
-   for(int i = 0; i < value.size(); i++) {
+   for(unsigned int i = 0; i < value.size(); i++) {
 	   partitions.push_back(value[i]);
    }
 }
diff --git a/src/obj/NiBSplineData.cpp b/src/obj/NiBSplineData.cpp
index 9c41c520..5923c446 100644
--- a/src/obj/NiBSplineData.cpp
+++ b/src/obj/NiBSplineData.cpp
@@ -152,7 +152,7 @@ void NiBSplineData::SetFloatControlPoints( vector<float> value )
 	this->floatControlPoints.clear();
 	this->numFloatControlPoints = value.size();
 
-	for(int i = 0; i < value.size(); i++) {
+	for(unsigned int i = 0; i < value.size(); i++) {
 		this->floatControlPoints.push_back(value[i]);
 	}
 }
@@ -161,7 +161,7 @@ void NiBSplineData::AppendFloatControlPoints( vector<float> value )
 {
 	this->numFloatControlPoints += value.size();
 
-	for(int i = 0; i < value.size(); i++) {
+	for(unsigned int i = 0; i < value.size(); i++) {
 		this->floatControlPoints.push_back(value[i]);
 	}
 }
@@ -192,7 +192,7 @@ void NiBSplineData::SetShortControlPoints( vector<short> value )
 	this->shortControlPoints.clear();
 	this->numShortControlPoints = value.size();
 
-	for(int i = 0; i < value.size(); i++) {
+	for(unsigned int i = 0; i < value.size(); i++) {
 		this->shortControlPoints.push_back(value[i]);
 	}
 }
@@ -201,7 +201,7 @@ void NiBSplineData::AppendShortControlPoints( vector<short> value )
 {
 	this->numShortControlPoints += value.size();
 
-	for(int i = 0; i < value.size(); i++) {
+	for(unsigned int i = 0; i < value.size(); i++) {
 		this->shortControlPoints.push_back(value[i]);
 	}
 }
diff --git a/src/obj/NiTriShapeData.cpp b/src/obj/NiTriShapeData.cpp
index f9b538c2..57782cd7 100644
--- a/src/obj/NiTriShapeData.cpp
+++ b/src/obj/NiTriShapeData.cpp
@@ -49,6 +49,7 @@ void NiTriShapeData::Read( istream& in, list<unsigned int> & link_stack, const N
 	};
 	if ( info.version <= 0x0A000102 ) {
 		triangles.resize(numTriangles);
+		hasTriangles = (triangles.size() > 0);
 		for (unsigned int i2 = 0; i2 < triangles.size(); i2++) {
 			NifStream( triangles[i2], in, info );
 		};
diff --git a/src/obj/bhkMoppBvTreeShape.cpp b/src/obj/bhkMoppBvTreeShape.cpp
index ff98faaa..d56cae54 100644
--- a/src/obj/bhkMoppBvTreeShape.cpp
+++ b/src/obj/bhkMoppBvTreeShape.cpp
@@ -97,6 +97,9 @@ void bhkMoppBvTreeShape::Write( ostream& out, const map<NiObjectRef,unsigned int
 
 	bhkBvTreeShape::Write( out, link_map, missing_link_stack, info );
 	moppDataSize = (unsigned int)(oldMoppData.size());
+	if ( info.version >= 0x0A000102 ) {
+		moppDataSize = (unsigned int)(moppData.size());
+	}
 	if ( info.version < VER_3_3_0_13 ) {
 		WritePtr32( &(*shape), out );
 	} else {
-- 
GitLab