OpenCOLLADA icon indicating copy to clipboard operation
OpenCOLLADA copied to clipboard

PVS-Studio check

Open AndreyKarpov opened this issue 12 years ago • 2 comments

PVS-Studio (http://www.viva64.com/) some messages:

V514 Dividing sizeof a pointer 'sizeof (objectGroups)' by another value. There is a probability of logical error presence. mayadmdagnode.h 40

struct ObjectGroups{ componentList objectGrpCompList; int objectGroupId; short objectGrpColor; void write(FILE* file) const; }* objectGroups;

void write(FILE* file) const { size_t size = sizeof(objectGroups)/sizeof(ObjectGroups); for(size_t i=0; i<size; ++i) { objectGroups[i].write(file); if(i+1<size) fprintf(file," "); } }

add

V514 Dividing sizeof a pointer 'sizeof (compObjectGroups)' by another value. There is a probability of logical error presence. mayadmgeometryshape.h 33 V514 Dividing sizeof a pointer 'sizeof (uvSetPoints)' by another value. There is a probability of logical error presence. mayadmcontrolpoint.h 27 V514 Dividing sizeof a pointer 'sizeof (colorSetPoints)' by another value. There is a probability of logical error presence. mayadmcontrolpoint.h 59 V514 Dividing sizeof a pointer 'sizeof (vertexFaceColor)' by another value. There is a probability of logical error presence. mayadmmesh.h 52 V514 Dividing sizeof a pointer 'sizeof (vertexColor)' by another value. There is a probability of logical error presence. mayadmmesh.h 62 V514 Dividing sizeof a pointer 'sizeof (vertexFaceNormal)' by another value. There is a probability of logical error presence. mayadmmesh.h 84 V514 Dividing sizeof a pointer 'sizeof (vertexNormal)' by another value. There is a probability of logical error presence. mayadmmesh.h 94 V514 Dividing sizeof a pointer 'sizeof (inputTargetItem)' by another value. There is a probability of logical error presence. mayadmblendshape.h 35 V514 Dividing sizeof a pointer 'sizeof (targetWeights)' by another value. There is a probability of logical error presence. mayadmblendshape.h 42 V514 Dividing sizeof a pointer 'sizeof (inputTargetGroup)' by another value. There is a probability of logical error presence. mayadmblendshape.h 52 V514 Dividing sizeof a pointer 'sizeof (weights)' by another value. There is a probability of logical error presence. mayadmskincluster.h 24 V514 Dividing sizeof a pointer 'sizeof (controlPoints)' by another value. There is a probability of logical error presence. mayadmtweak.h 24

V514 Dividing sizeof a pointer 'sizeof (vertex)' by another value. There is a probability of logical error presence. mayadmtweak.h 36

V557 Array overrun is possible. The '2' index is pointing beyond array bound. mayadmtypes.h 48

struct short2 { short values[2]; short2(short s1, short s2) { values[0] = s1; values[2] = s2; } ....

};

V611 The memory was allocated using 'new T[]' operator but was released using the 'delete' operator. Consider inspecting this code. It's probably better to use 'delete [] buffer;'. colladamayadocumentexporter.cpp 345

String DocumentExporter::mayaNameToColladaName ( const MString& str, bool removeNamespace ) { .... char* buffer = new char[length+1]; .... delete buffer; ....

}

V614 Uninitialized variable 'i' used. mayadmtypes.h 1728

void write(FILE* file) const { fprintf(file,"%i %i %i %i ", sDivisionCount, tDivisionCount, uDivisionCount, pointCount); size_t size = pointCount*3; for(size_t i; i<size; ++i) { fprintf(file, "%f", points[i]); if(i+1<size) fprintf(file, " "); }

}

struct double2 { double values[2]; double2( double d1, double d2) { values[0]=d1; values[0]=d2; } ....

}

V576 Incorrect format. A different number of actual arguments is expected while calling 'fprintf' function. Expected: 6. Present: 5. mayadmtypes.h 657

struct vector { double x; double y; double z; void write(FILE* file) const { fprintf(file,"%f %f %f %f", x, y, z); }

};

V603 The object was created but it is not being used. If you wish to call constructor, 'this->ParserString::ParserString(....)' should be used. generatedsaxparsertypes.h 56

struct ParserString : public UnionString { ParserString() { UnionString::str = 0; UnionString::length = 0; }

ParserString(const int& val) { ParserString(); } };

add

V603 The object was created but it is not being used. If you wish to call constructor, 'this->URI::URI(....)' should be used. colladabuuri.cpp 169

V603 The object was created but it is not being used. If you wish to call constructor, 'this->URI::URI(....)' should be used. colladabuuri.cpp 180

AndreyKarpov avatar Oct 03 '13 07:10 AndreyKarpov

what is this about ?

RemiArnaud avatar May 23 '15 00:05 RemiArnaud

@mycheckgithub @jerome-jacob those are warnings left by a robot looking at the open source code a while ago.

Could you look into this, apply what is relevant, and close this issue with a PR ?

RemiArnaud avatar May 18 '16 18:05 RemiArnaud