Browse Source

Merge pull request #495 from zrax/coverity

Coverity fixes
Adam Johnson 9 years ago
parent
commit
239a2d0208
  1. 4
      Sources/Plasma/CoreLib/hsBounds.cpp
  2. 2
      Sources/Plasma/CoreLib/hsMatrix44.cpp
  3. 14
      Sources/Plasma/CoreLib/hsStream.cpp
  4. 1
      Sources/Plasma/FeatureLib/pfCharacter/pfMarkerInfo.cpp
  5. 4
      Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleCmd.cpp
  6. 1
      Sources/Plasma/FeatureLib/pfPython/cyAvatar.cpp
  7. 2
      Sources/Plasma/FeatureLib/pfPython/pyGameScoreGlue.cpp
  8. 2
      Sources/Plasma/FeatureLib/pfPython/pyVaultNode.cpp
  9. 6
      Sources/Plasma/NucleusLib/inc/plProfileManager.cpp
  10. 12
      Sources/Plasma/NucleusLib/pnAsyncCore/Private/pnAcLog.cpp
  11. 14
      Sources/Plasma/NucleusLib/pnAsyncCore/Private/pnAcLog.h
  12. 4
      Sources/Plasma/NucleusLib/pnMessage/plNotifyMsg.cpp
  13. 2
      Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.cpp
  14. 1
      Sources/Plasma/NucleusLib/pnTimer/plTimerCallbackManager.cpp
  15. 2
      Sources/Plasma/PubUtilLib/plAnimation/plMatrixChannel.cpp
  16. 11
      Sources/Plasma/PubUtilLib/plAudio/plDSoundBuffer.cpp
  17. 2
      Sources/Plasma/PubUtilLib/plAudio/plWin32StreamingSound.cpp
  18. 17
      Sources/Plasma/PubUtilLib/plAudioCore/plWavFile.cpp
  19. 2
      Sources/Plasma/PubUtilLib/plAvatar/plArmatureMod.cpp
  20. 1
      Sources/Plasma/PubUtilLib/plAvatar/plSwimRegion.cpp
  21. 1
      Sources/Plasma/PubUtilLib/plDrawable/plDrawableSpans.cpp
  22. 4
      Sources/Plasma/PubUtilLib/plDrawable/plDynaDecalMgr.cpp
  23. 2
      Sources/Plasma/PubUtilLib/plDrawable/plSpanInstance.h
  24. 4
      Sources/Plasma/PubUtilLib/plGImage/plDynamicTextMap.cpp
  25. 6
      Sources/Plasma/PubUtilLib/plGImage/plDynamicTextMap.h
  26. 1
      Sources/Plasma/PubUtilLib/plInputCore/plAvatarInputInterface.cpp
  27. 1
      Sources/Plasma/PubUtilLib/plPhysical/plPhysicsSoundMgr.cpp
  28. 4
      Sources/Plasma/PubUtilLib/plPipeline/plCubicRenderTargetModifier.cpp
  29. 2
      Sources/Plasma/PubUtilLib/plSDL/plStateDataRecord.cpp
  30. 2
      Sources/Plasma/PubUtilLib/plSDL/plStateVariable.cpp
  31. 1
      Sources/Plasma/PubUtilLib/plVault/plVaultClientApi.cpp
  32. 4
      Sources/Tools/MaxComponent/plGUIComponents.cpp
  33. 2
      Sources/Tools/MaxComponent/plNotetrackAnim.cpp
  34. 2
      Sources/Tools/MaxComponent/plResponderMtl.cpp
  35. 4
      Sources/Tools/MaxConvert/hsMaterialConverter.cpp
  36. 2
      Sources/Tools/MaxConvert/plLightMapGen.cpp
  37. 3
      Sources/Tools/MaxExport/SimpleExport.cpp
  38. 2
      Sources/Tools/MaxExport/plExportDlg.cpp
  39. 4
      Sources/Tools/MaxMain/plComponentDlg.cpp
  40. 2
      Sources/Tools/MaxMain/plMaxNode.cpp
  41. 2
      Sources/Tools/plShaderAssembler/main.cpp

4
Sources/Plasma/CoreLib/hsBounds.cpp

@ -1493,7 +1493,6 @@ bool hsBounds3Ext::ISectBB(const hsBounds3Ext &other, const hsVector3 &myVel, hs
if( !(other.fExtFlags & (kDistsSet|kAxisAligned)) ) if( !(other.fExtFlags & (kDistsSet|kAxisAligned)) )
other.IMakeDists(); other.IMakeDists();
const float kRealBig = 1.e30f;
float tstDepths[9]; float tstDepths[9];
hsVector3 tstAxes[9]; hsVector3 tstAxes[9];
float totDepth = 0; float totDepth = 0;
@ -1644,9 +1643,6 @@ bool hsBounds3Ext::ISectBB(const hsBounds3Ext &other, const hsVector3 &myVel, hs
bool hsBounds3Ext::ISectABB(const hsBounds3Ext &other, const hsVector3 &myVel) const bool hsBounds3Ext::ISectABB(const hsBounds3Ext &other, const hsVector3 &myVel) const
{ {
hsPoint3 effMaxs = fMaxs;
hsPoint3 effMins = fMins;
int i; int i;
for( i = 0; i < 3; i++ ) for( i = 0; i < 3; i++ )
{ {

2
Sources/Plasma/CoreLib/hsMatrix44.cpp

@ -348,6 +348,8 @@ hsMatrix44& hsMatrix44::SetRotate(int axis, float radians)
c1 = 0; c1 = 0;
c2 = 1; c2 = 1;
break; break;
default:
hsAssert(false, "Invalid rotation axis specified");
} }
fMap[c1][c1] = c; fMap[c1][c1] = c;
fMap[c2][c2] = c; fMap[c2][c2] = c;

14
Sources/Plasma/CoreLib/hsStream.cpp

@ -369,8 +369,8 @@ bool hsStream::GetToken(char *s, uint32_t maxLen, const char beginComment, const
while( true ) while( true )
{ {
while( !AtEnd() && IsTokenSeparator(c = ReadByte()) ) while( !AtEnd() && IsTokenSeparator(c = ReadByte()) )
c = c; /* empty */;
;
if( AtEnd() ) if( AtEnd() )
return false; return false;
@ -379,8 +379,7 @@ bool hsStream::GetToken(char *s, uint32_t maxLen, const char beginComment, const
// skip to end of comment // skip to end of comment
while( !AtEnd() && (endCom != (c = ReadByte())) ) while( !AtEnd() && (endCom != (c = ReadByte())) )
c= c; /* empty */;
;
} }
s[0] = c; s[0] = c;
@ -419,8 +418,8 @@ bool hsStream::ReadLn(char *s, uint32_t maxLen, const char beginComment, const c
while( true ) while( true )
{ {
while( !AtEnd() && strchr("\r\n",c = ReadByte()) ) while( !AtEnd() && strchr("\r\n",c = ReadByte()) )
c = c; /* empty */;
;
if( AtEnd() ) if( AtEnd() )
return false; return false;
@ -429,8 +428,7 @@ bool hsStream::ReadLn(char *s, uint32_t maxLen, const char beginComment, const c
// skip to end of comment // skip to end of comment
while( !AtEnd() && (endCom != (c = ReadByte())) ) while( !AtEnd() && (endCom != (c = ReadByte())) )
c= c; /* empty */;
;
} }
s[0] = c; s[0] = c;

1
Sources/Plasma/FeatureLib/pfCharacter/pfMarkerInfo.cpp

@ -97,7 +97,6 @@ void pfMarkerInfo::Spawn(MarkerType type)
{ {
if (!fMarkerUoid.IsValid()) if (!fMarkerUoid.IsValid())
{ {
plResManager* resMgr = (plResManager*)hsgResMgr::ResMgr();
plLocation markerLoc = plKeyFinder::Instance().FindLocation("GlobalMarkers", "Markers"); plLocation markerLoc = plKeyFinder::Instance().FindLocation("GlobalMarkers", "Markers");
if (markerLoc.IsValid()) if (markerLoc.IsValid())

4
Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleCmd.cpp

@ -428,8 +428,8 @@ void pfConsoleCmd::ICreateSignature(const char *paramList )
hsAssert( strlen( paramList ) < sizeof( params ), "Make the (#*$& params string larger!" ); hsAssert( strlen( paramList ) < sizeof( params ), "Make the (#*$& params string larger!" );
hsStrcpy( params, paramList ); hsStrcpy( params, paramList );
fSignature.Empty(); fSignature.Reset();
fSigLabels.Empty(); fSigLabels.Reset();
/// Loop through all the types given in the list /// Loop through all the types given in the list
ptr = params; ptr = params;

1
Sources/Plasma/FeatureLib/pfPython/cyAvatar.cpp

@ -972,7 +972,6 @@ std::vector<PyObject*> cyAvatar::GetAllWithSameMesh(const plString& clothing_nam
PyObject* cyAvatar::GetMatchingClothingItem(const plString& clothing_name) PyObject* cyAvatar::GetMatchingClothingItem(const plString& clothing_name)
{ {
// Get all the clothes that we can wear // Get all the clothes that we can wear
hsTArray<plClothingItem*> clothingList;
plClothingItem* match = plClothingMgr::GetClothingMgr()->GetLRMatch(plClothingMgr::GetClothingMgr()->FindItemByName(clothing_name)); plClothingItem* match = plClothingMgr::GetClothingMgr()->GetLRMatch(plClothingMgr::GetClothingMgr()->FindItemByName(clothing_name));
if ( match ) if ( match )
{ {

2
Sources/Plasma/FeatureLib/pfPython/pyGameScoreGlue.cpp

@ -133,7 +133,7 @@ PYTHON_METHOD_DEFINITION(ptGameScore, setPoints, args)
{ {
int32_t numPoints = 0; int32_t numPoints = 0;
PyObject* keyObj = nil; PyObject* keyObj = nil;
if (!PyArg_ParseTuple(args, "i|O", &numPoints)) if (!PyArg_ParseTuple(args, "i|O", &numPoints, &keyObj))
{ {
PyErr_SetString(PyExc_TypeError, "setPoints expects an int and an optional ptKey"); PyErr_SetString(PyExc_TypeError, "setPoints expects an int and an optional ptKey");
PYTHON_RETURN_ERROR; PYTHON_RETURN_ERROR;

2
Sources/Plasma/FeatureLib/pfPython/pyVaultNode.cpp

@ -83,7 +83,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
static void CDECL LogDumpProc ( static void CDECL LogDumpProc (
void * , void * ,
const wchar_t fmt[], const wchar_t *fmt,
... ...
) { ) {
va_list args; va_list args;

6
Sources/Plasma/NucleusLib/inc/plProfileManager.cpp

@ -237,12 +237,12 @@ void plProfileBase::IPrintValue(uint64_t value, char* buf, bool printType)
if (value > (1024*1000)) if (value > (1024*1000))
sprintf(buf, "%.2f MB", float(value) / (1024.f * 1024.f)); sprintf(buf, "%.2f MB", float(value) / (1024.f * 1024.f));
else if (value > 1024) else if (value > 1024)
sprintf(buf, "%d KB", value / 1024); sprintf(buf, "%llu KB", value / 1024);
else else
sprintf(buf, "%d b", value); sprintf(buf, "%llu b", value);
} }
else else
sprintf(buf, "%u", value); sprintf(buf, "%llu", value);
} }
} }

12
Sources/Plasma/NucleusLib/pnAsyncCore/Private/pnAcLog.cpp

@ -56,7 +56,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
***/ ***/
//=========================================================================== //===========================================================================
void CDECL LogMsg (ELogSeverity severity, const char format[], ...) { void CDECL LogMsg (ELogSeverity severity, const char *format, ...) {
ASSERT(format); ASSERT(format);
va_list args; va_list args;
@ -66,7 +66,7 @@ void CDECL LogMsg (ELogSeverity severity, const char format[], ...) {
} }
//=========================================================================== //===========================================================================
void CDECL LogMsg (ELogSeverity severity, const wchar_t format[], ...) { void CDECL LogMsg (ELogSeverity severity, const wchar_t *format, ...) {
ASSERT(format); ASSERT(format);
va_list args; va_list args;
@ -76,7 +76,7 @@ void CDECL LogMsg (ELogSeverity severity, const wchar_t format[], ...) {
} }
//=========================================================================== //===========================================================================
void LogMsgV (ELogSeverity severity, const char format[], va_list args) { void LogMsgV (ELogSeverity severity, const char *format, va_list args) {
ASSERT(format); ASSERT(format);
char msg[1024]; char msg[1024];
@ -86,7 +86,7 @@ void LogMsgV (ELogSeverity severity, const char format[], va_list args) {
} }
//=========================================================================== //===========================================================================
void LogMsgV (ELogSeverity severity, const wchar_t format[], va_list args) { void LogMsgV (ELogSeverity severity, const wchar_t *format, va_list args) {
ASSERT(format); ASSERT(format);
ASSERT(args); ASSERT(args);
@ -100,7 +100,7 @@ void LogMsgV (ELogSeverity severity, const wchar_t format[], va_list args) {
//============================================================================ //============================================================================
#ifdef HS_DEBUGGING #ifdef HS_DEBUGGING
void LogMsgDebug (const char format[], ...) { void LogMsgDebug (const char *format, ...) {
ASSERT(format); ASSERT(format);
va_list args; va_list args;
@ -112,7 +112,7 @@ void LogMsgDebug (const char format[], ...) {
//============================================================================ //============================================================================
#ifdef HS_DEBUGGING #ifdef HS_DEBUGGING
void LogMsgDebug (const wchar_t format[], ...) { void LogMsgDebug (const wchar_t *format, ...) {
ASSERT(format); ASSERT(format);
va_list args; va_list args;

14
Sources/Plasma/NucleusLib/pnAsyncCore/Private/pnAcLog.h

@ -76,10 +76,10 @@ enum ELogSeverity {
kNumLogSeverity kNumLogSeverity
}; };
void LogMsg (ELogSeverity severity, const char format[], ...); void LogMsg (ELogSeverity severity, const char *format, ...);
void LogMsg (ELogSeverity severity, const wchar_t format[], ...); void LogMsg (ELogSeverity severity, const wchar_t *format, ...);
void LogMsgV (ELogSeverity severity, const char format[], va_list args); void LogMsgV (ELogSeverity severity, const char *format, va_list args);
void LogMsgV (ELogSeverity severity, const wchar_t format[], va_list args); void LogMsgV (ELogSeverity severity, const wchar_t *format, va_list args);
/**************************************************************************** /****************************************************************************
* *
@ -89,12 +89,12 @@ void LogMsgV (ELogSeverity severity, const wchar_t format[], va_list args);
#ifdef HS_DEBUGGING #ifdef HS_DEBUGGING
void LogMsgDebug (const char format[], ...); void LogMsgDebug (const char *format, ...);
void LogMsgDebug (const wchar_t format[], ...); void LogMsgDebug (const wchar_t *format, ...);
#else #else
inline void LogMsgDebug (const char *, ...) { } inline void LogMsgDebug (const char *, ...) { }
inline void LogMsgDebug (const wchar_t *, ...) { } inline void LogMsgDebug (const wchar_t *, ...) { }
#endif #endif

4
Sources/Plasma/NucleusLib/pnMessage/plNotifyMsg.cpp

@ -147,6 +147,7 @@ void plNotifyMsg::AddEvent( proEventData* ed )
proCoopEventData *evt = (proCoopEventData *)ed; proCoopEventData *evt = (proCoopEventData *)ed;
AddCoopEvent( evt->fID, evt->fSerial); AddCoopEvent( evt->fID, evt->fSerial);
} }
break;
case proEventData::kControlKey: case proEventData::kControlKey:
{ {
@ -200,16 +201,19 @@ void plNotifyMsg::AddEvent( proEventData* ed )
proOfferLinkingBookEventData* evt = (proOfferLinkingBookEventData*)ed; proOfferLinkingBookEventData* evt = (proOfferLinkingBookEventData*)ed;
AddOfferBookEvent(evt->offerer, evt->targetAge, evt->offeree); AddOfferBookEvent(evt->offerer, evt->targetAge, evt->offeree);
} }
break;
case proEventData::kBook: case proEventData::kBook:
{ {
proBookEventData* evt = (proBookEventData*)ed; proBookEventData* evt = (proBookEventData*)ed;
AddBookEvent( evt->fEvent, evt->fLinkID ); AddBookEvent( evt->fEvent, evt->fLinkID );
} }
break;
case proEventData::kClimbingBlockerHit: case proEventData::kClimbingBlockerHit:
{ {
proClimbingBlockerHitEventData* evt = (proClimbingBlockerHitEventData*)ed; proClimbingBlockerHitEventData* evt = (proClimbingBlockerHitEventData*)ed;
AddHitClimbingBlockerEvent(evt->fBlockerKey); AddHitClimbingBlockerEvent(evt->fBlockerKey);
} }
break;
} }
} }

2
Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.cpp

@ -260,7 +260,7 @@ unsigned NetGameRank::Read(const uint8_t inbuffer[], unsigned bufsz, uint8_t** e
IReadString(&tempstr, &buffer, &bufsz); IReadString(&tempstr, &buffer, &bufsz);
StrCopy(name, tempstr, arrsize(name)); StrCopy(name, tempstr, arrsize(name));
delete tempstr; free(tempstr);
if (end) if (end)
*end = buffer; *end = buffer;

1
Sources/Plasma/NucleusLib/pnTimer/plTimerCallbackManager.cpp

@ -120,7 +120,6 @@ bool plTimerCallbackManager::CancelCallback(plTimerCallback* pTimer)
bool plTimerCallbackManager::CancelCallbacksToKey(const plKey& key) bool plTimerCallbackManager::CancelCallbacksToKey(const plKey& key)
{ {
const plKey rKey;
bool removed = false; bool removed = false;
for (int i = fCallbacks.Count() - 1; i >= 0 ; i--) for (int i = fCallbacks.Count() - 1; i >= 0 ; i--)

2
Sources/Plasma/PubUtilLib/plAnimation/plMatrixChannel.cpp

@ -903,7 +903,7 @@ bool CompareMatrices2(const hsMatrix44 &matA, const hsMatrix44 &matB, float tole
bool c32 = fabs(matA.fMap[3][2] - matB.fMap[3][2]) < tolerance; bool c32 = fabs(matA.fMap[3][2] - matB.fMap[3][2]) < tolerance;
bool c33 = fabs(matA.fMap[3][3] - matB.fMap[3][3]) < tolerance; bool c33 = fabs(matA.fMap[3][3] - matB.fMap[3][3]) < tolerance;
return c00 && c01 && c02 && c03 && c11 && c12 && c13 && c20 && c21 && c22 && c23 && c30 && c31 && c32 && c33; return c00 && c01 && c02 && c03 && c10 && c11 && c12 && c13 && c20 && c21 && c22 && c23 && c30 && c31 && c32 && c33;
} }
// IAPPLY // IAPPLY

11
Sources/Plasma/PubUtilLib/plAudio/plDSoundBuffer.cpp

@ -283,7 +283,7 @@ bool plDSoundBuffer::SetupStreamingSource(plAudioFileReader *stream)
alSourcef(source, AL_ROLLOFF_FACTOR, 0.3048); alSourcef(source, AL_ROLLOFF_FACTOR, 0.3048);
alGetError(); error = alGetError();
if( error != AL_NO_ERROR ) if( error != AL_NO_ERROR )
{ {
return false; return false;
@ -348,7 +348,7 @@ bool plDSoundBuffer::SetupStreamingSource(void *data, unsigned bytes)
SetScalarVolume(0); SetScalarVolume(0);
alSourcef(source, AL_ROLLOFF_FACTOR, 0.3048); alSourcef(source, AL_ROLLOFF_FACTOR, 0.3048);
alGetError(); error = alGetError();
if( error != AL_NO_ERROR ) if( error != AL_NO_ERROR )
{ {
return false; return false;
@ -478,8 +478,7 @@ bool plDSoundBuffer::GetAvailableBufferId(unsigned *bufferId)
bool plDSoundBuffer::SetupVoiceSource() bool plDSoundBuffer::SetupVoiceSource()
{ {
ALenum error; ALenum error = alGetError();
alGetError();
// Generate AL Buffers // Generate AL Buffers
alGenBuffers( STREAMING_BUFFERS, streamingBuffers ); alGenBuffers( STREAMING_BUFFERS, streamingBuffers );
@ -507,13 +506,13 @@ bool plDSoundBuffer::SetupVoiceSource()
SetScalarVolume(0); SetScalarVolume(0);
alSourcef(source, AL_ROLLOFF_FACTOR, 0.3048); alSourcef(source, AL_ROLLOFF_FACTOR, 0.3048);
alGetError(); error = alGetError();
if( error != AL_NO_ERROR ) if( error != AL_NO_ERROR )
{ {
return false; return false;
} }
alSourcei(source, AL_BUFFER, 0); alSourcei(source, AL_BUFFER, 0);
alGetError(); error = alGetError();
//alSourcei(source, AL_PITCH, 0); //alSourcei(source, AL_PITCH, 0);
// dont queue any buffers here // dont queue any buffers here

2
Sources/Plasma/PubUtilLib/plAudio/plWin32StreamingSound.cpp

@ -177,8 +177,6 @@ plSoundBuffer::ELoadReturnVal plWin32StreamingSound::IPreLoadBuffer( bool playWh
{ {
plAudioCore::ChannelSelect select = buffer->GetReaderSelect(); plAudioCore::ChannelSelect select = buffer->GetReaderSelect();
bool streamCompressed = (buffer->HasFlag(plSoundBuffer::kStreamCompressed) != 0);
/// Open da file /// Open da file
plFileName strPath = plFileSystem::GetCWD(); plFileName strPath = plFileSystem::GetCWD();

17
Sources/Plasma/PubUtilLib/plAudioCore/plWavFile.cpp

@ -89,8 +89,7 @@ CWaveFile::~CWaveFile()
if( !m_bIsReadingFromMemory ) if( !m_bIsReadingFromMemory )
{ {
delete[] m_pwfx; free(m_pwfx);
} }
int i; int i;
@ -127,7 +126,7 @@ HRESULT CWaveFile::Open(const char *strFileName, WAVEFORMATEX* pwfx, DWORD dwFla
{ {
if( strFileName == NULL ) if( strFileName == NULL )
return E_INVALIDARG; return E_INVALIDARG;
delete[] m_pwfx; free(m_pwfx);
#ifdef UNICODE #ifdef UNICODE
m_hmmio = mmioOpen( (wchar_t*)wFileName.c_str(), NULL, MMIO_ALLOCBUF | MMIO_READ ); m_hmmio = mmioOpen( (wchar_t*)wFileName.c_str(), NULL, MMIO_ALLOCBUF | MMIO_READ );
@ -356,7 +355,7 @@ HRESULT CWaveFile::ReadMMIO()
// uint16_t, and thats how many extra bytes to allocate. // uint16_t, and thats how many extra bytes to allocate.
if( pcmWaveFormat.wf.wFormatTag == WAVE_FORMAT_PCM ) if( pcmWaveFormat.wf.wFormatTag == WAVE_FORMAT_PCM )
{ {
m_pwfx = (WAVEFORMATEX*)( new CHAR[ sizeof( WAVEFORMATEX ) ] ); m_pwfx = (WAVEFORMATEX*)malloc(sizeof(WAVEFORMATEX));
if( NULL == m_pwfx ) if( NULL == m_pwfx )
return DXTRACE_ERR( TEXT("m_pwfx"), E_FAIL ); return DXTRACE_ERR( TEXT("m_pwfx"), E_FAIL );
@ -371,7 +370,7 @@ HRESULT CWaveFile::ReadMMIO()
if( mmioRead( m_hmmio, (CHAR*)&cbExtraBytes, sizeof(WORD)) != sizeof(WORD) ) if( mmioRead( m_hmmio, (CHAR*)&cbExtraBytes, sizeof(WORD)) != sizeof(WORD) )
return DXTRACE_ERR( TEXT("mmioRead"), E_FAIL ); return DXTRACE_ERR( TEXT("mmioRead"), E_FAIL );
m_pwfx = (WAVEFORMATEX*)( new CHAR[ sizeof(WAVEFORMATEX) + cbExtraBytes ] ); m_pwfx = (WAVEFORMATEX*)malloc(sizeof(WAVEFORMATEX) + cbExtraBytes);
if( NULL == m_pwfx ) if( NULL == m_pwfx )
return DXTRACE_ERR( TEXT("new"), E_FAIL ); return DXTRACE_ERR( TEXT("new"), E_FAIL );
@ -383,7 +382,7 @@ HRESULT CWaveFile::ReadMMIO()
if( mmioRead( m_hmmio, (CHAR*)(((BYTE*)&(m_pwfx->cbSize))+sizeof(WORD)), if( mmioRead( m_hmmio, (CHAR*)(((BYTE*)&(m_pwfx->cbSize))+sizeof(WORD)),
cbExtraBytes ) != cbExtraBytes ) cbExtraBytes ) != cbExtraBytes )
{ {
delete m_pwfx; free(m_pwfx);
return DXTRACE_ERR( TEXT("mmioRead"), E_FAIL ); return DXTRACE_ERR( TEXT("mmioRead"), E_FAIL );
} }
} }
@ -396,7 +395,7 @@ HRESULT CWaveFile::ReadMMIO()
// Ascend the input file out of the 'fmt ' chunk. // Ascend the input file out of the 'fmt ' chunk.
if( 0 != mmioAscend( m_hmmio, &ckIn, 0 ) ) if( 0 != mmioAscend( m_hmmio, &ckIn, 0 ) )
{ {
delete m_pwfx; free(m_pwfx);
return DXTRACE_ERR( TEXT("mmioAscend"), E_FAIL ); return DXTRACE_ERR( TEXT("mmioAscend"), E_FAIL );
} }
@ -440,7 +439,7 @@ HRESULT CWaveFile::ReadMMIO()
if( 0 != mmioAscend( m_hmmio, &ckIn, 0 ) ) if( 0 != mmioAscend( m_hmmio, &ckIn, 0 ) )
{ {
delete m_pwfx; free(m_pwfx);
return DXTRACE_ERR( TEXT("mmioAscend"), E_FAIL ); return DXTRACE_ERR( TEXT("mmioAscend"), E_FAIL );
} }
@ -499,7 +498,7 @@ HRESULT CWaveFile::ReadMMIO()
if( 0 != mmioAscend( m_hmmio, &ckIn, 0 ) ) if( 0 != mmioAscend( m_hmmio, &ckIn, 0 ) )
{ {
delete m_pwfx; free(m_pwfx);
return DXTRACE_ERR( TEXT("mmioAscend"), E_FAIL ); return DXTRACE_ERR( TEXT("mmioAscend"), E_FAIL );
} }

2
Sources/Plasma/PubUtilLib/plAvatar/plArmatureMod.cpp

@ -150,8 +150,6 @@ plArmatureModBase::~plArmatureModBase()
bool plArmatureModBase::MsgReceive(plMessage* msg) bool plArmatureModBase::MsgReceive(plMessage* msg)
{ {
bool result = false;
plArmatureBrain *curBrain = nil; plArmatureBrain *curBrain = nil;
if (fBrains.size() > 0) if (fBrains.size() > 0)
{ {

1
Sources/Plasma/PubUtilLib/plAvatar/plSwimRegion.cpp

@ -152,7 +152,6 @@ void plSwimCircularCurrentRegion::GetCurrent(plPhysicalControllerCore *physical,
physical->GetPositionSim(pos); physical->GetPositionSim(pos);
bool applyPull = true;
hsVector3 pos2Center(center.fX - pos.fX, center.fY - pos.fY, 0.f); hsVector3 pos2Center(center.fX - pos.fX, center.fY - pos.fY, 0.f);
float pullVel; float pullVel;
float distSq = pos2Center.MagnitudeSquared(); float distSq = pos2Center.MagnitudeSquared();

1
Sources/Plasma/PubUtilLib/plDrawable/plDrawableSpans.cpp

@ -1967,7 +1967,6 @@ void plDrawableSpans::SortVisibleSpans(const hsTArray<int16_t>& visList, plPipel
memset(newStarts, 0, kMaxBufferGroups * kMaxIndexBuffers * sizeof(int16_t)); memset(newStarts, 0, kMaxBufferGroups * kMaxIndexBuffers * sizeof(int16_t));
uint32_t start = 0;
for( i = 0; i < visList.GetCount(); i++ ) for( i = 0; i < visList.GetCount(); i++ )
{ {
plIcicle* span = (plIcicle*)fSpans[visList[i]]; plIcicle* span = (plIcicle*)fSpans[visList[i]];

4
Sources/Plasma/PubUtilLib/plDrawable/plDynaDecalMgr.cpp

@ -1450,9 +1450,7 @@ bool plDynaDecalMgr::ICutoutObject(plSceneObject* so, double secs)
return retVal; return retVal;
plProfile_BeginTiming(Total); plProfile_BeginTiming(Total);
int numGot = 0; for (int j = 0; j < di->GetNumDrawables(); j++)
int j;
for( j = 0; j < di->GetNumDrawables(); j++ )
{ {
plDrawableSpans* dr = plDrawableSpans::ConvertNoRef(di->GetDrawable(j)); plDrawableSpans* dr = plDrawableSpans::ConvertNoRef(di->GetDrawable(j));
// Nil dr - it hasn't loaded yet or something. // Nil dr - it hasn't loaded yet or something.

2
Sources/Plasma/PubUtilLib/plDrawable/plSpanInstance.h

@ -171,7 +171,7 @@ public:
} }
static uint16_t ColStrideFromEncoding(const plSpanEncoding& encoding) static uint16_t ColStrideFromEncoding(const plSpanEncoding& encoding)
{ {
switch(encoding.fCode & plSpanEncoding::kPosMask) switch(encoding.fCode & plSpanEncoding::kColMask)
{ {
case plSpanEncoding::kColNone: case plSpanEncoding::kColNone:
return 0; return 0;

4
Sources/Plasma/PubUtilLib/plGImage/plDynamicTextMap.cpp

@ -331,14 +331,14 @@ void plDynamicTextMap::SetInitBuffer( uint32_t *buffer )
//// CopyFrom ///////////////////////////////////////////////////////////////// //// CopyFrom /////////////////////////////////////////////////////////////////
void plDynamicTextMap::CopyFrom( plMipmap *source ) void plDynamicTextMap::CopyFrom(const plMipmap *source)
{ {
hsAssert( false, "Copying plDynamicTextMaps is not supported." ); hsAssert( false, "Copying plDynamicTextMaps is not supported." );
} }
//// Clone //////////////////////////////////////////////////////////////////// //// Clone ////////////////////////////////////////////////////////////////////
plMipmap *plDynamicTextMap::Clone( void ) plMipmap *plDynamicTextMap::Clone() const
{ {
static bool alreadyWarned = false; static bool alreadyWarned = false;

6
Sources/Plasma/PubUtilLib/plGImage/plDynamicTextMap.h

@ -130,9 +130,9 @@ class plDynamicTextMap : public plMipmap
virtual uint8_t GetNumLevels( void ) const { return 1; } virtual uint8_t GetNumLevels( void ) const { return 1; }
virtual void Colorize( void ) { ; } void Colorize() override { }
virtual plMipmap *Clone( void ); plMipmap *Clone() const override;
virtual void CopyFrom( plMipmap *source ); void CopyFrom(const plMipmap *source) override;
/// Operations to perform on the text block /// Operations to perform on the text block

1
Sources/Plasma/PubUtilLib/plInputCore/plAvatarInputInterface.cpp

@ -471,6 +471,7 @@ bool plAvatarInputInterface::IHandleCtrlCmd( plCtrlCmd *cmd )
fCurrentCursor = kCursorHidden; fCurrentCursor = kCursorHidden;
else else
fCurrentCursor = kCursorUp; fCurrentCursor = kCursorUp;
return true;
case S_SET_LADDER_CONTROL: case S_SET_LADDER_CONTROL:
if( cmd->fControlActivated ) if( cmd->fControlActivated )
ISetLadderMap(); ISetLadderMap();

1
Sources/Plasma/PubUtilLib/plPhysical/plPhysicsSoundMgr.cpp

@ -149,7 +149,6 @@ void plPhysicsSoundMgr::IStopCollision(const CollidePair& cp)
void plPhysicsSoundMgr::IUpdateCollision(const CollidePair& cp) void plPhysicsSoundMgr::IUpdateCollision(const CollidePair& cp)
{ {
const float slideThreshhold = 0.f;
hsVector3 v1, v2; hsVector3 v1, v2;
plPhysical* physicalA = cp.FirstPhysical(); plPhysical* physicalA = cp.FirstPhysical();
plPhysical* physicalB = cp.SecondPhysical(); plPhysical* physicalB = cp.SecondPhysical();

4
Sources/Plasma/PubUtilLib/plPipeline/plCubicRenderTargetModifier.cpp

@ -127,8 +127,6 @@ void plCubicRenderTargetModifier::ICreateRenderRequest( int face )
bool plCubicRenderTargetModifier::IEval( double secs, float del, uint32_t dirty ) bool plCubicRenderTargetModifier::IEval( double secs, float del, uint32_t dirty )
{ {
hsPoint3 center; hsPoint3 center;
hsMatrix44 mtx, invMtx;
int i;
plRenderRequestMsg *msg; plRenderRequestMsg *msg;
@ -150,7 +148,7 @@ bool plCubicRenderTargetModifier::IEval( double secs, float del, uint32_t dir
fCubic->SetCameraMatrix(center); fCubic->SetCameraMatrix(center);
/// Submit render requests! /// Submit render requests!
for( i = 0; i < 6; i++ ) for (int i = 0; i < 6; i++)
{ {
if( fRequests[ i ] != nil ) if( fRequests[ i ] != nil )
{ {

2
Sources/Plasma/PubUtilLib/plSDL/plStateDataRecord.cpp

@ -838,7 +838,7 @@ void plStateDataRecord::TimeStampDirtyVars()
// set nested vars // set nested vars
for(i=0;i<fSDVarsList.size(); i++) for(i=0;i<fSDVarsList.size(); i++)
{ {
if ( fVarsList[i]->IsDirty() ) if ( fSDVarsList[i]->IsDirty() )
fSDVarsList[i]->TimeStamp(); fSDVarsList[i]->TimeStamp();
} }
} }

2
Sources/Plasma/PubUtilLib/plSDL/plStateVariable.cpp

@ -840,6 +840,7 @@ bool plSimpleStateVariable::IConvertFromShort(plVarDescriptor::Type newType)
delete [] fS; delete [] fS;
fI = newI; fI = newI;
} }
break;
case plVarDescriptor::kByte: case plVarDescriptor::kByte:
{ {
uint8_t* newBy = new uint8_t[fVar.GetCount()]; uint8_t* newBy = new uint8_t[fVar.GetCount()];
@ -898,6 +899,7 @@ bool plSimpleStateVariable::IConvertFromByte(plVarDescriptor::Type newType)
delete [] fBy; delete [] fBy;
fI = newI; fI = newI;
} }
break;
case plVarDescriptor::kShort: case plVarDescriptor::kShort:
{ {
short* newS = new short[fVar.GetCount()]; short* newS = new short[fVar.GetCount()];

1
Sources/Plasma/PubUtilLib/plVault/plVaultClientApi.cpp

@ -1902,7 +1902,6 @@ hsRef<RelVaultNode> VaultCreateNodeAndWait (
plVault::NodeTypes nodeType, plVault::NodeTypes nodeType,
ENetError * result ENetError * result
) { ) {
hsRef<RelVaultNode> node;
hsRef<RelVaultNode> templateNode = new RelVaultNode; hsRef<RelVaultNode> templateNode = new RelVaultNode;
templateNode->SetNodeType(nodeType); templateNode->SetNodeType(nodeType);

4
Sources/Tools/MaxComponent/plGUIComponents.cpp

@ -3629,10 +3629,6 @@ public:
bool PreConvert(plMaxNode *pNode, plErrorMsg *pErrMsg); bool PreConvert(plMaxNode *pNode, plErrorMsg *pErrMsg);
bool Convert(plMaxNode *node, plErrorMsg *pErrMsg); bool Convert(plMaxNode *node, plErrorMsg *pErrMsg);
enum
{
};
}; };
//Max desc stuff necessary below. //Max desc stuff necessary below.

2
Sources/Tools/MaxComponent/plNotetrackAnim.cpp

@ -110,8 +110,6 @@ plAnimInfo plNotetrackAnim::GetAnimInfo(const plString &animName)
return plAnimInfo(fSegMap, plString::Null); return plAnimInfo(fSegMap, plString::Null);
else else
return plAnimInfo(fSegMap, animName); return plAnimInfo(fSegMap, animName);
return plAnimInfo();
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

2
Sources/Tools/MaxComponent/plResponderMtl.cpp

@ -233,7 +233,7 @@ const char *plResponderCmdMtl::GetInstanceName(IParamBlock2 *pb)
const char *shortName = GetShortName(pb->GetInt(kMtlType)); const char *shortName = GetShortName(pb->GetInt(kMtlType));
Mtl *mtl = (Mtl*)pb->GetReferenceTarget(kMtlRef); Mtl *mtl = (Mtl*)pb->GetReferenceTarget(kMtlRef);
sprintf(name, "%s (%s)", shortName, mtl ? mtl->GetName() : "none"); sprintf(name, "%s (%s)", shortName, mtl ? (const char *)mtl->GetName() : "none");
return name; return name;
} }

4
Sources/Tools/MaxConvert/hsMaterialConverter.cpp

@ -4858,7 +4858,9 @@ void hsMaterialConverter::IPrintDoneMat(hsStream* stream, const char* prefix, Do
stream->WriteString(prefix); stream->WriteString(prefix);
char buff[512]; char buff[512];
sprintf(buff, "%s\n", doneMat->fMaxMaterial ? doneMat->fMaxMaterial->GetName() : "BLANK"); snprintf(buff, arrsize(buff), "%s\n",
doneMat->fMaxMaterial ? (const char *)doneMat->fMaxMaterial->GetName()
: "BLANK");
stream->WriteString(buff); stream->WriteString(buff);
sprintf(buff, "\t\t%d Layers\n", doneMat->fHsMaterial->GetNumLayers()); sprintf(buff, "\t\t%d Layers\n", doneMat->fHsMaterial->GetNumLayers());

2
Sources/Tools/MaxConvert/plLightMapGen.cpp

@ -1587,7 +1587,7 @@ bool plLightMapGen::ISelectBitmapDimension(plMaxNode* node, const hsMatrix44& l2
if( dvDr > 0 ) if( dvDr > 0 )
{ {
fHeight = (int)(kTexPerFoot / duDr); fHeight = (int)(kTexPerFoot / dvDr);
if( fHeight > kMaxSize ) if( fHeight > kMaxSize )
fHeight = kMaxSize; fHeight = kMaxSize;

3
Sources/Tools/MaxExport/SimpleExport.cpp

@ -368,7 +368,8 @@ int HSExport2::DoExport(const TCHAR *name,ExpInterface *ei,Interface *gi, BOOL s
dbLog.Open(name,"at"); dbLog.Open(name,"at");
char str[256]; char str[256];
exportTime = (timeGetTime() - exportTime) / 1000; exportTime = (timeGetTime() - exportTime) / 1000;
sprintf(str,"Export from Max File \"%s\" on %02d/%02d/%4d took %d:%02d\n",filename,tm.wMonth,tm.wDay,tm.wYear, exportTime/60, exportTime%60); snprintf(str, arrsize(str), "Export from Max File \"%s\" on %02d/%02d/%4d took %d:%02d\n",
(const char *)filename, tm.wMonth, tm.wDay, tm.wYear, exportTime/60, exportTime%60);
dbLog.WriteString(str); dbLog.WriteString(str);
dbLog.Close(); dbLog.Close();

2
Sources/Tools/MaxExport/plExportDlg.cpp

@ -489,7 +489,7 @@ void plExportDlgImp::StartAutoExport()
char outputDir[MAX_PATH]; char outputDir[MAX_PATH];
GetPrivateProfileString("Settings", "MaxOutputDir", "", outputDir, sizeof(outputDir), configFile); GetPrivateProfileString("Settings", "MaxOutputDir", "", outputDir, sizeof(outputDir), configFile);
if (inputDir[0] == '\0' || outputDir == '\0') if (inputDir[0] == '\0' || outputDir[0] == '\0')
return; return;
fAutoExporting = true; fAutoExporting = true;

4
Sources/Tools/MaxMain/plComponentDlg.cpp

@ -174,8 +174,8 @@ void plComponentDlg::IPositionControl(HWND hControl, int hDiff, int wDiff, int f
RECT rect; RECT rect;
GetWindowRect(hControl, &rect); GetWindowRect(hControl, &rect);
hsAssert(!((flags & kMoveX) & (flags & kResizeX)), "Moving AND resizing in X in IPositionControl"); hsAssert(!((flags & kMoveX) && (flags & kResizeX)), "Moving AND resizing in X in IPositionControl");
hsAssert(!((flags & kMoveY) & (flags & kResizeY)), "Moving AND resizing in Y in IPositionControl"); hsAssert(!((flags & kMoveY) && (flags & kResizeY)), "Moving AND resizing in Y in IPositionControl");
if (flags & kMoveX || flags & kMoveY) if (flags & kMoveX || flags & kMoveY)
{ {

2
Sources/Tools/MaxMain/plMaxNode.cpp

@ -2869,7 +2869,7 @@ bool plMaxNode::IGetProjection(plLightInfo* li, plErrorMsg* pErrMsg)
{ {
char buff[256]; char buff[256];
if( projMap && projMap->GetName() && *projMap->GetName() ) if( projMap && projMap->GetName() && *projMap->GetName() )
sprintf(buff, "Can't find projected bitmap - %s", projMap->GetName()); sprintf(buff, "Can't find projected bitmap - %s", (const char *)projMap->GetName());
else else
sprintf(buff, "Can't find projected bitmap - <unknown>"); sprintf(buff, "Can't find projected bitmap - <unknown>");
if( pErrMsg->Set(!(convert.fWarned & plConvert::kWarnedMissingProj), GetName(), if( pErrMsg->Set(!(convert.fWarned & plConvert::kWarnedMissingProj), GetName(),

2
Sources/Tools/plShaderAssembler/main.cpp

@ -54,7 +54,7 @@ int main(int argc, char* argv[])
// vs_ => "vs_ // vs_ => "vs_
// ps_ => "ps_ // ps_ => "ps_
// , => ", // , => ",
const char* kEnumNames[] = { static const char* kEnumNames[] = {
"vs_WaveFixedFin6", "vs_WaveFixedFin6",
"ps_WaveFixed", "ps_WaveFixed",
"vs_CompCosines", "vs_CompCosines",

Loading…
Cancel
Save