From b790403c87ed6ca20a046d2f0f91329b3d7d301d Mon Sep 17 00:00:00 2001 From: elexis Date: Mon, 21 Dec 2015 13:58:32 +0000 Subject: [PATCH] Strip trailing whitespace from network code. This was SVN commit r17524. --- source/network/NMTCreator.h | 4 ++-- source/network/NetClient.cpp | 14 +++++++------- source/network/NetClient.h | 10 +++++----- source/network/NetMessage.h | 8 ++++---- source/network/NetMessages.h | 2 +- source/network/NetServer.cpp | 12 ++++++------ source/network/NetServer.h | 4 ++-- source/network/NetTurnManager.cpp | 2 +- source/network/NetTurnManager.h | 4 ++-- source/network/Serialization.h | 6 +++--- source/network/fsm.cpp | 16 ++++++++-------- source/network/fsm.h | 16 ++++++++-------- 12 files changed, 49 insertions(+), 49 deletions(-) diff --git a/source/network/NMTCreator.h b/source/network/NMTCreator.h index f4ad582751..0e88586035 100644 --- a/source/network/NMTCreator.h +++ b/source/network/NMTCreator.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010 Wildfire Games. +/* Copyright (C) 2015 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -91,7 +91,7 @@ public: \ * @param _netsz The number of bytes that should be serialized. If the variable * has a value larger than the maximum value of the specified network size, * higher order bytes will be discarded. - */ + */ #define NMT_FIELD_INT(_nm, _hosttp, _netsz) \ _hosttp _nm; diff --git a/source/network/NetClient.cpp b/source/network/NetClient.cpp index b70e5758dd..ca8f8efbee 100644 --- a/source/network/NetClient.cpp +++ b/source/network/NetClient.cpp @@ -75,7 +75,7 @@ CNetClient::CNetClient(CGame* game) : m_Game->SetTurnManager(NULL); // delete the old local turn manager so we don't accidentally use it void* context = this; - + JS_AddExtraGCRootsTracer(GetScriptInterface().GetJSRuntime(), CNetClient::Trace, this); // Set up transitions for session @@ -193,7 +193,7 @@ void CNetClient::GuiPoll(JS::MutableHandleValue ret) } void CNetClient::PushGuiMessage(const JS::HandleValue message) -{ +{ ENSURE(!message.isUndefined()); m_GuiMessageQueue.push_back(JS::Heap(message)); @@ -203,7 +203,7 @@ std::string CNetClient::TestReadGuiMessages() { JSContext* cx = GetScriptInterface().GetContext(); JSAutoRequest rq(cx); - + std::string r; JS::RootedValue msg(cx); while (true) @@ -225,7 +225,7 @@ void CNetClient::PostPlayerAssignmentsToScript() { JSContext* cx = GetScriptInterface().GetContext(); JSAutoRequest rq(cx); - + JS::RootedValue msg(cx); GetScriptInterface().Eval("({'type':'players', 'hosts':{}})", &msg); @@ -262,7 +262,7 @@ void CNetClient::HandleDisconnect(u32 reason) { JSContext* cx = GetScriptInterface().GetContext(); JSAutoRequest rq(cx); - + JS::RootedValue msg(cx); GetScriptInterface().Eval("({'type':'netstatus','status':'disconnected'})", &msg); GetScriptInterface().SetProperty(msg, "reason", (int)reason, false); @@ -342,7 +342,7 @@ void CNetClient::LoadFinished() { JSContext* cx = GetScriptInterface().GetContext(); JSAutoRequest rq(cx); - + if (!m_JoinSyncBuffer.empty()) { // We're rejoining a game, and just finished loading the initial map, @@ -432,7 +432,7 @@ bool CNetClient::OnAuthenticate(void* context, CFsmEvent* event) ENSURE(event->GetType() == (uint)NMT_AUTHENTICATE_RESULT); CNetClient* client = (CNetClient*)context; - + JSContext* cx = client->GetScriptInterface().GetContext(); JSAutoRequest rq(cx); diff --git a/source/network/NetClient.h b/source/network/NetClient.h index cb1fff221c..98d153176a 100644 --- a/source/network/NetClient.h +++ b/source/network/NetClient.h @@ -68,10 +68,10 @@ public: CNetClient(CGame* game); virtual ~CNetClient(); - + /** * We assume that adding a tracing function that's only called - * during GC is better for performance than using a + * during GC is better for performance than using a * PersistentRooted where each value needs to be added to * the root set. */ @@ -79,9 +79,9 @@ public: { reinterpret_cast(data)->TraceMember(trc); } - + void TraceMember(JSTracer *trc); - + /** * Set the user's name that will be displayed to all players. * This must not be called after the connection setup. @@ -177,7 +177,7 @@ public: void LoadFinished(); void SendChatMessage(const std::wstring& text); - + void SendReadyMessage(const int status); /** diff --git a/source/network/NetMessage.h b/source/network/NetMessage.h index 5c71322d37..c0b760027d 100644 --- a/source/network/NetMessage.h +++ b/source/network/NetMessage.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010 Wildfire Games. +/* Copyright (C) 2015 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -46,8 +46,8 @@ public: NetMessageType GetType() const { return m_Type; } /** - * Serialize the message into the specified buffer parameter. The size - * required by the buffer parameter can be found by a call to + * Serialize the message into the specified buffer parameter. The size + * required by the buffer parameter can be found by a call to * GetSerializedLength method. The information contained within the message * must be serialized before the message is sent. By default only the * message type and its size are serialized in the buffer parameter. @@ -116,7 +116,7 @@ public: CSimulationMessage(ScriptInterface& scriptInterface); CSimulationMessage(ScriptInterface& scriptInterface, u32 client, i32 player, u32 turn, JS::HandleValue data); - /** The compiler can't create a copy constructor because of the PersistentRooted member, + /** The compiler can't create a copy constructor because of the PersistentRooted member, * so we have to write it manually. * NOTE: It doesn't clone the m_Data member and the copy will reference the same JS::Value! */ diff --git a/source/network/NetMessages.h b/source/network/NetMessages.h index 81e58ad78a..0ee8097217 100644 --- a/source/network/NetMessages.h +++ b/source/network/NetMessages.h @@ -33,7 +33,7 @@ // Defines the list of message types. The order of the list must not change. // The message types having a negative value are used internally and not sent -// over the network. The message types used for network communication have +// over the network. The message types used for network communication have // positive values. enum NetMessageType { diff --git a/source/network/NetServer.cpp b/source/network/NetServer.cpp index 2e94b1b024..616183ea44 100644 --- a/source/network/NetServer.cpp +++ b/source/network/NetServer.cpp @@ -315,7 +315,7 @@ void* CNetServerWorker::SetupUPnP(void*) // Make sure everything is properly freed. if (allocatedUrls) FreeUPNPUrls(&urls); - + freeUPNPDevlist(devlist); return NULL; @@ -366,7 +366,7 @@ void CNetServerWorker::Run() { // The script runtime uses the profiler and therefore the thread must be registered before the runtime is created g_Profiler2.RegisterCurrentThread("Net server"); - + // To avoid the need for JS_SetContextThread, we create and use and destroy // the script interface entirely within this network thread m_ScriptInterface = new ScriptInterface("Engine", "Net server", ScriptInterface::CreateRuntime(g_ScriptRuntime)); @@ -384,7 +384,7 @@ void CNetServerWorker::Run() // Update profiler stats m_Stats->LatchHostState(m_Host); } - + // Clear roots before deleting their context m_GameAttributes.clear(); m_SavedCommands.clear(); @@ -397,9 +397,9 @@ bool CNetServerWorker::RunStep() // Check for messages from the game thread. // (Do as little work as possible while the mutex is held open, // to avoid performance problems and deadlocks.) - + m_ScriptInterface->GetRuntime()->MaybeIncrementalGC(0.5f); - + JSContext* cx = m_ScriptInterface->GetContext(); JSAutoRequest rq(cx); @@ -1029,7 +1029,7 @@ bool CNetServerWorker::OnJoinSyncingLoadedGame(void* context, CFsmEvent* event) // The simulation may have progressed since then, so send any subsequent // commands to them and set them as an active player so they can participate // in all future turns. - // + // // (TODO: if it takes a long time for them to receive and execute all these // commands, the other players will get frozen for that time and may be unhappy; // we could try repeating this process a few times until the client converges diff --git a/source/network/NetServer.h b/source/network/NetServer.h index 854bc0617c..5794c15756 100644 --- a/source/network/NetServer.h +++ b/source/network/NetServer.h @@ -122,7 +122,7 @@ public: * The changes will be asynchronously propagated to all clients. */ void AssignPlayer(int playerID, const CStr& guid); - + /** * Call from the GUI to update the player readiness. * The changes will be asynchronously propagated to all clients. @@ -255,7 +255,7 @@ private: void AddPlayer(const CStr& guid, const CStrW& name); void RemovePlayer(const CStr& guid); - void SetPlayerReady(const CStr& guid, const int ready); + void SetPlayerReady(const CStr& guid, const int ready); void SendPlayerAssignments(); void ClearAllPlayerReady(); diff --git a/source/network/NetTurnManager.cpp b/source/network/NetTurnManager.cpp index 57dc11c2f6..9cbcf4b179 100644 --- a/source/network/NetTurnManager.cpp +++ b/source/network/NetTurnManager.cpp @@ -351,7 +351,7 @@ void CNetTurnManager::RewindTimeWarp() void CNetTurnManager::QuickSave() { TIMER(L"QuickSave"); - + std::stringstream stream; if (!m_Simulation2.SerializeState(stream)) { diff --git a/source/network/NetTurnManager.h b/source/network/NetTurnManager.h index bdeaea3596..8c3aa4f21a 100644 --- a/source/network/NetTurnManager.h +++ b/source/network/NetTurnManager.h @@ -74,7 +74,7 @@ public: * Advance the simulation by a certain time. If this brings us past the current * turn length, the next turns are processed and the function returns true. * Otherwise, nothing happens and it returns false. - * + * * @param simFrameLength Length of the previous frame, in simulation seconds * @param maxTurns Maximum number of turns to simulate at once */ @@ -212,7 +212,7 @@ public: virtual void OnSimulationMessage(CSimulationMessage* msg); virtual void PostCommand(JS::HandleValue data); - + /** * Notifiy the server that all commands are sent to prepare the connection for termination. */ diff --git a/source/network/Serialization.h b/source/network/Serialization.h index 90b439092f..476d52aa6e 100644 --- a/source/network/Serialization.h +++ b/source/network/Serialization.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010 Wildfire Games. +/* Copyright (C) 2015 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -83,7 +83,7 @@ public: virtual size_t GetSerializedLength() const = 0; /** * Serialize the object into the passed buffer. - * + * * @return a pointer to the location in the buffer right after the * serialized object */ @@ -95,7 +95,7 @@ public: * * @param buffer A pointer pointing to the start of the serialized data. * @param end A pointer to the end of the message. - * + * * @returns a pointer to the location in the buffer right after the * serialized object, or NULL if there was a data format error */ diff --git a/source/network/fsm.cpp b/source/network/fsm.cpp index 6b4f08017f..8dcbcb93c5 100644 --- a/source/network/fsm.cpp +++ b/source/network/fsm.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2013 Wildfire Games. +/* Copyright (C) 2015 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -269,7 +269,7 @@ CFsmEvent* CFsm::AddEvent( unsigned int eventType ) // Name: AddTransition() // Desc: Adds a new transistion to the state machine //----------------------------------------------------------------------------- -CFsmTransition* CFsm::AddTransition( +CFsmTransition* CFsm::AddTransition( unsigned int state, unsigned int eventType, unsigned int nextState ) @@ -306,7 +306,7 @@ CFsmTransition* CFsm::AddTransition( // Name: AddTransition() // Desc: Adds a new transition to the state machine //----------------------------------------------------------------------------- -CFsmTransition* CFsm::AddTransition( +CFsmTransition* CFsm::AddTransition( unsigned int state, unsigned int eventType, unsigned int nextState, @@ -315,7 +315,7 @@ CFsmTransition* CFsm::AddTransition( { CFsmTransition* pTransition = AddTransition( state, eventType, nextState ); if ( !pTransition ) return NULL; - + // If action specified, register it if ( pAction ) pTransition->RegisterAction( pAction, pContext ); @@ -402,7 +402,7 @@ bool CFsm::Update( unsigned int eventType, void* pEventParam ) // Lookup transition CFsmTransition* pTransition = GetTransition( m_CurrState, eventType ); - if ( !pTransition ) + if ( !pTransition ) return false; // Setup event parameter @@ -414,7 +414,7 @@ bool CFsm::Update( unsigned int eventType, void* pEventParam ) } // Valid transition? - if ( !pTransition->ApplyConditions() ) + if ( !pTransition->ApplyConditions() ) return false; // Save the default state transition (actions might call SetNextState @@ -422,7 +422,7 @@ bool CFsm::Update( unsigned int eventType, void* pEventParam ) SetNextState( pTransition->GetNextState() ); // Run transition actions - if ( !pTransition->RunActions() ) + if ( !pTransition->RunActions() ) return false; // Switch state @@ -430,7 +430,7 @@ bool CFsm::Update( unsigned int eventType, void* pEventParam ) // Reset the next state since it's no longer valid SetNextState( FSM_INVALID_STATE ); - + return true; } diff --git a/source/network/fsm.h b/source/network/fsm.h index 3077b5d6ff..4c769c1692 100644 --- a/source/network/fsm.h +++ b/source/network/fsm.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2011 Wildfire Games. +/* Copyright (C) 2015 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -34,7 +34,7 @@ typedef bool ( *CONDITION ) ( void* pContext ); typedef bool ( *ACTION ) ( void* pContext, const CFsmEvent* pEvent ); typedef struct -{ +{ void* pFunction; void* pContext; @@ -79,11 +79,11 @@ public: CFsmTransition( unsigned int state ); ~CFsmTransition( void ); - void RegisterAction ( + void RegisterAction ( void* pAction, void* pContext ); - void RegisterCondition ( - void* pCondition, + void RegisterCondition ( + void* pCondition, void* pContext ); void SetEvent ( CFsmEvent* pEvent ); CFsmEvent* GetEvent ( void ) const { return m_Event; } @@ -91,7 +91,7 @@ public: unsigned int GetNextState ( void ) const { return m_NextState; } unsigned int GetCurrState ( void ) const { return m_CurrState; } const CallbackList& GetActions ( void ) const { return m_Actions; } - const CallbackList& GetConditions ( void ) const { return m_Conditions; } + const CallbackList& GetConditions ( void ) const { return m_Conditions; } bool ApplyConditions ( void ) const; bool RunActions ( void ) const; @@ -135,7 +135,7 @@ public: void AddState ( unsigned int state ); CFsmEvent* AddEvent ( unsigned int eventType ); - CFsmTransition* AddTransition ( + CFsmTransition* AddTransition ( unsigned int state, unsigned int eventType, unsigned int nextState ); @@ -145,7 +145,7 @@ public: unsigned int nextState, void* pAction, void* pContext ); - CFsmTransition* GetTransition ( + CFsmTransition* GetTransition ( unsigned int state, unsigned int eventType ) const; CFsmTransition* GetEventTransition ( unsigned int eventType ) const;