mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-17 18:59:09 +00:00
Several "low-hanging fruit" Coverity fixes which shouldn't affect behavior
This commit is contained in:
@ -348,6 +348,8 @@ hsMatrix44& hsMatrix44::SetRotate(int axis, float radians)
|
||||
c1 = 0;
|
||||
c2 = 1;
|
||||
break;
|
||||
default:
|
||||
hsAssert(false, "Invalid rotation axis specified");
|
||||
}
|
||||
fMap[c1][c1] = c;
|
||||
fMap[c2][c2] = c;
|
||||
|
@ -133,7 +133,7 @@ PYTHON_METHOD_DEFINITION(ptGameScore, setPoints, args)
|
||||
{
|
||||
int32_t numPoints = 0;
|
||||
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");
|
||||
PYTHON_RETURN_ERROR;
|
||||
|
@ -83,7 +83,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
static void CDECL LogDumpProc (
|
||||
void * ,
|
||||
const wchar_t fmt[],
|
||||
const wchar_t *fmt,
|
||||
...
|
||||
) {
|
||||
va_list args;
|
||||
|
@ -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);
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
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(args);
|
||||
|
||||
@ -100,7 +100,7 @@ void LogMsgV (ELogSeverity severity, const wchar_t format[], va_list args) {
|
||||
|
||||
//============================================================================
|
||||
#ifdef HS_DEBUGGING
|
||||
void LogMsgDebug (const char format[], ...) {
|
||||
void LogMsgDebug (const char *format, ...) {
|
||||
ASSERT(format);
|
||||
|
||||
va_list args;
|
||||
@ -112,7 +112,7 @@ void LogMsgDebug (const char format[], ...) {
|
||||
|
||||
//============================================================================
|
||||
#ifdef HS_DEBUGGING
|
||||
void LogMsgDebug (const wchar_t format[], ...) {
|
||||
void LogMsgDebug (const wchar_t *format, ...) {
|
||||
ASSERT(format);
|
||||
|
||||
va_list args;
|
||||
|
@ -76,10 +76,10 @@ enum ELogSeverity {
|
||||
kNumLogSeverity
|
||||
};
|
||||
|
||||
void LogMsg (ELogSeverity severity, const char format[], ...);
|
||||
void LogMsg (ELogSeverity severity, const wchar_t format[], ...);
|
||||
void LogMsgV (ELogSeverity severity, const char format[], va_list args);
|
||||
void LogMsgV (ELogSeverity severity, const wchar_t format[], va_list args);
|
||||
void LogMsg (ELogSeverity severity, const char *format, ...);
|
||||
void LogMsg (ELogSeverity severity, const wchar_t *format, ...);
|
||||
void LogMsgV (ELogSeverity severity, const char *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
|
||||
|
||||
void LogMsgDebug (const char format[], ...);
|
||||
void LogMsgDebug (const wchar_t format[], ...);
|
||||
void LogMsgDebug (const char *format, ...);
|
||||
void LogMsgDebug (const wchar_t *format, ...);
|
||||
|
||||
#else
|
||||
|
||||
inline void LogMsgDebug (const char *, ...) { }
|
||||
inline void LogMsgDebug (const char *, ...) { }
|
||||
inline void LogMsgDebug (const wchar_t *, ...) { }
|
||||
|
||||
#endif
|
||||
|
@ -260,7 +260,7 @@ unsigned NetGameRank::Read(const uint8_t inbuffer[], unsigned bufsz, uint8_t** e
|
||||
IReadString(&tempstr, &buffer, &bufsz);
|
||||
|
||||
StrCopy(name, tempstr, arrsize(name));
|
||||
delete tempstr;
|
||||
free(tempstr);
|
||||
|
||||
if (end)
|
||||
*end = buffer;
|
||||
|
@ -89,8 +89,7 @@ CWaveFile::~CWaveFile()
|
||||
|
||||
if( !m_bIsReadingFromMemory )
|
||||
{
|
||||
delete[] m_pwfx;
|
||||
|
||||
free(m_pwfx);
|
||||
}
|
||||
|
||||
int i;
|
||||
@ -127,7 +126,7 @@ HRESULT CWaveFile::Open(const char *strFileName, WAVEFORMATEX* pwfx, DWORD dwFla
|
||||
{
|
||||
if( strFileName == NULL )
|
||||
return E_INVALIDARG;
|
||||
delete[] m_pwfx;
|
||||
free(m_pwfx);
|
||||
|
||||
#ifdef UNICODE
|
||||
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.
|
||||
if( pcmWaveFormat.wf.wFormatTag == WAVE_FORMAT_PCM )
|
||||
{
|
||||
m_pwfx = (WAVEFORMATEX*)( new CHAR[ sizeof( WAVEFORMATEX ) ] );
|
||||
m_pwfx = (WAVEFORMATEX*)malloc(sizeof(WAVEFORMATEX));
|
||||
if( NULL == m_pwfx )
|
||||
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) )
|
||||
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 )
|
||||
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)),
|
||||
cbExtraBytes ) != cbExtraBytes )
|
||||
{
|
||||
delete m_pwfx;
|
||||
free(m_pwfx);
|
||||
return DXTRACE_ERR( TEXT("mmioRead"), E_FAIL );
|
||||
}
|
||||
}
|
||||
@ -396,7 +395,7 @@ HRESULT CWaveFile::ReadMMIO()
|
||||
// Ascend the input file out of the 'fmt ' chunk.
|
||||
if( 0 != mmioAscend( m_hmmio, &ckIn, 0 ) )
|
||||
{
|
||||
delete m_pwfx;
|
||||
free(m_pwfx);
|
||||
return DXTRACE_ERR( TEXT("mmioAscend"), E_FAIL );
|
||||
}
|
||||
|
||||
@ -440,7 +439,7 @@ HRESULT CWaveFile::ReadMMIO()
|
||||
|
||||
if( 0 != mmioAscend( m_hmmio, &ckIn, 0 ) )
|
||||
{
|
||||
delete m_pwfx;
|
||||
free(m_pwfx);
|
||||
return DXTRACE_ERR( TEXT("mmioAscend"), E_FAIL );
|
||||
}
|
||||
|
||||
@ -499,7 +498,7 @@ HRESULT CWaveFile::ReadMMIO()
|
||||
|
||||
if( 0 != mmioAscend( m_hmmio, &ckIn, 0 ) )
|
||||
{
|
||||
delete m_pwfx;
|
||||
free(m_pwfx);
|
||||
return DXTRACE_ERR( TEXT("mmioAscend"), E_FAIL );
|
||||
}
|
||||
|
||||
|
@ -3629,10 +3629,6 @@ public:
|
||||
|
||||
bool PreConvert(plMaxNode *pNode, plErrorMsg *pErrMsg);
|
||||
bool Convert(plMaxNode *node, plErrorMsg *pErrMsg);
|
||||
|
||||
enum
|
||||
{
|
||||
};
|
||||
};
|
||||
|
||||
//Max desc stuff necessary below.
|
||||
|
@ -110,8 +110,6 @@ plAnimInfo plNotetrackAnim::GetAnimInfo(const plString &animName)
|
||||
return plAnimInfo(fSegMap, plString::Null);
|
||||
else
|
||||
return plAnimInfo(fSegMap, animName);
|
||||
|
||||
return plAnimInfo();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -233,7 +233,7 @@ const char *plResponderCmdMtl::GetInstanceName(IParamBlock2 *pb)
|
||||
const char *shortName = GetShortName(pb->GetInt(kMtlType));
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -4858,7 +4858,9 @@ void hsMaterialConverter::IPrintDoneMat(hsStream* stream, const char* prefix, Do
|
||||
stream->WriteString(prefix);
|
||||
|
||||
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);
|
||||
|
||||
sprintf(buff, "\t\t%d Layers\n", doneMat->fHsMaterial->GetNumLayers());
|
||||
|
@ -368,7 +368,8 @@ int HSExport2::DoExport(const TCHAR *name,ExpInterface *ei,Interface *gi, BOOL s
|
||||
dbLog.Open(name,"at");
|
||||
char str[256];
|
||||
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.Close();
|
||||
|
||||
|
@ -2869,7 +2869,7 @@ bool plMaxNode::IGetProjection(plLightInfo* li, plErrorMsg* pErrMsg)
|
||||
{
|
||||
char buff[256];
|
||||
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
|
||||
sprintf(buff, "Can't find projected bitmap - <unknown>");
|
||||
if( pErrMsg->Set(!(convert.fWarned & plConvert::kWarnedMissingProj), GetName(),
|
||||
|
@ -54,7 +54,7 @@ int main(int argc, char* argv[])
|
||||
// vs_ => "vs_
|
||||
// ps_ => "ps_
|
||||
// , => ",
|
||||
const char* kEnumNames[] = {
|
||||
static const char* kEnumNames[] = {
|
||||
"vs_WaveFixedFin6",
|
||||
"ps_WaveFixed",
|
||||
"vs_CompCosines",
|
||||
|
Reference in New Issue
Block a user