Skip to content

Commit

Permalink
Some cross-platform code cleanups.
Browse files Browse the repository at this point in the history
Conflicts:
	Sources/Plasma/CoreLib/HeadSpin.h
  • Loading branch information
dpogue committed Nov 2, 2014
1 parent 453d977 commit f7b67e9
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 20 deletions.
4 changes: 2 additions & 2 deletions Sources/Plasma/CoreLib/HeadSpin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,13 @@ void ErrorAssert(int line, const char* file, const char* fmt, ...)
va_list args;
va_start(args, fmt);
vsnprintf(msg, arrsize(msg), fmt, args);
#ifdef HS_DEBUGGING
#ifdef _MSC_VER
if (s_GuiAsserts)
{
if(_CrtDbgReport(_CRT_ASSERT, file, line, NULL, msg))
DebugBreak();
} else
#endif // HS_DEBUGGING
#endif // _MSC_VER
if (DebugIsDebuggerPresent()) {
char str[] = "-------\nASSERTION FAILED:\nFile: %s Line: %i\nMessage: %s\n-------";
DebugMsg(str, file, line, msg);
Expand Down
4 changes: 2 additions & 2 deletions Sources/Plasma/NucleusLib/pnUtils/pnUtArray.h
Original file line number Diff line number Diff line change
Expand Up @@ -829,8 +829,8 @@ template<class T, class C>
void TArray<T,C>::Copy (unsigned destIndex, unsigned sourceIndex, unsigned count) {

// Copy the data to the destination
ASSERT(destIndex + count <= m_count);
ASSERT(sourceIndex + count <= m_count);
ASSERT(destIndex + count <= this->m_count);
ASSERT(sourceIndex + count <= this->m_count);
C::Assign(this->m_data + destIndex, this->m_data + sourceIndex, count);

}
Expand Down
4 changes: 2 additions & 2 deletions Sources/Plasma/PubUtilLib/plDrawable/plMorphSequence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ bool plMorphSequence::MsgReceive(plMessage* msg)
// Can always add it in later if desired.
if( fTgtWgts.GetCount() )
{
float delWgt = hsTimer::GetDelSysSeconds() / (kMorphTime > 0 ? kMorphTime : 1.e-3f);
float delWgt = hsTimer::GetDelSysSeconds() / (kMorphTime > 0 ? float(kMorphTime) : 1.e-3f);
int i;
for( i = 0; i < fTgtWgts.GetCount(); i++ )
{
Expand Down Expand Up @@ -820,4 +820,4 @@ void plMorphSequence::ISetSingleSharedToGlobal(int idx)
int i;
for (i = 0; i < fSharedMeshes[fGlobalLayerRef].fArrayWeights[0].fDeltaWeights.GetCount(); i++)
SetWeight(0, i, fSharedMeshes[fGlobalLayerRef].fArrayWeights[0].fDeltaWeights[i], fSharedMeshes[idx].fMesh->GetKey());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ void plMorphSequenceSDLMod::ISetCurrentStateFrom(const plStateDataRecord* srcSta
{
plKey meshKey;
morphSD->GetStateDataRecord(i)->FindVar(kStrMesh)->Get(&meshKey);
if (meshKey && !meshKey->GetUoid().GetClassType() == plSharedMesh::Index())
if (meshKey && meshKey->GetUoid().GetClassType() != plSharedMesh::Index())
continue;

// meshKey will be nil when dealing with non-sharedMesh data
Expand Down
2 changes: 2 additions & 0 deletions Sources/Plasma/PubUtilLib/plFile/plSecureStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,9 @@ uint32_t plSecureStream::IRead(uint32_t bytes, void* buffer)
}
else
{
#if HS_BUILD_FOR_WIN32
hsDebugMessage("Error on Windows read", GetLastError());
#endif
}
}
return numItems;
Expand Down
12 changes: 4 additions & 8 deletions Sources/Plasma/PubUtilLib/plGLight/plPerspDirSlave.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include <cfloat>
#include <cmath>

#ifdef HS_BUILD_FOR_WIN32
#define isnan _isnan
#endif

void plPerspDirSlave::Init()
{
plShadowSlave::Init();
Expand Down Expand Up @@ -188,9 +184,9 @@ bool plPerspDirSlave::SetupViewTransform(plPipeline* pipe)
// is probably data-side. I take full responsibility for this
// hack-around breaking the entire system, loosing data, causing
// unauthorized credit card transactions, etc.
if (isnan(bnd.GetMins().fX) || isnan(bnd.GetMins().fY))
if (std::isnan(bnd.GetMins().fX) || std::isnan(bnd.GetMins().fY))
return false;
if (isnan(bnd.GetMaxs().fX) || isnan(bnd.GetMaxs().fY))
if (std::isnan(bnd.GetMaxs().fX) || std::isnan(bnd.GetMaxs().fY))
return false;

// THIS IS EVEN MORE WRONG
Expand Down Expand Up @@ -249,9 +245,9 @@ bool plPerspDirSlave::SetupViewTransform(plPipeline* pipe)
// is probably data-side. I take full responsibility for this
// hack-around breaking the entire system, loosing data, causing
// unauthorized credit card transactions, etc.
if (isnan(bnd.GetMins().fX) || isnan(bnd.GetMins().fY))
if (std::isnan(bnd.GetMins().fX) || std::isnan(bnd.GetMins().fY))
return false;
if (isnan(bnd.GetMaxs().fX) || isnan(bnd.GetMaxs().fY))
if (std::isnan(bnd.GetMaxs().fX) || std::isnan(bnd.GetMaxs().fY))
return false;

plConst(float) kMinMinZ(1.f);
Expand Down
7 changes: 2 additions & 5 deletions Sources/Plasma/PubUtilLib/plGLight/plShadowSlave.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include <cfloat>
#include <cmath>

#ifdef HS_BUILD_FOR_WIN32
#define isnan _isnan
#endif

static const float kMinMinZ = 1.f; // totally random arbitrary number (has to be > 0).

Expand Down Expand Up @@ -137,9 +134,9 @@ bool plShadowSlave::ISetupPerspViewTransform()
// is probably data-side. I take full responsibility for this
// hack-around breaking the entire system, loosing data, causing
// unauthorized credit card transactions, etc.
if (isnan(bnd.GetMins().fX) || isnan(bnd.GetMins().fY))
if (std::isnan(bnd.GetMins().fX) || std::isnan(bnd.GetMins().fY))
return false;
if (isnan(bnd.GetMaxs().fX) || isnan(bnd.GetMaxs().fY))
if (std::isnan(bnd.GetMaxs().fX) || std::isnan(bnd.GetMaxs().fY))
return false;

float cotX, cotY;
Expand Down

0 comments on commit f7b67e9

Please sign in to comment.