mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-17 18:59:09 +00:00
Fix some legitimate bugs found by Coverity which MAY IMPACT BEHAVIOR!
This commit is contained in:
@ -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;
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
@ -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;
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
@ -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();
|
||||||
|
@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -839,6 +839,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()];
|
||||||
@ -897,6 +898,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()];
|
||||||
|
@ -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;
|
||||||
|
@ -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;
|
||||||
|
@ -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)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user