Merge pull request #596 from LegalizeAdulthood/init-variables

Initialize all members in c'tors
pull/600/head
Kim Kulling 2015-07-03 15:36:58 +02:00
commit d763483c67
45 changed files with 6589 additions and 6452 deletions

View File

@ -332,6 +332,7 @@ struct Texture
, mScaleV (1.0f)
, mRotation (0.0f)
, mMapMode (aiTextureMapMode_Wrap)
, bPrivate()
, iUVSrc (0)
{
mTextureBlend = get_qnan();
@ -484,11 +485,11 @@ struct aiFloatKey
struct Node
{
Node()
: mHierarchyPos (0)
: mParent()
, mInstanceNumber()
, mHierarchyPos (0)
, mHierarchyIndex (0)
, mInstanceCount (1)
{
static int iCnt = 0;

View File

@ -103,6 +103,14 @@ static const aiImporterDesc desc = {
// ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer
Discreet3DSImporter::Discreet3DSImporter()
: stream(),
mLastNodeIndex(),
mCurrentNode(),
mRootNode(),
mScene(),
mMasterScale(),
bHasBG(),
bIsPrj()
{}
// ------------------------------------------------------------------------------------------------

View File

@ -129,6 +129,15 @@ static const aiImporterDesc desc = {
// ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer
AC3DImporter::AC3DImporter()
: buffer(),
configSplitBFCull(),
configEvalSubdivision(),
mNumMeshes(),
mLights(),
lights(),
groups(),
polys(),
worlds()
{
// nothing to be done here
}

View File

@ -130,6 +130,7 @@ public:
, surfaces()
, numRefs (0)
, subDiv (0)
, crease()
{}
// Type description

View File

@ -79,7 +79,11 @@ static const aiImporterDesc desc = {
// ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer
ASEImporter::ASEImporter()
: noSkeletonMesh()
: mParser(),
mBuffer(),
pcScene(),
configRecomputeNormals(),
noSkeletonMesh()
{}
// ------------------------------------------------------------------------------------------------

View File

@ -70,7 +70,10 @@ static const aiImporterDesc desc = {
// ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer
BVHLoader::BVHLoader()
: noSkeletonMesh()
: mLine(),
mAnimTickDuration(),
mAnimNumFrames(),
noSkeletonMesh()
{}
// ------------------------------------------------------------------------------------------------

View File

@ -87,6 +87,8 @@ static const aiImporterDesc desc = {
// ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer
IRRImporter::IRRImporter()
: fps(),
configSpeedFlag()
{}
// ------------------------------------------------------------------------------------------------

View File

@ -166,7 +166,9 @@ private:
Node(ET t)
: type (t)
, scaling (1.f,1.f,1.f) // assume uniform scaling by default
, parent()
, framesPerSecond (0.f)
, id()
, sphereRadius (1.f)
, spherePolyCountX (100)
, spherePolyCountY (100)

View File

@ -62,6 +62,10 @@ using namespace Assimp::LWO;
AnimResolver::AnimResolver(std::list<Envelope>& _envelopes,double tick)
: envelopes (_envelopes)
, sample_rate (0.)
, envl_x(), envl_y(), envl_z()
, end_x(), end_y(), end_z()
, flags()
, sample_delta()
{
trans_x = trans_y = trans_z = NULL;
rotat_x = rotat_y = rotat_z = NULL;

View File

@ -113,7 +113,10 @@ enum PrePostBehaviour
struct Key
{
Key()
: inter (IT_LINE)
: time(),
value(),
inter (IT_LINE),
params()
{}
//! Current time
@ -141,7 +144,8 @@ struct Key
struct Envelope
{
Envelope()
: type (EnvelopeType_Unknown)
: index()
, type (EnvelopeType_Unknown)
, pre (PrePostBehaviour_Constant)
, post (PrePostBehaviour_Constant)

View File

@ -433,6 +433,7 @@ struct Texture
Texture()
: mClipIdx(UINT_MAX)
, mStrength (1.0f)
, type()
, mUVChannelIndex ("unknown")
, mRealUVIndex (UINT_MAX)
, enabled (true)
@ -499,6 +500,7 @@ struct Clip
Clip()
: type (UNSUPPORTED)
, clipRef()
, idx (0)
, negate (false)
{}

View File

@ -77,6 +77,19 @@ static const aiImporterDesc desc = {
// ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer
LWOImporter::LWOImporter()
: mIsLWO2(),
mIsLXOB(),
mLayers(),
mCurLayer(),
mTags(),
mMapping(),
mSurfaces(),
mFileBuffer(),
fileSize(),
pScene(),
configSpeedFlag(),
configLayerIndex(),
hasNamedLayer()
{}
// ------------------------------------------------------------------------------------------------

View File

@ -129,7 +129,12 @@ void LWS::Element::Parse (const char*& buffer)
// ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer
LWSImporter::LWSImporter()
: noSkeletonMesh()
: configSpeedFlag(),
io(),
first(),
last(),
fps(),
noSkeletonMesh()
{
// nothing to do here
}

View File

@ -85,7 +85,9 @@ public:
struct NodeDesc
{
NodeDesc()
: number (0)
: type()
, id()
, number (0)
, parent (0)
, name ("")
, isPivotSet (false)
@ -94,6 +96,7 @@ struct NodeDesc
, lightType (0)
, lightFalloffType (0)
, lightConeAngle (45.f)
, lightEdgeAngle()
, parent_resolved (NULL)
{}

View File

@ -92,6 +92,10 @@ void MD2::LookupNormalIndex(uint8_t iNormalIndex,aiVector3D& vOut)
// ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer
MD2Importer::MD2Importer()
: configFrameID(),
m_pcHeader(),
mBuffer(),
fileSize()
{}
// ------------------------------------------------------------------------------------------------

View File

@ -354,8 +354,14 @@ void Q3Shader::ConvertShaderToMaterial(aiMaterial* out, const ShaderDataBlock& s
// ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer
MD3Importer::MD3Importer()
: configFrameID (0)
, configHandleMP (true)
: configFrameID (0)
, configHandleMP (true)
, configSpeedFlag()
, pcHeader()
, mBuffer()
, fileSize()
, mScene()
, mIOHandler()
{}
// ------------------------------------------------------------------------------------------------

View File

@ -82,8 +82,16 @@ static const aiImporterDesc desc = {
// ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer
MD5Importer::MD5Importer()
: mBuffer()
, configNoAutoLoad (false)
: mIOHandler()
, mBuffer()
, fileSize()
, iLineNumber()
, pScene()
, pIOHandler()
, bHadMD5Mesh()
, bHadMD5Anim()
, bHadMD5Camera()
, configNoAutoLoad (false)
{}
// ------------------------------------------------------------------------------------------------

View File

@ -117,6 +117,21 @@ struct Surface
uint32_t ulOffsetFrameCompFrames ;
uint32_t ulOffsetEnd;
Surface()
: ulIdent(),
ulFlags(),
ulNumCompFrames(),
ulNumBaseFrames(),
ulNumShaders(),
ulNumVertices(),
ulNumTriangles(),
ulOffsetTriangles(),
ulOffsetShaders(),
ulOffsetTexCoords(),
ulOffsetBaseVerts(),
ulOffsetCompVerts(),
ulOffsetFrameBaseFrames(),
ulOffsetFrameCompFrames(),
ulOffsetEnd()
{
ucName[AI_MDC_MAXQPATH-1] = '\0';
}

View File

@ -95,6 +95,10 @@ void MDC::BuildVertex(const Frame& frame,
// ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer
MDCImporter::MDCImporter()
: configFrameID(),
pcHeader(),
mBuffer(),
fileSize()
{
}

View File

@ -841,6 +841,9 @@ struct IntGroupInfo_MDL7
IntGroupInfo_MDL7(BE_NCONST MDL::Group_MDL7* _pcGroup, unsigned int _iIndex)
: iIndex(_iIndex)
, pcGroup(_pcGroup)
, pcGroupUVs()
, pcGroupTris()
, pcGroupVerts()
{}
//! Index of the group
@ -896,6 +899,8 @@ struct IntSharedData_MDL7
{
//! Default constructor
IntSharedData_MDL7()
: apcOutBones(),
iNum()
{
abNeedMaterials.reserve(10);
}
@ -933,7 +938,7 @@ struct IntSplitGroupData_MDL7
IntSplitGroupData_MDL7(IntSharedData_MDL7& _shared,
std::vector<aiMesh*>& _avOutList)
: shared(_shared), avOutList(_avOutList)
: aiSplit(), shared(_shared), avOutList(_avOutList)
{
}

View File

@ -89,6 +89,12 @@ static const aiImporterDesc desc = {
// ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer
MDLImporter::MDLImporter()
: configFrameID(),
mBuffer(),
iGSFileVersion(),
pIOHandler(),
pScene(),
iFileSize()
{}
// ------------------------------------------------------------------------------------------------

View File

@ -78,6 +78,7 @@ static const aiImporterDesc desc = {
// ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer
MS3DImporter::MS3DImporter()
: mScene()
{}
// ------------------------------------------------------------------------------------------------

View File

@ -47,7 +47,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/scene.h>
#include <assimp/ai_assert.h>
#include <algorithm>
#include <vector>
static const aiImporterDesc desc = {
@ -194,9 +193,9 @@ OpenGEXImporter::VertexContainer::VertexContainer()
: m_numVerts( 0 )
, m_vertices(NULL)
, m_numNormals( 0 )
, m_normals(NULL) {
std::fill(&m_numUVComps[0], &m_numUVComps[AI_MAX_NUMBER_OF_TEXTURECOORDS], 0U);
std::fill(&m_textureCoords[0], &m_textureCoords[AI_MAX_NUMBER_OF_TEXTURECOORDS], static_cast<aiVector3D *>(NULL));
, m_normals(NULL)
, m_numUVComps()
, m_textureCoords() {
}
//------------------------------------------------------------------------------------------------
@ -228,13 +227,13 @@ OpenGEXImporter::OpenGEXImporter()
, m_meshCache()
, m_mesh2refMap()
, m_ctx( NULL )
, m_metrics()
, m_currentNode( NULL )
, m_currentMesh( NULL )
, m_currentMaterial( NULL )
, m_tokenType( Grammar::NoneType )
, m_nodeStack()
, m_unresolvedRefStack() {
std::fill(&m_metrics[0], &m_metrics[MetricInfo::Max], MetricInfo());
}
//------------------------------------------------------------------------------------------------

View File

@ -90,6 +90,8 @@ namespace
// ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer
PLYImporter::PLYImporter()
: mBuffer(),
pcDOM()
{}
// ------------------------------------------------------------------------------------------------

View File

@ -211,7 +211,10 @@ public:
//! Default constructor
Property()
: eType (EDT_Int), bIsList(false), eFirstType(EDT_UChar)
: eType (EDT_Int),
Semantic(),
bIsList(false),
eFirstType(EDT_UChar)
{}
//! Data type of the property

View File

@ -75,6 +75,14 @@ static const aiImporterDesc desc = {
// ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer
SMDImporter::SMDImporter()
: configFrameID(),
mBuffer(),
pScene(),
iFileSize(),
iSmallestFrame(),
dLengthOfAnim(),
bHasUVs(),
iLineNumber()
{}
// ------------------------------------------------------------------------------------------------
@ -694,7 +702,7 @@ void SMDImporter::ParseFile()
{
if(!SkipSpacesAndLineEnd(szCurrent,&szCurrent)) break;
// "version <n> \n", <n> should be 1 for hl and hl² SMD files
// "version <n> \n", <n> should be 1 for hl and hl<EFBFBD> SMD files
if (TokenMatch(szCurrent,"version",7))
{
if(!SkipSpaces(szCurrent,&szCurrent)) break;

View File

@ -126,6 +126,7 @@ struct Bone
{
//! Public default constructor
Animation()
: iFirstTimeKey()
{
asKeys.reserve(20);
}

View File

@ -106,6 +106,9 @@ bool IsAsciiSTL(const char* buffer, unsigned int fileSize) {
// ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer
STLImporter::STLImporter()
: mBuffer(),
fileSize(),
pScene()
{}
// ------------------------------------------------------------------------------------------------

View File

@ -52,9 +52,10 @@ http://www.jalix.org/ressources/graphics/3DS/_unofficials/3ds-unofficial.txt */
/** Helper structure representing a face with smoothing groups assigned */
struct FaceWithSmoothingGroup
{
FaceWithSmoothingGroup() : iSmoothGroup(0)
FaceWithSmoothingGroup()
: mIndices(),
iSmoothGroup(0)
{
// let the rest uninitialized for performance - in release builds.
// in debug builds set all indices to a common magic value
#ifdef ASSIMP_BUILD_DEBUG
this->mIndices[0] = 0xffffffff;
@ -65,7 +66,7 @@ struct FaceWithSmoothingGroup
//! Indices. .3ds is using uint16. However, after
//! an unique vrtex set has been generated,
//! an unique vertex set has been generated,
//! individual index values might exceed 2^16
uint32_t mIndices[3];

View File

@ -82,7 +82,9 @@ struct Triangle {
// temporary representation for a material
struct TempMat {
TempMat()
: numFaces (0)
: type()
, tex()
, numFaces (0)
{}
TempMat(const Triangle& in)

View File

@ -87,9 +87,13 @@ struct Material
aiColor3D mEmissive;
std::vector<TexEntry> mTextures;
size_t sceneIndex; ///< the index under which it was stored in the scene's material list
size_t sceneIndex; ///< the index under which it was stored in the scene's material list
Material() { mIsReference = false; sceneIndex = SIZE_MAX; }
Material()
: mIsReference(false),
mSpecularExponent(),
sceneIndex(SIZE_MAX)
{}
};
/** Helper structure to represent a bone weight */

View File

@ -145,6 +145,7 @@ namespace AssimpView {
MeshHelper()
:
eShadingMode(),
piVB( NULL ),
piIB( NULL ),
piVBNormals( NULL ),
@ -158,6 +159,9 @@ namespace AssimpView {
piOpacityTexture( NULL ),
piShininessTexture( NULL ),
piLightmapTexture( NULL ),
fOpacity(),
fShininess(),
fSpecularStrength()
twosided( false ),
pvOriginalNormals( NULL )
{}