Browse Source

Merge pull request #403 from dpogue/coverity_patches

Coverity patches

Closes #396.
Darryl Pogue 11 years ago
parent
commit
fdd8279c57
  1. 12
      Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommands.cpp
  2. 13
      Sources/Tools/MaxConvert/plDistributor.cpp

12
Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommands.cpp

@ -2144,8 +2144,18 @@ PF_CONSOLE_CMD( App,
if( !stricmp(eventStr, "Time") ) if( !stricmp(eventStr, "Time") )
{ {
event = kTime; event = kTime;
if (numParams < 2)
{
PrintString("'Time' expects a timestamp (in seconds)");
return;
}
secs = params[2]; secs = params[2];
} }
else
{
PrintString("Unknown event type. Options are 'Start', 'Stop', and 'Time'");
return;
}
if( numParams > 3 ) if( numParams > 3 )
{ {
reps = params[3]; reps = params[3];
@ -3621,7 +3631,7 @@ PF_CONSOLE_CMD( Listener, XMode, "bool b", "Sets velocity and position to avatar
plSetListenerMsg *set = nil; plSetListenerMsg *set = nil;
plKey pKey = plNetClientMgr::GetInstance()->GetLocalPlayerKey(); plKey pKey = plNetClientMgr::GetInstance()->GetLocalPlayerKey();
plListener* pListener; plListener* pListener = nullptr;
if( (bool)params[ 0 ] ) if( (bool)params[ 0 ] )
{ {

13
Sources/Tools/MaxConvert/plDistributor.cpp

@ -83,8 +83,11 @@ static const float kMaxHeight = 10.f;
// overall rnd - overall probability that a candidate seed point (passing all other criteria) will be used // overall rnd - overall probability that a candidate seed point (passing all other criteria) will be used
// //
static inline hsPoint3& hsP3(const Point3& p) { return *(hsPoint3*)&p; }
static inline hsVector3& hsV3(const Point3& p) { return *(hsVector3*)&p; } static inline const hsPoint3& hsP3(const Point3& p) { return reinterpret_cast<const hsPoint3&>(p); }
static inline const hsVector3& hsV3(const Point3& p) { return reinterpret_cast<const hsVector3&>(p); }
static inline hsPoint3& hsP3(Point3& p) { return reinterpret_cast<hsPoint3&>(p); }
static inline hsVector3& hsV3(Point3& p) { return reinterpret_cast<hsVector3&>(p); }
static inline Matrix3 Transpose(const Matrix3& m) static inline Matrix3 Transpose(const Matrix3& m)
{ {
return Matrix3(m.GetColumn3(0), m.GetColumn3(1), m.GetColumn3(2), Point3(0,0,0)); return Matrix3(m.GetColumn3(0), m.GetColumn3(1), m.GetColumn3(2), Point3(0,0,0));
@ -1010,9 +1013,9 @@ BOOL plDistributor::IProjectVertex(const Point3& pt, const Point3& dir, float ma
for( i = 0; i < faces.Count(); i++ ) for( i = 0; i < faces.Count(); i++ )
{ {
int iFace = faces[i]; int iFace = faces[i];
const hsPoint3& p0 = hsP3(fSurfMesh->getVert(fSurfMesh->faces[iFace].getVert(0)) * fSurfToWorld); hsPoint3 p0 = hsP3(fSurfMesh->getVert(fSurfMesh->faces[iFace].getVert(0)) * fSurfToWorld);
const hsPoint3& p1 = hsP3(fSurfMesh->getVert(fSurfMesh->faces[iFace].getVert(1)) * fSurfToWorld); hsPoint3 p1 = hsP3(fSurfMesh->getVert(fSurfMesh->faces[iFace].getVert(1)) * fSurfToWorld);
const hsPoint3& p2 = hsP3(fSurfMesh->getVert(fSurfMesh->faces[iFace].getVert(2)) * fSurfToWorld); hsPoint3 p2 = hsP3(fSurfMesh->getVert(fSurfMesh->faces[iFace].getVert(2)) * fSurfToWorld);
Point3 plnPt = pt; Point3 plnPt = pt;
if( triUtil.ProjectOntoPlaneAlongVector(p0, p1, p2, hsV3(dir), hsP3(plnPt)) ) if( triUtil.ProjectOntoPlaneAlongVector(p0, p1, p2, hsV3(dir), hsP3(plnPt)) )

Loading…
Cancel
Save