mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-17 10:52:46 +00:00
Fix Endian functions names in hsTypes and hsStream.
Function and macro names for endianness were previously vague, and on big-endian systems entirely misleading. The names are now properly descriptive of what they actually do.
This commit is contained in:
@ -304,33 +304,33 @@ std::string plClientGuid::AsLogString() const
|
||||
void plClientGuid::Read(hsStream * s, hsResMgr* mgr)
|
||||
{
|
||||
s->LogSubStreamStart("push me");
|
||||
s->LogReadSwap(&fFlags,"Flags");
|
||||
s->LogReadLE(&fFlags,"Flags");
|
||||
if (IsFlagSet(kAccountUUID))
|
||||
{
|
||||
s->LogSubStreamPushDesc("AcctUUID");
|
||||
fAccountUUID.Read( s );
|
||||
}
|
||||
if (IsFlagSet(kPlayerID))
|
||||
s->LogReadSwap(&fPlayerID,"PlayerID");
|
||||
s->LogReadLE(&fPlayerID,"PlayerID");
|
||||
else if (IsFlagSet(kTempPlayerID))
|
||||
s->LogReadSwap(&fPlayerID,"TempPlayerID");
|
||||
s->LogReadLE(&fPlayerID,"TempPlayerID");
|
||||
if (IsFlagSet(kPlayerName))
|
||||
{
|
||||
s->LogSubStreamPushDesc("PlayerName");
|
||||
plMsgStdStringHelper::Peek( fPlayerName, s );
|
||||
}
|
||||
if (IsFlagSet(kCCRLevel))
|
||||
s->LogReadSwap(&fCCRLevel,"CCRLevel");
|
||||
s->LogReadLE(&fCCRLevel,"CCRLevel");
|
||||
if (IsFlagSet(kProtectedLogin))
|
||||
s->LogReadSwap(&fProtectedLogin,"ProtectedLogin");
|
||||
s->LogReadLE(&fProtectedLogin,"ProtectedLogin");
|
||||
if (IsFlagSet(kBuildType))
|
||||
s->LogReadSwap(&fBuildType,"BuildType");
|
||||
s->LogReadLE(&fBuildType,"BuildType");
|
||||
if (IsFlagSet(kSrcAddr))
|
||||
s->LogReadSwap(&fSrcAddr,"SrcAddr");
|
||||
s->LogReadLE(&fSrcAddr,"SrcAddr");
|
||||
if (IsFlagSet(kSrcPort))
|
||||
s->LogReadSwap(&fSrcPort,"SrcPort");
|
||||
s->LogReadLE(&fSrcPort,"SrcPort");
|
||||
if (IsFlagSet(kReserved))
|
||||
s->LogReadSwap(&fReserved,"Reserved");
|
||||
s->LogReadLE(&fReserved,"Reserved");
|
||||
if (IsFlagSet(kClientKey))
|
||||
{
|
||||
s->LogSubStreamPushDesc("ClientKey");
|
||||
@ -341,27 +341,27 @@ void plClientGuid::Read(hsStream * s, hsResMgr* mgr)
|
||||
|
||||
void plClientGuid::Write(hsStream * s, hsResMgr* mgr)
|
||||
{
|
||||
s->WriteSwap(fFlags);
|
||||
s->WriteLE(fFlags);
|
||||
if (IsFlagSet(kAccountUUID))
|
||||
fAccountUUID.Write( s );
|
||||
if (IsFlagSet(kPlayerID))
|
||||
s->WriteSwap(fPlayerID);
|
||||
s->WriteLE(fPlayerID);
|
||||
else if (IsFlagSet(kTempPlayerID))
|
||||
s->WriteSwap(fPlayerID);
|
||||
s->WriteLE(fPlayerID);
|
||||
if (IsFlagSet(kPlayerName))
|
||||
plMsgStdStringHelper::Poke( fPlayerName, s );
|
||||
if (IsFlagSet(kCCRLevel))
|
||||
s->WriteSwap(fCCRLevel);
|
||||
s->WriteLE(fCCRLevel);
|
||||
if (IsFlagSet(kProtectedLogin))
|
||||
s->WriteSwap(fProtectedLogin);
|
||||
s->WriteLE(fProtectedLogin);
|
||||
if (IsFlagSet(kBuildType))
|
||||
s->WriteSwap(fBuildType);
|
||||
s->WriteLE(fBuildType);
|
||||
if (IsFlagSet(kSrcAddr))
|
||||
s->WriteSwap(fSrcAddr);
|
||||
s->WriteLE(fSrcAddr);
|
||||
if (IsFlagSet(kSrcPort))
|
||||
s->WriteSwap(fSrcPort);
|
||||
s->WriteLE(fSrcPort);
|
||||
if (IsFlagSet(kReserved))
|
||||
s->WriteSwap(fReserved);
|
||||
s->WriteLE(fReserved);
|
||||
if (IsFlagSet(kClientKey))
|
||||
plMsgStdStringHelper::Poke( fClientKey, s );
|
||||
}
|
||||
|
@ -68,27 +68,27 @@ fDLDroppedPackets(0)
|
||||
void plNetCoreStatsSummary::Read(hsStream* s, hsResMgr*)
|
||||
{
|
||||
UInt8 streamVer;
|
||||
s->ReadSwap(&streamVer);
|
||||
s->ReadLE(&streamVer);
|
||||
hsAssert(streamVer==StreamVersion,"plNetCoreStatsSummary invalid stream version.");
|
||||
s->ReadSwap(&fULBitsPS);
|
||||
s->ReadSwap(&fDLBitsPS);
|
||||
s->ReadSwap(&fULPeakBitsPS);
|
||||
s->ReadSwap(&fDLPeakBitsPS);
|
||||
s->ReadSwap(&fULPeakPktsPS);
|
||||
s->ReadSwap(&fDLPeakPktsPS);
|
||||
s->ReadSwap(&fDLDroppedPackets);
|
||||
s->ReadLE(&fULBitsPS);
|
||||
s->ReadLE(&fDLBitsPS);
|
||||
s->ReadLE(&fULPeakBitsPS);
|
||||
s->ReadLE(&fDLPeakBitsPS);
|
||||
s->ReadLE(&fULPeakPktsPS);
|
||||
s->ReadLE(&fDLPeakPktsPS);
|
||||
s->ReadLE(&fDLDroppedPackets);
|
||||
}
|
||||
|
||||
void plNetCoreStatsSummary::Write(hsStream* s, hsResMgr*)
|
||||
{
|
||||
s->WriteSwap(StreamVersion);
|
||||
s->WriteSwap(fULBitsPS);
|
||||
s->WriteSwap(fDLBitsPS);
|
||||
s->WriteSwap(fULPeakBitsPS);
|
||||
s->WriteSwap(fDLPeakBitsPS);
|
||||
s->WriteSwap(fULPeakPktsPS);
|
||||
s->WriteSwap(fDLPeakPktsPS);
|
||||
s->WriteSwap(fDLDroppedPackets);
|
||||
s->WriteLE(StreamVersion);
|
||||
s->WriteLE(fULBitsPS);
|
||||
s->WriteLE(fDLBitsPS);
|
||||
s->WriteLE(fULPeakBitsPS);
|
||||
s->WriteLE(fDLPeakBitsPS);
|
||||
s->WriteLE(fULPeakPktsPS);
|
||||
s->WriteLE(fDLPeakPktsPS);
|
||||
s->WriteLE(fDLDroppedPackets);
|
||||
}
|
||||
#endif // SERVER
|
||||
|
||||
@ -224,19 +224,19 @@ void plCreatableListHelper::Read( hsStream* s, hsResMgr* mgr )
|
||||
|
||||
s->LogSubStreamStart("CreatableListHelper");
|
||||
|
||||
s->LogReadSwap( &fFlags, "Flags" );
|
||||
s->LogReadLE( &fFlags, "Flags" );
|
||||
|
||||
fFlags &= ~kWritten;
|
||||
|
||||
UInt32 bufSz;
|
||||
s->LogReadSwap( &bufSz, "BufSz" );
|
||||
s->LogReadLE( &bufSz, "BufSz" );
|
||||
std::string buf;
|
||||
buf.resize( bufSz );
|
||||
|
||||
if ( fFlags&kCompressed )
|
||||
{
|
||||
UInt32 zBufSz;
|
||||
s->LogReadSwap( &zBufSz, "Compressed BufSz" );
|
||||
s->LogReadLE( &zBufSz, "Compressed BufSz" );
|
||||
std::string zBuf;
|
||||
zBuf.resize( zBufSz );
|
||||
s->LogSubStreamPushDesc("Compressed Data");
|
||||
@ -258,13 +258,13 @@ void plCreatableListHelper::Read( hsStream* s, hsResMgr* mgr )
|
||||
hsReadOnlyStream ram( bufSz, (void*)buf.data() );
|
||||
|
||||
UInt16 nItems;
|
||||
ram.ReadSwap( &nItems );
|
||||
ram.ReadLE( &nItems );
|
||||
for ( int i=0; i<nItems; i++ )
|
||||
{
|
||||
UInt16 id;
|
||||
UInt16 classIdx;
|
||||
ram.ReadSwap( &id );
|
||||
ram.ReadSwap( &classIdx );
|
||||
ram.ReadLE( &id );
|
||||
ram.ReadLE( &classIdx );
|
||||
plCreatable * object = plFactory::Create( classIdx );
|
||||
hsAssert( object,"plCreatableListHelper: Failed to create plCreatable object (invalid class index?)" );
|
||||
if ( object )
|
||||
@ -283,14 +283,14 @@ void plCreatableListHelper::Write( hsStream* s, hsResMgr* mgr )
|
||||
// write items to ram stream
|
||||
hsRAMStream ram;
|
||||
UInt16 nItems = fItems.size();
|
||||
ram.WriteSwap( nItems );
|
||||
ram.WriteLE( nItems );
|
||||
for ( std::map<UInt16,plCreatable*>::iterator ii=fItems.begin(); ii!=fItems.end(); ++ii )
|
||||
{
|
||||
UInt16 id = ii->first;
|
||||
plCreatable * item = ii->second;
|
||||
UInt16 classIdx = item->ClassIndex();
|
||||
ram.WriteSwap( id );
|
||||
ram.WriteSwap( classIdx );
|
||||
ram.WriteLE( id );
|
||||
ram.WriteLE( classIdx );
|
||||
item->Write( &ram, mgr );
|
||||
}
|
||||
|
||||
@ -322,13 +322,13 @@ void plCreatableListHelper::Write( hsStream* s, hsResMgr* mgr )
|
||||
|
||||
ram.Truncate();
|
||||
|
||||
ram.WriteSwap( fFlags );
|
||||
ram.WriteSwap( bufSz );
|
||||
ram.WriteLE( fFlags );
|
||||
ram.WriteLE( bufSz );
|
||||
|
||||
if ( fFlags&kCompressed )
|
||||
{
|
||||
UInt32 zBufSz = buf.size();
|
||||
ram.WriteSwap( zBufSz );
|
||||
ram.WriteLE( zBufSz );
|
||||
}
|
||||
|
||||
ram.Write( buf.size(), buf.data() );
|
||||
|
@ -60,7 +60,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
void plAgeInfoStruct::Read( hsStream * s, hsResMgr* )
|
||||
{
|
||||
s->LogSubStreamStart("push me");
|
||||
s->LogReadSwap( &fFlags ,"AgeInfoStruct Flags");
|
||||
s->LogReadLE( &fFlags ,"AgeInfoStruct Flags");
|
||||
if ( IsFlagSet( kHasAgeFilename ) ) {
|
||||
s->LogSubStreamPushDesc("AgeFilename");
|
||||
plMsgStdStringHelper::Peek(fAgeFilename,s);
|
||||
@ -78,14 +78,14 @@ void plAgeInfoStruct::Read( hsStream * s, hsResMgr* )
|
||||
plMsgStdStringHelper::Peek(fAgeUserDefinedName,s);
|
||||
}
|
||||
if ( IsFlagSet( kHasAgeSequenceNumber ) ) {
|
||||
s->LogReadSwap( &fAgeSequenceNumber ,"AgeSequenceNumber");
|
||||
s->LogReadLE( &fAgeSequenceNumber ,"AgeSequenceNumber");
|
||||
}
|
||||
if ( IsFlagSet( kHasAgeDescription ) ) {
|
||||
s->LogSubStreamPushDesc("AgeDescription");
|
||||
plMsgStdStringHelper::Peek(fAgeDescription,s);
|
||||
}
|
||||
if ( IsFlagSet( kHasAgeLanguage ) ) {
|
||||
s->LogReadSwap( &fAgeLanguage ,"AgeLanguage");
|
||||
s->LogReadLE( &fAgeLanguage ,"AgeLanguage");
|
||||
}
|
||||
UpdateFlags();
|
||||
s->LogSubStreamEnd();
|
||||
@ -94,7 +94,7 @@ void plAgeInfoStruct::Read( hsStream * s, hsResMgr* )
|
||||
void plAgeInfoStruct::Write( hsStream * s, hsResMgr* )
|
||||
{
|
||||
UpdateFlags();
|
||||
s->WriteSwap( fFlags );
|
||||
s->WriteLE( fFlags );
|
||||
if ( IsFlagSet( kHasAgeFilename ) )
|
||||
plMsgStdStringHelper::Poke(fAgeFilename,s);
|
||||
if ( IsFlagSet( kHasAgeInstanceName ) )
|
||||
@ -104,11 +104,11 @@ void plAgeInfoStruct::Write( hsStream * s, hsResMgr* )
|
||||
if ( IsFlagSet( kHasAgeUserDefinedName ) )
|
||||
plMsgStdStringHelper::Poke(fAgeUserDefinedName,s);
|
||||
if ( IsFlagSet( kHasAgeSequenceNumber ) )
|
||||
s->WriteSwap( fAgeSequenceNumber );
|
||||
s->WriteLE( fAgeSequenceNumber );
|
||||
if ( IsFlagSet( kHasAgeDescription ) )
|
||||
plMsgStdStringHelper::Poke(fAgeDescription,s);
|
||||
if ( IsFlagSet( kHasAgeLanguage ) )
|
||||
s->WriteSwap( fAgeLanguage );
|
||||
s->WriteLE( fAgeLanguage );
|
||||
}
|
||||
|
||||
bool plAgeInfoStruct::IsEqualTo( const plAgeInfoStruct * other ) const
|
||||
@ -379,13 +379,13 @@ plAgeLinkStruct::plAgeLinkStruct()
|
||||
void plAgeLinkStruct::Read( hsStream * s, hsResMgr* m)
|
||||
{
|
||||
s->LogSubStreamStart("push me");
|
||||
s->LogReadSwap( &fFlags ,"AgeLinkStruct Flags");
|
||||
s->LogReadLE( &fFlags ,"AgeLinkStruct Flags");
|
||||
if ( IsFlagSet( kHasAgeInfo ) ) {
|
||||
s->LogSubStreamPushDesc("AgeInfo");
|
||||
fAgeInfo.Read( s,m );
|
||||
}
|
||||
if ( IsFlagSet( kHasLinkingRules ) )
|
||||
s->LogReadSwap( &fLinkingRules ,"LinkingRules");
|
||||
s->LogReadLE( &fLinkingRules ,"LinkingRules");
|
||||
if ( IsFlagSet( kHasSpawnPt_DEAD ) )
|
||||
{
|
||||
std::string str;
|
||||
@ -412,7 +412,7 @@ void plAgeLinkStruct::Read( hsStream * s, hsResMgr* m)
|
||||
fSpawnPoint.Read( s );
|
||||
}
|
||||
if ( IsFlagSet( kHasAmCCR ) )
|
||||
s->LogReadSwap( &fAmCCR ,"AmCCR");
|
||||
s->LogReadLE( &fAmCCR ,"AmCCR");
|
||||
|
||||
if ( IsFlagSet( kHasParentAgeFilename ) )
|
||||
{
|
||||
@ -423,15 +423,15 @@ void plAgeLinkStruct::Read( hsStream * s, hsResMgr* m)
|
||||
|
||||
void plAgeLinkStruct::Write( hsStream * s, hsResMgr* m)
|
||||
{
|
||||
s->WriteSwap( fFlags );
|
||||
s->WriteLE( fFlags );
|
||||
if ( IsFlagSet( kHasAgeInfo ) )
|
||||
fAgeInfo.Write( s,m );
|
||||
if ( IsFlagSet( kHasLinkingRules ) )
|
||||
s->WriteSwap( fLinkingRules );
|
||||
s->WriteLE( fLinkingRules );
|
||||
if ( IsFlagSet( kHasSpawnPt ) )
|
||||
fSpawnPoint.Write( s );
|
||||
if ( IsFlagSet( kHasAmCCR ) )
|
||||
s->WriteSwap( fAmCCR );
|
||||
s->WriteLE( fAmCCR );
|
||||
if ( IsFlagSet( kHasParentAgeFilename ) )
|
||||
plMsgStdStringHelper::Poke(fParentAgeFilename,s);
|
||||
}
|
||||
@ -543,19 +543,19 @@ void plNetServerSessionInfo::Read(hsStream* s, hsResMgr*)
|
||||
{
|
||||
Clear();
|
||||
s->LogSubStreamStart("push me");
|
||||
s->LogReadSwap(&fFlags,"ServerSessionInfo Flags");
|
||||
s->LogReadLE(&fFlags,"ServerSessionInfo Flags");
|
||||
if (IsFlagSet(kHasServerName)){
|
||||
s->LogSubStreamPushDesc("ServerName");
|
||||
plMsgStdStringHelper::Peek(fServerName,s);
|
||||
}
|
||||
if (IsFlagSet(kHasServerType))
|
||||
s->LogReadSwap(&fServerType,"ServerType");
|
||||
s->LogReadLE(&fServerType,"ServerType");
|
||||
if (IsFlagSet(kHasServerAddr)){
|
||||
s->LogSubStreamPushDesc("ServerAddr");
|
||||
plMsgStdStringHelper::Peek(fServerAddr,s);
|
||||
}
|
||||
if (IsFlagSet(kHasServerPort))
|
||||
s->LogReadSwap(&fServerPort,"ServerPort");
|
||||
s->LogReadLE(&fServerPort,"ServerPort");
|
||||
if (IsFlagSet(kHasServerGuid)){
|
||||
s->LogSubStreamPushDesc("ServerGuid");
|
||||
fServerGuid.Read(s);
|
||||
@ -564,15 +564,15 @@ void plNetServerSessionInfo::Read(hsStream* s, hsResMgr*)
|
||||
|
||||
void plNetServerSessionInfo::Write(hsStream* s, hsResMgr*)
|
||||
{
|
||||
s->WriteSwap(fFlags);
|
||||
s->WriteLE(fFlags);
|
||||
if (IsFlagSet(kHasServerName))
|
||||
plMsgStdStringHelper::Poke(fServerName,s);
|
||||
if (IsFlagSet(kHasServerType))
|
||||
s->WriteSwap(fServerType);
|
||||
s->WriteLE(fServerType);
|
||||
if (IsFlagSet(kHasServerAddr))
|
||||
plMsgStdStringHelper::Poke(fServerAddr,s);
|
||||
if (IsFlagSet(kHasServerPort))
|
||||
s->WriteSwap(fServerPort);
|
||||
s->WriteLE(fServerPort);
|
||||
if (IsFlagSet(kHasServerGuid))
|
||||
fServerGuid.Write(s);
|
||||
}
|
||||
|
Reference in New Issue
Block a user