Browse Source

Fixes for uninitialized variable warnings.

Sherief Farouk 12 years ago
parent
commit
9b591fadb8
3 changed files with 5 additions and 4 deletions
  1. 2 1
      code/FBXBinaryTokenizer.cpp
  2. 1 1
      code/FBXConverter.cpp
  3. 2 2
      code/MaterialSystem.cpp

+ 2 - 1
code/FBXBinaryTokenizer.cpp

@@ -232,7 +232,7 @@ void ReadData(const char*& sbegin_out, const char*& send_out, const char* input,
 
 
 		// compute length based on type and check against the stored value
 		// compute length based on type and check against the stored value
 		if(encoding == 0) {
 		if(encoding == 0) {
-			uint32_t stride;
+			uint32_t stride = 0;
 			switch(type)
 			switch(type)
 			{
 			{
 			case 'f':
 			case 'f':
@@ -248,6 +248,7 @@ void ReadData(const char*& sbegin_out, const char*& send_out, const char* input,
 			default:
 			default:
 				ai_assert(false);
 				ai_assert(false);
 			};
 			};
+            ai_assert(stride > 0);
 			if(length * stride != comp_len) {
 			if(length * stride != comp_len) {
 				TokenizeError("cannot ReadData, calculated data stride differs from what the file claims",input, cursor);
 				TokenizeError("cannot ReadData, calculated data stride differs from what the file claims",input, cursor);
 			}
 			}

+ 1 - 1
code/FBXConverter.cpp

@@ -1848,7 +1848,7 @@ private:
 		}}
 		}}
 #endif
 #endif
 
 
-		const AnimationCurveNode* curve_node;
+		const AnimationCurveNode* curve_node = NULL;
 		BOOST_FOREACH(const AnimationCurveNode* node, curves) {
 		BOOST_FOREACH(const AnimationCurveNode* node, curves) {
 			ai_assert(node);
 			ai_assert(node);
 
 

+ 2 - 2
code/MaterialSystem.cpp

@@ -102,7 +102,7 @@ aiReturn aiGetMaterialFloatArray(const aiMaterial* pMat,
 	}
 	}
 
 
 	// data is given in floats, simply copy it
 	// data is given in floats, simply copy it
-	unsigned int iWrite;
+	unsigned int iWrite = 0;
 	if( aiPTI_Float == prop->mType || aiPTI_Buffer == prop->mType)	{
 	if( aiPTI_Float == prop->mType || aiPTI_Buffer == prop->mType)	{
 		iWrite = prop->mDataLength / sizeof(float);
 		iWrite = prop->mDataLength / sizeof(float);
 		if (pMax) {
 		if (pMax) {
@@ -175,7 +175,7 @@ aiReturn aiGetMaterialIntegerArray(const aiMaterial* pMat,
 	}
 	}
 
 
 	// data is given in ints, simply copy it
 	// data is given in ints, simply copy it
-	unsigned int iWrite;
+	unsigned int iWrite = 0;
 	if( aiPTI_Integer == prop->mType || aiPTI_Buffer == prop->mType)	{
 	if( aiPTI_Integer == prop->mType || aiPTI_Buffer == prop->mType)	{
 		iWrite = prop->mDataLength / sizeof(int32_t);
 		iWrite = prop->mDataLength / sizeof(int32_t);
 		if (pMax) {
 		if (pMax) {