mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-14 10:37:41 -04:00
Merge branch 'clang' into linux
This commit is contained in:
@ -39,7 +39,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#include "hsTypes.h"
|
||||
#include "PythonInterface.h"
|
||||
|
||||
#include "compile.h"
|
||||
@ -139,7 +138,7 @@ void PythonInterface::finiPython()
|
||||
//
|
||||
// PURPOSE : run a python string in a specific module name
|
||||
//
|
||||
PyObject* PythonInterface::CompileString(char *command, char* filename)
|
||||
PyObject* PythonInterface::CompileString(const char *command, const char* filename)
|
||||
{
|
||||
PyObject* pycode = Py_CompileString(command, filename, Py_file_input);
|
||||
return pycode;
|
||||
@ -220,7 +219,7 @@ int PythonInterface::getOutputAndReset(char** line)
|
||||
//
|
||||
// PURPOSE : create a new module with built-ins
|
||||
//
|
||||
PyObject* PythonInterface::CreateModule(char* module)
|
||||
PyObject* PythonInterface::CreateModule(const char* module)
|
||||
{
|
||||
PyObject *m, *d;
|
||||
// first we must get rid of any old modules of the same name, we'll replace it
|
||||
@ -291,7 +290,7 @@ hsBool PythonInterface::RunPYC(PyObject* code, PyObject* module)
|
||||
//
|
||||
// PURPOSE : get an item (probably a function) from a specific module
|
||||
//
|
||||
PyObject* PythonInterface::GetModuleItem(char* item, PyObject* module)
|
||||
PyObject* PythonInterface::GetModuleItem(const char* item, PyObject* module)
|
||||
{
|
||||
if ( module )
|
||||
{
|
||||
|
@ -39,7 +39,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#include "Python.h"
|
||||
#include <Python.h>
|
||||
#include "hsTypes.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
@ -50,10 +51,10 @@ namespace PythonInterface
|
||||
// So the Python packer can add extra paths
|
||||
void addPythonPath(std::string dir);
|
||||
|
||||
PyObject* CompileString(char *command, char* filename);
|
||||
PyObject* CompileString(const char *command, const char* filename);
|
||||
hsBool DumpObject(PyObject* pyobj, char** pickle, Int32* size);
|
||||
int getOutputAndReset(char** line=nil);
|
||||
PyObject* CreateModule(char* module);
|
||||
PyObject* CreateModule(const char* module);
|
||||
hsBool RunPYC(PyObject* code, PyObject* module);
|
||||
PyObject* GetModuleItem(char* item, PyObject* module);
|
||||
PyObject* GetModuleItem(const char* item, PyObject* module);
|
||||
}
|
||||
|
@ -39,11 +39,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#include "PythonInterface.h"
|
||||
|
||||
#include "hsStream.h"
|
||||
#include "plFile/hsFiles.h"
|
||||
|
||||
#include "PythonInterface.h"
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
@ -123,14 +123,14 @@ void WritePythonFile(std::string fileName, std::string path, hsStream *s)
|
||||
}
|
||||
|
||||
// import the module first, to make packages work correctly
|
||||
PyImport_ImportModule((char*)fileName.c_str());
|
||||
PyObject* pythonCode = PythonInterface::CompileString(code, (char*)fileName.c_str());
|
||||
PyImport_ImportModule(fileName.c_str());
|
||||
PyObject* pythonCode = PythonInterface::CompileString(code, fileName.c_str());
|
||||
if (pythonCode)
|
||||
{
|
||||
// we need to find out if this is PythonFile module
|
||||
// create a module name... with the '.' as an X
|
||||
// and create a python file name that is without the ".py"
|
||||
PyObject* fModule = PythonInterface::CreateModule((char*)fileName.c_str());
|
||||
PyObject* fModule = PythonInterface::CreateModule(fileName.c_str());
|
||||
// run the code
|
||||
if (PythonInterface::RunPYC(pythonCode, fModule) )
|
||||
{
|
||||
@ -166,7 +166,7 @@ void WritePythonFile(std::string fileName, std::string path, hsStream *s)
|
||||
// else
|
||||
// skip the CRs
|
||||
}
|
||||
pythonCode = PythonInterface::CompileString(code, (char*)fileName.c_str());
|
||||
pythonCode = PythonInterface::CompileString(code, fileName.c_str());
|
||||
hsAssert(pythonCode,"Not sure why this didn't compile the second time???");
|
||||
printf("an import file ");
|
||||
}
|
||||
@ -181,8 +181,7 @@ void WritePythonFile(std::string fileName, std::string path, hsStream *s)
|
||||
int chars_read = PythonInterface::getOutputAndReset(&errmsg);
|
||||
if (chars_read > 0)
|
||||
{
|
||||
printf(errmsg);
|
||||
printf("\n");
|
||||
printf("%s\n", errmsg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -200,8 +199,7 @@ void WritePythonFile(std::string fileName, std::string path, hsStream *s)
|
||||
int chars_read = PythonInterface::getOutputAndReset(&errmsg);
|
||||
if (chars_read > 0)
|
||||
{
|
||||
printf(errmsg);
|
||||
printf("\n");
|
||||
printf("%s\n", errmsg);
|
||||
}
|
||||
s->WriteLE32(size);
|
||||
s->Write(size, pycode);
|
||||
@ -218,7 +216,7 @@ void WritePythonFile(std::string fileName, std::string path, hsStream *s)
|
||||
int chars_read = PythonInterface::getOutputAndReset(&errmsg);
|
||||
if (chars_read > 0)
|
||||
{
|
||||
printf(errmsg);
|
||||
printf("%s\n", errmsg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ void CCritSect::Leave () {
|
||||
#elif HS_BUILD_FOR_UNIX
|
||||
//===========================================================================
|
||||
CCritSect::CCritSect () {
|
||||
m_handle = PTHREAD_MUTEX_INITIALIZER;
|
||||
m_handle = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
@ -606,8 +606,8 @@ hsScalar hsFastMath::IATan2OverTwoPi(hsScalar y, hsScalar x)
|
||||
return 0;
|
||||
|
||||
hsBool xNeg, yNeg;
|
||||
if( yNeg = (y < 0) )y = -y;
|
||||
if( xNeg = (x < 0) )x = -x;
|
||||
if((yNeg = (y < 0)))y = -y;
|
||||
if((xNeg = (x < 0)))x = -x;
|
||||
hsBool yBigger = y >= x;
|
||||
hsScalar div = yBigger ? x / y : y / x;
|
||||
|
||||
|
@ -57,8 +57,8 @@ fLastTerminator(nil)
|
||||
|
||||
hsStringTokenizer::~hsStringTokenizer()
|
||||
{
|
||||
delete [] fString;
|
||||
delete [] fSeps;
|
||||
delete[] fString;
|
||||
delete[] fSeps;
|
||||
}
|
||||
|
||||
hsBool hsStringTokenizer::HasMoreTokens()
|
||||
@ -134,11 +134,11 @@ void hsStringTokenizer::RestoreLastTerminator( void )
|
||||
void hsStringTokenizer::Reset(const char *string, const char *seps)
|
||||
{
|
||||
if (fString)
|
||||
delete [] fString;
|
||||
delete[] fString;
|
||||
fString = string ? hsStrcpy(string) : nil;
|
||||
|
||||
if (fSeps)
|
||||
delete [] fSeps;
|
||||
delete[] fSeps;
|
||||
fSeps = seps ? hsStrcpy(seps) : nil;
|
||||
fNumSeps = fSeps ? strlen(fSeps) : 0;
|
||||
fCheckAlphaNum = false;
|
||||
@ -181,8 +181,8 @@ hsWStringTokenizer::hsWStringTokenizer(const wchar *string, const wchar *seps) :
|
||||
|
||||
hsWStringTokenizer::~hsWStringTokenizer()
|
||||
{
|
||||
delete [] fString;
|
||||
delete [] fSeps;
|
||||
delete[] fString;
|
||||
delete[] fSeps;
|
||||
}
|
||||
|
||||
hsBool hsWStringTokenizer::HasMoreTokens()
|
||||
@ -259,11 +259,11 @@ void hsWStringTokenizer::RestoreLastTerminator( void )
|
||||
void hsWStringTokenizer::Reset(const wchar *string, const wchar *seps)
|
||||
{
|
||||
if (fString)
|
||||
delete [] fString;
|
||||
delete[] fString;
|
||||
if (string)
|
||||
{
|
||||
int count = wcslen(string);
|
||||
fString = TRACKED_NEW(wchar[count + 1]);
|
||||
fString = new wchar[count + 1];
|
||||
wcscpy(fString, string);
|
||||
fString[count] = L'\0';
|
||||
}
|
||||
@ -271,11 +271,11 @@ void hsWStringTokenizer::Reset(const wchar *string, const wchar *seps)
|
||||
fString = nil;
|
||||
|
||||
if (fSeps)
|
||||
delete [] fSeps;
|
||||
delete[] fSeps;
|
||||
if (seps)
|
||||
{
|
||||
int count = wcslen(seps);
|
||||
fSeps = TRACKED_NEW(wchar[count + 1]);
|
||||
fSeps = new wchar[count + 1];
|
||||
wcscpy(fSeps, seps);
|
||||
fSeps[count] = L'\0';
|
||||
}
|
||||
|
@ -524,6 +524,7 @@ public:
|
||||
UInt16 GetNumAlloc() const { return fTotalCount; }
|
||||
};
|
||||
|
||||
template <class T> void hsTArray_CopyForward(const T src[], T dst[], int count);
|
||||
|
||||
template <class T> class hsTArray : public hsTArrayBase
|
||||
{
|
||||
|
@ -58,8 +58,8 @@ struct hsWide {
|
||||
|
||||
|
||||
hsBool operator==(const hsWide& b) const { return fHi == b.fHi && fLo == b.fLo; }
|
||||
hsBool operator<(const hsWide& b) const { return fHi < b.fHi || fHi == b.fHi && fLo < b.fLo; }
|
||||
hsBool operator>( const hsWide& b) const { return fHi > b.fHi || fHi == b.fHi && fLo > b.fLo; }
|
||||
hsBool operator<(const hsWide& b) const { return fHi < b.fHi || (fHi == b.fHi && fLo < b.fLo); }
|
||||
hsBool operator>( const hsWide& b) const { return fHi > b.fHi || (fHi == b.fHi && fLo > b.fLo); }
|
||||
hsBool operator!=( const hsWide& b) const { return !( *this == b); }
|
||||
hsBool operator<=(const hsWide& b) const { return !(*this > b); }
|
||||
hsBool operator>=(const hsWide& b) const { return !(*this < b); }
|
||||
@ -187,11 +187,11 @@ inline hsWide* hsWide::RoundRight(unsigned shift)
|
||||
inline Int32 hsWide::AsLong() const
|
||||
{
|
||||
#if HS_PIN_MATH_OVERFLOW
|
||||
if (fHi > 0 || fHi == 0 && (Int32)fLo < 0)
|
||||
if (fHi > 0 || (fHi == 0 && (Int32)fLo < 0))
|
||||
{ hsSignalMathOverflow();
|
||||
return kPosInfinity32;
|
||||
}
|
||||
if (fHi < -1L || fHi == -1L && (Int32)fLo >= 0)
|
||||
if (fHi < -1L || (fHi == -1L && (Int32)fLo >= 0))
|
||||
{ hsSignalMathOverflow();
|
||||
return kNegInfinity32;
|
||||
}
|
||||
@ -201,7 +201,7 @@ inline Int32 hsWide::AsLong() const
|
||||
|
||||
inline hsBool hsWide::IsWide() const
|
||||
{
|
||||
return (fHi > 0 || fHi == 0 && (Int32)fLo < 0) || (fHi < -1L || fHi == -1L && (Int32)fLo >= 0);
|
||||
return (fHi > 0 || (fHi == 0 && (Int32)fLo < 0)) || (fHi < -1L || (fHi == -1L && (Int32)fLo >= 0));
|
||||
}
|
||||
|
||||
inline hsFixed hsWide::AsFixed() const
|
||||
|
@ -286,7 +286,7 @@ void plDispatch::IMsgDispatch()
|
||||
fMsgCurrentMutex.Lock();
|
||||
|
||||
plMsgWrap* origTail = fMsgTail;
|
||||
while( fMsgCurrent = fMsgHead )
|
||||
while((fMsgCurrent = fMsgHead))
|
||||
{
|
||||
IDequeue(&fMsgHead, &fMsgTail);
|
||||
fMsgCurrentMutex.Unlock();
|
||||
@ -460,7 +460,7 @@ hsBool plDispatch::MsgSend(plMessage* msg, hsBool async)
|
||||
plTimeMsg* timeMsg;
|
||||
if( msg->GetTimeStamp() > hsTimer::GetSysSeconds() )
|
||||
return ISortToDeferred(msg);
|
||||
else if( timeMsg = plTimeMsg::ConvertNoRef(msg) )
|
||||
else if((timeMsg = plTimeMsg::ConvertNoRef(msg)))
|
||||
ICheckDeferred(timeMsg->DSeconds());
|
||||
|
||||
plMsgWrap* msgWrap = TRACKED_NEW plMsgWrap(msg);
|
||||
|
@ -145,9 +145,9 @@ public:
|
||||
virtual void UnRegisterForType(UInt16 hClass, const plKey& receiver) {}
|
||||
|
||||
|
||||
virtual hsBool MsgSend(plMessage* msg) {}
|
||||
virtual void MsgQueue(plMessage* msg){}
|
||||
virtual void MsgQueueProcess(){}
|
||||
virtual hsBool MsgSend(plMessage* msg) { return true; }
|
||||
virtual void MsgQueue(plMessage* msg) {}
|
||||
virtual void MsgQueueProcess() {}
|
||||
|
||||
};
|
||||
|
||||
|
@ -274,7 +274,7 @@ plUoid& plUoid::operator=(const plUoid& rhs)
|
||||
// THIS SHOULD BE FOR DEBUGGING ONLY <hint hint>
|
||||
char* plUoid::StringIze(char* str) const // Format to displayable string
|
||||
{
|
||||
sprintf(str, "(0x%x:0x%x:%s:C:[%lu,%lu])",
|
||||
sprintf(str, "(0x%x:0x%x:%s:C:[%u,%u])",
|
||||
fLocation.GetSequenceNumber(),
|
||||
int(fLocation.GetFlags()),
|
||||
fObjectName,
|
||||
|
@ -602,7 +602,7 @@ hsBool plCoordinateInterface::MsgReceive(plMessage* msg)
|
||||
ITransformChanged(false, kReasonUnknown, false);
|
||||
return true;
|
||||
}
|
||||
else if( intRefMsg = plIntRefMsg::ConvertNoRef(msg) )
|
||||
else if((intRefMsg = plIntRefMsg::ConvertNoRef(msg)))
|
||||
{
|
||||
switch( intRefMsg->fType )
|
||||
{
|
||||
@ -641,7 +641,7 @@ hsBool plCoordinateInterface::MsgReceive(plMessage* msg)
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if( corrMsg = plCorrectionMsg::ConvertNoRef(msg) )
|
||||
else if((corrMsg = plCorrectionMsg::ConvertNoRef(msg)))
|
||||
{
|
||||
SetTransformPhysical(corrMsg->fLocalToWorld, corrMsg->fWorldToLocal);
|
||||
|
||||
|
@ -488,7 +488,7 @@ hsBool plSceneObject::MsgReceive(plMessage* msg)
|
||||
return true;
|
||||
}
|
||||
else
|
||||
if( trans = plTransformMsg::ConvertNoRef(msg) ) // also catches the derived plDelayedTransformMsg
|
||||
if((trans = plTransformMsg::ConvertNoRef(msg))) // also catches the derived plDelayedTransformMsg
|
||||
{
|
||||
if( fCoordinateInterface )
|
||||
{
|
||||
@ -498,7 +498,7 @@ hsBool plSceneObject::MsgReceive(plMessage* msg)
|
||||
return true;
|
||||
}
|
||||
else
|
||||
if( att = plAttachMsg::ConvertNoRef(msg) )
|
||||
if((att = plAttachMsg::ConvertNoRef(msg)))
|
||||
{
|
||||
if( fCoordinateInterface )
|
||||
{
|
||||
@ -883,4 +883,4 @@ void plSceneObject::AddModifier(plModifier* mo)
|
||||
void plSceneObject::RemoveModifier(plModifier* mo)
|
||||
{
|
||||
IRemoveModifier(mo);
|
||||
}
|
||||
}
|
||||
|
@ -308,6 +308,8 @@ UInt32 hsTimer::GetPrecTickCount()
|
||||
return GetTickCount();
|
||||
|
||||
return ti.LowPart;
|
||||
#else
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
UInt32 hsTimer::PrecSecsToTicks(hsScalar secs)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/*==LICENSE==*
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
@ -1,4 +1,4 @@
|
||||
/*==LICENSE==*
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
@ -670,14 +670,14 @@ bool plIniConfigSource::WriteOutOf(plConfigInfo & configInfo)
|
||||
plConfigInfo::Values::const_iterator vi, ve;
|
||||
|
||||
fConfigInfo->GetSectionIterators(si,se);
|
||||
for (si; si!=se; ++si)
|
||||
for (; si!=se; ++si)
|
||||
{
|
||||
file << std::endl << "[" << si->first.c_str() << "]"<< std::endl;
|
||||
if (fConfigInfo->GetKeyIterators(si->first, ki, ke))
|
||||
for (ki; ki!=ke; ++ki)
|
||||
for (; ki!=ke; ++ki)
|
||||
{
|
||||
if (fConfigInfo->GetValueIterators(si->first, ki->first, vi, ve))
|
||||
for (vi; vi!=ve; ++vi)
|
||||
for (; vi!=ve; ++vi)
|
||||
{
|
||||
file << ki->first.c_str() << "=" << vi->c_str() << std::endl;
|
||||
}
|
||||
@ -738,14 +738,14 @@ bool plIniStreamConfigSource::WriteOutOf(plConfigInfo & configInfo)
|
||||
plConfigInfo::Values::const_iterator vi, ve;
|
||||
|
||||
fConfigInfo->GetSectionIterators(si,se);
|
||||
for (si; si!=se; ++si)
|
||||
for (; si!=se; ++si)
|
||||
{
|
||||
ss << std::endl << "[" << si->first.c_str() << "]"<< std::endl;
|
||||
if (fConfigInfo->GetKeyIterators(si->first, ki, ke))
|
||||
for (ki; ki!=ke; ++ki)
|
||||
for (; ki!=ke; ++ki)
|
||||
{
|
||||
if (fConfigInfo->GetValueIterators(si->first, ki->first, vi, ve))
|
||||
for (vi; vi!=ve; ++vi)
|
||||
for (; vi!=ve; ++vi)
|
||||
{
|
||||
ss << ki->first.c_str() << "=" << vi->c_str() << std::endl;
|
||||
}
|
||||
@ -887,13 +887,13 @@ bool plIniNoSectionsConfigSource::WriteOutOf(plConfigInfo & configInfo)
|
||||
plConfigInfo::Values::const_iterator vi, ve;
|
||||
|
||||
fConfigInfo->GetSectionIterators(si,se);
|
||||
for (si; si!=se; ++si)
|
||||
for (; si!=se; ++si)
|
||||
{
|
||||
if (fConfigInfo->GetKeyIterators(si->first, ki, ke))
|
||||
for (ki; ki!=ke; ++ki)
|
||||
for (; ki!=ke; ++ki)
|
||||
{
|
||||
if (fConfigInfo->GetValueIterators(si->first, ki->first, vi, ve))
|
||||
for (vi; vi!=ve; ++vi)
|
||||
for (; vi!=ve; ++vi)
|
||||
{
|
||||
file << ki->first.c_str() << "=" << vi->c_str() << std::endl;
|
||||
}
|
||||
@ -919,15 +919,15 @@ bool plDebugConfigSource::WriteOutOf(plConfigInfo & configInfo)
|
||||
|
||||
char buf[1024];
|
||||
fConfigInfo->GetSectionIterators(si,se);
|
||||
for (si; si!=se; ++si)
|
||||
for (; si!=se; ++si)
|
||||
{
|
||||
sprintf(buf,"\n[%s]\n",si->first.c_str());
|
||||
hsStatusMessage(buf);
|
||||
if (fConfigInfo->GetKeyIterators(si->first, ki, ke))
|
||||
for (ki; ki!=ke; ++ki)
|
||||
for (; ki!=ke; ++ki)
|
||||
{
|
||||
if (fConfigInfo->GetValueIterators(si->first, ki->first, vi, ve))
|
||||
for (vi; vi!=ve; ++vi)
|
||||
for (; vi!=ve; ++vi)
|
||||
{
|
||||
sprintf(buf,"%s=%s\n",ki->first.c_str(),vi->c_str());
|
||||
hsStatusMessage(buf);
|
||||
|
@ -111,6 +111,8 @@ bool plKeysAndValues::AddValue(const std::string & key, const std::string & valu
|
||||
if (HasKey(key))
|
||||
RemoveKey(key);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
fKeys[key.c_str()].push_front(value.c_str());
|
||||
return true;
|
||||
@ -259,7 +261,7 @@ void plKeysAndValues::Write(hsStream * s)
|
||||
// iterate through keys
|
||||
Keys::const_iterator ki,ke;
|
||||
GetKeyIterators(ki,ke);
|
||||
for (ki;ki!=ke;++ki)
|
||||
for (;ki!=ke;++ki)
|
||||
{
|
||||
// write key string
|
||||
s->WriteLE((UInt16)ki->first.size());
|
||||
@ -269,7 +271,7 @@ void plKeysAndValues::Write(hsStream * s)
|
||||
// iterate through values for this key
|
||||
Values::const_iterator vi,ve;
|
||||
GetValueIterators(ki->first,vi,ve);
|
||||
for (vi;vi!=ve;++vi)
|
||||
for (;vi!=ve;++vi)
|
||||
{
|
||||
// write value string
|
||||
s->WriteLE((UInt16)vi->size());
|
||||
|
@ -104,8 +104,10 @@ hsBool plFileUtils::CreateDir( const wchar *path )
|
||||
return ( _wmkdir( path ) == 0 ) ? true : ( errno==EEXIST );
|
||||
#elif HS_BUILD_FOR_UNIX
|
||||
const char* cpath = hsWStringToString(path);
|
||||
CreateDir(cpath);
|
||||
bool ret = CreateDir(cpath);
|
||||
delete[] cpath; /* Free the string */
|
||||
|
||||
return ret;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -156,8 +158,10 @@ bool plFileUtils::RemoveFile(const wchar* filename, bool delReadOnly)
|
||||
return (_wunlink(filename) == 0);
|
||||
#elif HS_BUILD_FOR_UNIX
|
||||
const char* cfilename = hsWStringToString(filename);
|
||||
RemoveFile(cfilename, delReadOnly);
|
||||
bool ret = RemoveFile(cfilename, delReadOnly);
|
||||
delete[] cfilename; /* Free the string */
|
||||
|
||||
return ret;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -542,13 +546,11 @@ bool plFileUtils::GetSecureEncryptionKey(const wchar* filename, UInt32* key, uns
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// file doesn't exist, use default key
|
||||
unsigned memSize = min(length, arrsize(plSecureStream::kDefaultKey));
|
||||
memSize *= sizeof(UInt32);
|
||||
memcpy(key, plSecureStream::kDefaultKey, memSize);
|
||||
|
||||
return false;
|
||||
}
|
||||
// file doesn't exist, use default key
|
||||
unsigned memSize = min(length, arrsize(plSecureStream::kDefaultKey));
|
||||
memSize *= sizeof(UInt32);
|
||||
memcpy(key, plSecureStream::kDefaultKey, memSize);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -251,7 +251,7 @@ void plDynamicTextMap::IDestroyOSSurface( void )
|
||||
IRemoveFromMemRecord( (UInt8 *)fImage );
|
||||
#endif
|
||||
|
||||
delete [] fImage;
|
||||
delete[] (UInt32*)fImage;
|
||||
fImage = nil;
|
||||
|
||||
plProfile_Dec(DynaTexts);
|
||||
|
@ -180,7 +180,7 @@ void plMipmap::Reset()
|
||||
IRemoveFromMemRecord( (UInt8 *)fImage );
|
||||
#endif
|
||||
|
||||
delete [] fImage;
|
||||
delete[] (UInt8*)fImage;
|
||||
plProfile_DelMem(MemMipmaps, fTotalSize);
|
||||
}
|
||||
fImage = nil;
|
||||
@ -758,7 +758,7 @@ void plMipmap::ClipToMaxSize( UInt32 maxDimension )
|
||||
#ifdef MEMORY_LEAK_TRACER
|
||||
IRemoveFromMemRecord( (UInt8 *)fImage );
|
||||
#endif
|
||||
delete [] fImage;
|
||||
delete[] (UInt8*)fImage;
|
||||
plProfile_DelMem(MemMipmaps, fTotalSize);
|
||||
|
||||
fImage = destData;
|
||||
@ -789,7 +789,7 @@ void plMipmap::RemoveMipping()
|
||||
#ifdef MEMORY_LEAK_TRACER
|
||||
IRemoveFromMemRecord( (UInt8 *)fImage );
|
||||
#endif
|
||||
delete [] fImage;
|
||||
delete[] (UInt8*)fImage;
|
||||
plProfile_DelMem(MemMipmaps, fTotalSize);
|
||||
|
||||
fImage = destData;
|
||||
@ -1556,7 +1556,7 @@ void plMipmap::CopyFrom( const plMipmap *source )
|
||||
#ifdef MEMORY_LEAK_TRACER
|
||||
IRemoveFromMemRecord( (UInt8 *)fImage );
|
||||
#endif
|
||||
delete [] fImage;
|
||||
delete[] (UInt8*)fImage;
|
||||
|
||||
fWidth = source->fWidth;
|
||||
fHeight = source->fHeight;
|
||||
|
@ -397,7 +397,7 @@ void plAnimTimeConvert::IFlushOldStates()
|
||||
plATCStateList::const_iterator i = fStates.begin();
|
||||
UInt32 count = 0;
|
||||
|
||||
for (i; i != fStates.end(); i++)
|
||||
for (; i != fStates.end(); i++)
|
||||
{
|
||||
count++;
|
||||
state = *i;
|
||||
@ -426,7 +426,7 @@ plATCState *plAnimTimeConvert::IGetState(double wSecs) const
|
||||
plATCState *state;
|
||||
plATCStateList::const_iterator i = fStates.begin();
|
||||
|
||||
for (i; i != fStates.end(); i++)
|
||||
for (; i != fStates.end(); i++)
|
||||
{
|
||||
state = *i;
|
||||
if (wSecs >= state->fStartWorldTime)
|
||||
@ -589,7 +589,7 @@ hsScalar plAnimTimeConvert::WorldToAnimTime(double wSecs)
|
||||
// 2. Same as #1, but in the backwards case.
|
||||
// 3. We started before the wrap point, now we're after it. Stop.
|
||||
// 4. Same as #3, backwards.
|
||||
if ((wrapped && (forewards && secs >= fWrapTime) ||
|
||||
if (((wrapped && (forewards && secs >= fWrapTime)) ||
|
||||
(!forewards && secs <= fWrapTime)) ||
|
||||
(forewards && fCurrentAnimTime < fWrapTime && secs >= fWrapTime) ||
|
||||
(!forewards && fCurrentAnimTime > fWrapTime && secs <= fWrapTime))
|
||||
@ -700,7 +700,7 @@ hsScalar plAnimTimeConvert::IWorldToAnimTimeNoUpdate(double wSecs, plATCState *s
|
||||
|
||||
if (state->fFlags & kWrap)
|
||||
{
|
||||
if ((wrapped && (forewards && secs >= state->fWrapTime) ||
|
||||
if (((wrapped && (forewards && secs >= state->fWrapTime)) ||
|
||||
(!forewards && secs <= state->fWrapTime)) ||
|
||||
(forewards && state->fStartAnimTime < state->fWrapTime && secs >= state->fWrapTime) ||
|
||||
(!forewards && state->fStartAnimTime > state->fWrapTime && secs <= state->fWrapTime))
|
||||
|
@ -76,7 +76,7 @@ void plControllerCacheInfo::SetATC(plAnimTimeConvert *atc)
|
||||
|
||||
plLeafController::~plLeafController()
|
||||
{
|
||||
delete [] fKeys;
|
||||
delete[] fKeys;
|
||||
}
|
||||
|
||||
void plLeafController::Interp(hsScalar time, hsScalar* result, plControllerCacheInfo *cache) const
|
||||
|
@ -81,7 +81,7 @@ hsBool plParticleCollisionEffect::MsgReceive(plMessage* msg)
|
||||
plSceneObject *so;
|
||||
if (refMsg)
|
||||
{
|
||||
if (so = plSceneObject::ConvertNoRef(refMsg->GetRef()))
|
||||
if ((so = plSceneObject::ConvertNoRef(refMsg->GetRef())))
|
||||
{
|
||||
if( refMsg->GetContext() & (plRefMsg::kOnCreate|plRefMsg::kOnRequest|plRefMsg::kOnReplace) )
|
||||
fSceneObj = so;
|
||||
|
@ -484,16 +484,16 @@ hsBool plParticleSystem::MsgReceive(plMessage* msg)
|
||||
plRenderMsg *rend;
|
||||
plAgeLoadedMsg* ageLoaded;
|
||||
|
||||
if (rend = plRenderMsg::ConvertNoRef(msg))
|
||||
if ((rend = plRenderMsg::ConvertNoRef(msg)))
|
||||
{
|
||||
plProfile_BeginLap(ParticleSys, this->GetKey()->GetUoid().GetObjectName());
|
||||
IHandleRenderMsg(rend->Pipeline());
|
||||
plProfile_EndLap(ParticleSys, this->GetKey()->GetUoid().GetObjectName());
|
||||
return true;
|
||||
}
|
||||
else if (refMsg = plGenRefMsg::ConvertNoRef(msg))
|
||||
else if ((refMsg = plGenRefMsg::ConvertNoRef(msg)))
|
||||
{
|
||||
if (scene = plSceneObject::ConvertNoRef(refMsg->GetRef()))
|
||||
if ((scene = plSceneObject::ConvertNoRef(refMsg->GetRef())))
|
||||
{
|
||||
if (refMsg->GetContext() & (plRefMsg::kOnCreate|plRefMsg::kOnRequest|plRefMsg::kOnReplace))
|
||||
AddTarget(scene);
|
||||
@ -501,7 +501,7 @@ hsBool plParticleSystem::MsgReceive(plMessage* msg)
|
||||
RemoveTarget(scene);
|
||||
return true;
|
||||
}
|
||||
if (mat = hsGMaterial::ConvertNoRef(refMsg->GetRef()))
|
||||
if ((mat = hsGMaterial::ConvertNoRef(refMsg->GetRef())))
|
||||
{
|
||||
if (refMsg->GetContext() & (plRefMsg::kOnCreate|plRefMsg::kOnRequest|plRefMsg::kOnReplace))
|
||||
fTexture = mat;
|
||||
@ -509,7 +509,7 @@ hsBool plParticleSystem::MsgReceive(plMessage* msg)
|
||||
fTexture = nil;
|
||||
return true;
|
||||
}
|
||||
if (effect = plParticleEffect::ConvertNoRef(refMsg->GetRef()))
|
||||
if ((effect = plParticleEffect::ConvertNoRef(refMsg->GetRef())))
|
||||
{
|
||||
if (refMsg->GetContext() & (plRefMsg::kOnCreate|plRefMsg::kOnRequest|plRefMsg::kOnReplace))
|
||||
IAddEffect(effect, refMsg->fType);
|
||||
@ -518,12 +518,12 @@ hsBool plParticleSystem::MsgReceive(plMessage* msg)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (partMsg = plParticleUpdateMsg::ConvertNoRef(msg))
|
||||
else if ((partMsg = plParticleUpdateMsg::ConvertNoRef(msg)))
|
||||
{
|
||||
UpdateGenerator(partMsg->GetParamID(), partMsg->GetParamValue());
|
||||
return true;
|
||||
}
|
||||
else if (killMsg = plParticleKillMsg::ConvertNoRef(msg))
|
||||
else if ((killMsg = plParticleKillMsg::ConvertNoRef(msg)))
|
||||
{
|
||||
KillParticles(killMsg->fNumToKill, killMsg->fTimeLeft, killMsg->fFlags);
|
||||
return true;
|
||||
@ -714,4 +714,4 @@ void plParticleSystem::SetAttachedToAvatar(bool attached)
|
||||
void plParticleSystem::AddLight(plKey liKey)
|
||||
{
|
||||
fPermaLights.Append(liKey);
|
||||
}
|
||||
}
|
||||
|
@ -297,7 +297,7 @@ void plBSDiffBuffer::GetBuffer( UInt32 &length, void *&bufferPtr )
|
||||
if (fPatchBuffer && fPatchLength)
|
||||
{
|
||||
length = fPatchLength;
|
||||
if (bufferPtr = (void *)TRACKED_NEW unsigned char[ length ])
|
||||
if ((bufferPtr = (void *)new unsigned char[ length ]))
|
||||
memcpy(bufferPtr, fPatchBuffer, length);
|
||||
}
|
||||
else
|
||||
@ -432,7 +432,7 @@ UInt32 plBSDiffBuffer::Patch( UInt32 oldLength, void *oldBuffer, UInt32 &newLeng
|
||||
|
||||
if(newpos != newend)
|
||||
{
|
||||
delete[] newBuffer;
|
||||
delete[] (unsigned char*)newBuffer;
|
||||
newLength = 0;
|
||||
}
|
||||
|
||||
|
@ -376,7 +376,7 @@ class plPageFinder : public plRegistryPageIterator
|
||||
}
|
||||
|
||||
// Try for full location
|
||||
sprintf( str, "%s_%s_%s", info.GetAge(), info.GetPage() );
|
||||
sprintf( str, "%s_%s", info.GetAge(), info.GetPage() );
|
||||
if( stricmp( str, fFindString ) == 0 )
|
||||
{
|
||||
*fPagePtr = node;
|
||||
|
@ -446,7 +446,7 @@ public:
|
||||
plSimpleStateVariable* FindVar(const char* name) const { return (plSimpleStateVariable*)IFindVar(fVarsList, name); }
|
||||
plSDStateVariable* FindSDVar(const char* name) const { return (plSDStateVariable*)IFindVar(fSDVarsList, name); }
|
||||
|
||||
plStateDataRecord& operator=(const plStateDataRecord& other) { CopyFrom(other); }
|
||||
plStateDataRecord& operator=(const plStateDataRecord& other) { CopyFrom(other); return *this; }
|
||||
void CopyFrom(const plStateDataRecord& other, UInt32 writeOptions=0);
|
||||
void UpdateFrom(const plStateDataRecord& other, UInt32 writeOptions=0);
|
||||
void SetFromDefaults(bool timeStampNow);
|
||||
|
@ -92,12 +92,12 @@ public:
|
||||
int fDataLen;
|
||||
|
||||
plSDLCreatableStub(UInt16 classIndex, int len) : fClassIndex(classIndex),fData(nil),fDataLen(len) {}
|
||||
~plSDLCreatableStub() { delete [] fData; }
|
||||
~plSDLCreatableStub() { delete[] (char*)fData; }
|
||||
|
||||
const char* ClassName() const { return "SDLCreatable"; }
|
||||
UInt16 ClassIndex() const { return fClassIndex; }
|
||||
|
||||
void Read(hsStream* s, hsResMgr* mgr) { delete [] fData; fData = TRACKED_NEW char[fDataLen]; s->Read(fDataLen, fData); }
|
||||
void Read(hsStream* s, hsResMgr* mgr) { delete[] (char*)fData; fData = new char[fDataLen]; s->Read(fDataLen, fData); }
|
||||
void Write(hsStream* s, hsResMgr* mgr) { s->Write(fDataLen, fData); }
|
||||
};
|
||||
|
||||
@ -112,7 +112,7 @@ void plStateVarNotificationInfo::Read(hsStream* s, UInt32 readOptions)
|
||||
if (hint && !(readOptions & plSDL::kSkipNotificationInfo))
|
||||
fHintString = (const char*)hint;
|
||||
// we're done with it...
|
||||
delete [] hint;
|
||||
delete[] hint;
|
||||
}
|
||||
|
||||
void plStateVarNotificationInfo::Write(hsStream* s, UInt32 writeOptions) const
|
||||
@ -1874,6 +1874,8 @@ bool plSimpleStateVariable::IWriteData(hsStream* s, float timeConvert, int idx,
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -2162,6 +2164,7 @@ void plSimpleStateVariable::NotifyStateChange(const plSimpleStateVariable* other
|
||||
NOTIFY_CHECK(plVarDescriptor::kByte, fBy)
|
||||
NOTIFY_CHECK(plVarDescriptor::kFloat, fF)
|
||||
NOTIFY_CHECK(plVarDescriptor::kDouble, fD)
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
if (notify)
|
||||
|
@ -826,12 +826,12 @@ bool plStatusLog::IPrintLineToFile( const char *line, UInt32 count )
|
||||
}
|
||||
if (fFlags & kRawTimeStamp)
|
||||
{
|
||||
snprintf(work, arrsize(work), "[t=%10u] ", hsTimer::GetSeconds());
|
||||
snprintf(work, arrsize(work), "[t=%10f] ", hsTimer::GetSeconds());
|
||||
strncat(buf, work, arrsize(work));
|
||||
}
|
||||
if (fFlags & kThreadID)
|
||||
{
|
||||
snprintf(work, arrsize(work), "[t=%u] ", hsThread::GetMyThreadId());
|
||||
snprintf(work, arrsize(work), "[t=%lu] ", hsThread::GetMyThreadId());
|
||||
strncat(buf, work, arrsize(work));
|
||||
}
|
||||
|
||||
|
@ -583,7 +583,7 @@ hsBool plLayerLinkAnimation::MsgReceive( plMessage* pMsg )
|
||||
if (msg->HasLinkFlag(plLinkEffectBCMsg::kSendCallback))
|
||||
{
|
||||
plLinkEffectsMgr *mgr;
|
||||
if (mgr = plLinkEffectsMgr::ConvertNoRef(msg->GetSender()->ObjectIsLoaded()))
|
||||
if ((mgr = plLinkEffectsMgr::ConvertNoRef(msg->GetSender()->ObjectIsLoaded())))
|
||||
mgr->WaitForEffect(msg->fLinkKey, fTimeConvert.GetEnd() - fTimeConvert.GetBegin());
|
||||
}
|
||||
}
|
||||
@ -603,7 +603,7 @@ hsBool plLayerLinkAnimation::MsgReceive( plMessage* pMsg )
|
||||
|
||||
// add a callback for when it's done if it's in forward
|
||||
plLinkEffectsMgr *mgr;
|
||||
if (mgr = plLinkEffectsMgr::ConvertNoRef(pMsg->GetSender()->ObjectIsLoaded()))
|
||||
if ((mgr = plLinkEffectsMgr::ConvertNoRef(pMsg->GetSender()->ObjectIsLoaded())))
|
||||
if (pSeudoMsg->fForward)
|
||||
mgr->WaitForPseudoEffect(fLinkKey, fTimeConvert.GetEnd() - fTimeConvert.GetBegin());
|
||||
|
||||
|
@ -437,7 +437,7 @@ gemQuat snuggle(gemQuat q, HVect *k)
|
||||
mag[0] = (double)q.z*q.z+(double)q.w*q.w-0.5;
|
||||
mag[1] = (double)q.x*q.z-(double)q.y*q.w;
|
||||
mag[2] = (double)q.y*q.z+(double)q.x*q.w;
|
||||
for (i=0; i<3; i++) if (neg[i] = (mag[i]<0.0)) mag[i] = -mag[i];
|
||||
for (i=0; i<3; i++) if ((neg[i] = (mag[i]<0.0))) mag[i] = -mag[i];
|
||||
if (mag[0]>mag[1]) {if (mag[0]>mag[2]) win = 0; else win = 2;}
|
||||
else {if (mag[1]>mag[2]) win = 1; else win = 2;}
|
||||
switch (win) {
|
||||
@ -456,7 +456,7 @@ gemQuat snuggle(gemQuat q, HVect *k)
|
||||
qa[0] = q.x; qa[1] = q.y; qa[2] = q.z; qa[3] = q.w;
|
||||
for (i=0; i<4; i++) {
|
||||
pa[i] = 0.0;
|
||||
if (neg[i] = (qa[i]<0.0)) qa[i] = -qa[i];
|
||||
if ((neg[i] = (qa[i]<0.0))) qa[i] = -qa[i];
|
||||
par ^= neg[i];
|
||||
}
|
||||
/* Find two largest components, indices in hi and lo */
|
||||
|
Reference in New Issue
Block a user