diff --git a/src/channel.cpp b/src/channel.cpp index 6bd4d845cf..53f91766a8 100644 --- a/src/channel.cpp +++ b/src/channel.cpp @@ -526,7 +526,7 @@ void CChannel::PutProtocolData ( const int iRecCounter, const int iRecID, const } } -EPutDataStat CChannel::PutAudioData ( const CVector& vecbyData, const int iNumBytes, CHostAddress RecHostAddr ) +EPutDataStat CChannel::PutAudioData ( const CVector& vecbyData, const int iNumBytes, const CHostAddress& RecHostAddr ) { // init return state EPutDataStat eRet = PS_GEN_ERROR; diff --git a/src/channel.h b/src/channel.h index cbfbb1eef6..2c64fbf463 100644 --- a/src/channel.h +++ b/src/channel.h @@ -70,7 +70,7 @@ class CChannel : public QObject void PutProtocolData ( const int iRecCounter, const int iRecID, const CVector& vecbyMesBodyData, const CHostAddress& RecHostAddr ); - EPutDataStat PutAudioData ( const CVector& vecbyData, const int iNumBytes, CHostAddress RecHostAddr ); + EPutDataStat PutAudioData ( const CVector& vecbyData, const int iNumBytes, const CHostAddress& RecHostAddr ); EGetDataStat GetData ( CVector& vecbyData, const int iNumBytes ); @@ -83,7 +83,7 @@ class CChannel : public QObject void SetEnable ( const bool bNEnStat ); bool IsEnabled() { return bIsEnabled; } - void SetAddress ( const CHostAddress NAddr ) { InetAddr = NAddr; } + void SetAddress ( const CHostAddress& NAddr ) { InetAddr = NAddr; } const CHostAddress& GetAddress() const { return InetAddr; } void ResetInfo() @@ -250,12 +250,12 @@ public slots: Protocol.ParseMessageBody ( vecbyMesBodyData, iRecCounter, iRecID ); } - void OnProtocolMessageReceived ( int iRecCounter, int iRecID, CVector vecbyMesBodyData, CHostAddress RecHostAddr ) + void OnProtocolMessageReceived ( int iRecCounter, int iRecID, CVector vecbyMesBodyData, const CHostAddress& RecHostAddr ) { PutProtocolData ( iRecCounter, iRecID, vecbyMesBodyData, RecHostAddr ); } - void OnProtocolCLMessageReceived ( int iRecID, CVector vecbyMesBodyData, CHostAddress RecHostAddr ) + void OnProtocolCLMessageReceived ( int iRecID, CVector vecbyMesBodyData, const CHostAddress& RecHostAddr ) { emit DetectedCLMessage ( vecbyMesBodyData, iRecID, RecHostAddr ); } @@ -282,7 +282,7 @@ public slots: void RecorderStateReceived ( ERecorderState eRecorderState ); void Disconnected(); - void DetectedCLMessage ( CVector vecbyMesBodyData, int iRecID, CHostAddress RecHostAddr ); + void DetectedCLMessage ( CVector vecbyMesBodyData, int iRecID, const CHostAddress& RecHostAddr ); void ParseMessageBody ( CVector vecbyMesBodyData, int iRecCounter, int iRecID ); }; diff --git a/src/client.cpp b/src/client.cpp index d3d2c51c9a..cdc142c2ea 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -223,14 +223,14 @@ void CClient::OnSendProtMessage ( CVector vecMessage ) Socket.SendPacket ( vecMessage, Channel.GetAddress() ); } -void CClient::OnSendCLProtMessage ( CHostAddress InetAddr, CVector vecMessage ) +void CClient::OnSendCLProtMessage ( const CHostAddress& InetAddr, CVector vecMessage ) { // the protocol queries me to call the function to send the message // send it through the network Socket.SendPacket ( vecMessage, InetAddr ); } -void CClient::OnInvalidPacketReceived ( CHostAddress RecHostAddr ) +void CClient::OnInvalidPacketReceived ( const CHostAddress& RecHostAddr ) { // message could not be parsed, check if the packet comes // from the server we just connected -> if yes, send @@ -242,7 +242,7 @@ void CClient::OnInvalidPacketReceived ( CHostAddress RecHostAddr ) } } -void CClient::OnDetectedCLMessage ( CVector vecbyMesBodyData, int iRecID, CHostAddress RecHostAddr ) +void CClient::OnDetectedCLMessage ( CVector vecbyMesBodyData, int iRecID, const CHostAddress& RecHostAddr ) { // connection less messages are always processed ConnLessProtocol.ParseConnectionLessMessageBody ( vecbyMesBodyData, iRecID, RecHostAddr ); @@ -334,7 +334,7 @@ void CClient::CreateServerJitterBufferMessage() } } -void CClient::OnCLPingReceived ( CHostAddress InetAddr, int iMs ) +void CClient::OnCLPingReceived ( const CHostAddress& InetAddr, int iMs ) { // make sure we are running and the server address is correct if ( IsRunning() && ( InetAddr == Channel.GetAddress() ) ) @@ -350,7 +350,7 @@ void CClient::OnCLPingReceived ( CHostAddress InetAddr, int iMs ) } } -void CClient::OnCLPingWithNumClientsReceived ( CHostAddress InetAddr, int iMs, int iNumClients ) +void CClient::OnCLPingWithNumClientsReceived ( const CHostAddress& InetAddr, int iMs, int iNumClients ) { // take care of wrap arounds (if wrapping, do not use result) const int iCurDiff = EvaluatePingMessage ( iMs ); diff --git a/src/client.h b/src/client.h index 1fc33d8430..8f709d81ca 100644 --- a/src/client.h +++ b/src/client.h @@ -375,26 +375,26 @@ class CClient : public QObject protected slots: void OnHandledSignal ( int sigNum ); void OnSendProtMessage ( CVector vecMessage ); - void OnInvalidPacketReceived ( CHostAddress RecHostAddr ); + void OnInvalidPacketReceived ( const CHostAddress& RecHostAddr ); - void OnDetectedCLMessage ( CVector vecbyMesBodyData, int iRecID, CHostAddress RecHostAddr ); + void OnDetectedCLMessage ( CVector vecbyMesBodyData, int iRecID, const CHostAddress& RecHostAddr ); void OnReqJittBufSize() { CreateServerJitterBufferMessage(); } void OnJittBufSizeChanged ( int iNewJitBufSize ); void OnReqChanInfo() { Channel.SetRemoteInfo ( ChannelInfo ); } void OnNewConnection(); - void OnCLDisconnection ( CHostAddress InetAddr ) + void OnCLDisconnection ( const CHostAddress& InetAddr ) { if ( InetAddr == Channel.GetAddress() ) { emit Disconnected(); } } - void OnCLPingReceived ( CHostAddress InetAddr, int iMs ); + void OnCLPingReceived ( const CHostAddress& InetAddr, int iMs ); - void OnSendCLProtMessage ( CHostAddress InetAddr, CVector vecMessage ); + void OnSendCLProtMessage ( const CHostAddress& InetAddr, CVector vecMessage ); - void OnCLPingWithNumClientsReceived ( CHostAddress InetAddr, int iMs, int iNumClients ); + void OnCLPingWithNumClientsReceived ( const CHostAddress& InetAddr, int iMs, int iNumClients ); void OnSndCrdReinitRequest ( int iSndCrdResetType ); void OnControllerInFaderLevel ( int iChannelIdx, int iValue ); @@ -415,17 +415,17 @@ protected slots: void PingTimeReceived ( int iPingTime ); void RecorderStateReceived ( ERecorderState eRecorderState ); - void CLServerListReceived ( CHostAddress InetAddr, CVector vecServerInfo ); + void CLServerListReceived ( const CHostAddress& InetAddr, CVector vecServerInfo ); - void CLRedServerListReceived ( CHostAddress InetAddr, CVector vecServerInfo ); + void CLRedServerListReceived ( const CHostAddress& InetAddr, CVector vecServerInfo ); - void CLConnClientsListMesReceived ( CHostAddress InetAddr, CVector vecChanInfo ); + void CLConnClientsListMesReceived ( const CHostAddress& InetAddr, CVector vecChanInfo ); - void CLPingTimeWithNumClientsReceived ( CHostAddress InetAddr, int iPingTime, int iNumClients ); + void CLPingTimeWithNumClientsReceived ( const CHostAddress& InetAddr, int iPingTime, int iNumClients ); - void CLVersionAndOSReceived ( CHostAddress InetAddr, COSUtil::EOpSystemType eOSType, QString strVersion ); + void CLVersionAndOSReceived ( const CHostAddress& InetAddr, COSUtil::EOpSystemType eOSType, QString strVersion ); - void CLChannelLevelListReceived ( CHostAddress InetAddr, CVector vecLevelList ); + void CLChannelLevelListReceived ( const CHostAddress& InetAddr, CVector vecLevelList ); void Disconnected(); void SoundDeviceChanged ( QString strError ); diff --git a/src/clientdlg.cpp b/src/clientdlg.cpp index 99b9fa6433..fe4418da2f 100644 --- a/src/clientdlg.cpp +++ b/src/clientdlg.cpp @@ -805,7 +805,7 @@ void CClientDlg::OnVersionAndOSReceived ( COSUtil::EOpSystemType, QString strVer #endif } -void CClientDlg::OnCLVersionAndOSReceived ( CHostAddress, COSUtil::EOpSystemType, QString strVersion ) +void CClientDlg::OnCLVersionAndOSReceived ( const CHostAddress&, COSUtil::EOpSystemType, QString strVersion ) { // update check #if ( QT_VERSION >= QT_VERSION_CHECK( 5, 6, 0 ) ) && !defined( DISABLE_VERSION_CHECK ) @@ -1187,7 +1187,7 @@ void CClientDlg::OnSoundDeviceChanged ( QString strError ) ClientSettingsDlg.UpdateSoundDeviceChannelSelectionFrame(); } -void CClientDlg::OnCLPingTimeWithNumClientsReceived ( CHostAddress InetAddr, int iPingTime, int iNumClients ) +void CClientDlg::OnCLPingTimeWithNumClientsReceived ( const CHostAddress& InetAddr, int iPingTime, int iNumClients ) { // update connection dialog server list ConnectDlg.SetPingTimeAndNumClientsResult ( InetAddr, iPingTime, iNumClients ); diff --git a/src/clientdlg.h b/src/clientdlg.h index 9737bcd2ca..7a92b31443 100644 --- a/src/clientdlg.h +++ b/src/clientdlg.h @@ -137,7 +137,7 @@ public slots: void OnTimerPing(); void OnPingTimeResult ( int iPingTime ); - void OnCLPingTimeWithNumClientsReceived ( CHostAddress InetAddr, int iPingTime, int iNumClients ); + void OnCLPingTimeWithNumClientsReceived ( const CHostAddress& InetAddr, int iPingTime, int iNumClients ); void OnControllerInFaderLevel ( const int iChannelIdx, const int iValue ) { MainMixerBoard->SetFaderLevel ( iChannelIdx, iValue ); } @@ -151,7 +151,7 @@ public slots: void OnVersionAndOSReceived ( COSUtil::EOpSystemType, QString strVersion ); - void OnCLVersionAndOSReceived ( CHostAddress, COSUtil::EOpSystemType, QString strVersion ); + void OnCLVersionAndOSReceived ( const CHostAddress&, COSUtil::EOpSystemType, QString strVersion ); void OnLoadChannelSetup(); void OnSaveChannelSetup(); @@ -199,25 +199,25 @@ public slots: void OnNewLocalInputText ( QString strChatText ) { pClient->CreateChatTextMes ( strChatText ); } - void OnReqServerListQuery ( CHostAddress InetAddr ) { pClient->CreateCLReqServerListMes ( InetAddr ); } + void OnReqServerListQuery ( const CHostAddress& InetAddr ) { pClient->CreateCLReqServerListMes ( InetAddr ); } - void OnCreateCLServerListPingMes ( CHostAddress InetAddr ) { pClient->CreateCLServerListPingMes ( InetAddr ); } + void OnCreateCLServerListPingMes ( const CHostAddress& InetAddr ) { pClient->CreateCLServerListPingMes ( InetAddr ); } - void OnCreateCLServerListReqVerAndOSMes ( CHostAddress InetAddr ) { pClient->CreateCLServerListReqVerAndOSMes ( InetAddr ); } + void OnCreateCLServerListReqVerAndOSMes ( const CHostAddress& InetAddr ) { pClient->CreateCLServerListReqVerAndOSMes ( InetAddr ); } - void OnCreateCLServerListReqConnClientsListMes ( CHostAddress InetAddr ) { pClient->CreateCLServerListReqConnClientsListMes ( InetAddr ); } + void OnCreateCLServerListReqConnClientsListMes ( const CHostAddress& InetAddr ) { pClient->CreateCLServerListReqConnClientsListMes ( InetAddr ); } - void OnCLServerListReceived ( CHostAddress InetAddr, CVector vecServerInfo ) + void OnCLServerListReceived ( const CHostAddress& InetAddr, CVector vecServerInfo ) { ConnectDlg.SetServerList ( InetAddr, vecServerInfo ); } - void OnCLRedServerListReceived ( CHostAddress InetAddr, CVector vecServerInfo ) + void OnCLRedServerListReceived ( const CHostAddress& InetAddr, CVector vecServerInfo ) { ConnectDlg.SetServerList ( InetAddr, vecServerInfo, true ); } - void OnCLConnClientsListMesReceived ( CHostAddress InetAddr, CVector vecChanInfo ) + void OnCLConnClientsListMesReceived ( const CHostAddress& InetAddr, CVector vecChanInfo ) { ConnectDlg.SetConnClientsList ( InetAddr, vecChanInfo ); } @@ -226,7 +226,7 @@ public slots: void OnMuteStateHasChangedReceived ( int iChanID, bool bIsMuted ) { MainMixerBoard->SetRemoteFaderIsMute ( iChanID, bIsMuted ); } - void OnCLChannelLevelListReceived ( CHostAddress /* unused */, CVector vecLevelList ) + void OnCLChannelLevelListReceived ( const CHostAddress& /* unused */, CVector vecLevelList ) { MainMixerBoard->SetChannelLevels ( vecLevelList ); } diff --git a/src/clientrpc.cpp b/src/clientrpc.cpp index ee992cbfd9..19e07e0fa1 100644 --- a/src/clientrpc.cpp +++ b/src/clientrpc.cpp @@ -82,7 +82,7 @@ CClientRpc::CClientRpc ( CClient* pClient, CRpcServer* pRpcServer, QObject* pare /// @param {array} params.channelLevelList - The channel level list. /// Each item corresponds to the respective client retrieved from the jamulusclient/clientListReceived notification. /// @param {number} params.channelLevelList[*] - The channel level, an integer between 0 and 9. - connect ( pClient, &CClient::CLChannelLevelListReceived, [=] ( CHostAddress /* unused */, CVector vecLevelList ) { + connect ( pClient, &CClient::CLChannelLevelListReceived, [=] ( const CHostAddress& /* unused */, CVector vecLevelList ) { QJsonArray arrLevelList; for ( const auto& level : vecLevelList ) { diff --git a/src/connectdlg.h b/src/connectdlg.h index 71c79ddb1f..95cc51694f 100644 --- a/src/connectdlg.h +++ b/src/connectdlg.h @@ -106,8 +106,8 @@ public slots: void OnTimerReRequestServList(); signals: - void ReqServerListQuery ( CHostAddress InetAddr ); - void CreateCLServerListPingMes ( CHostAddress InetAddr ); - void CreateCLServerListReqVerAndOSMes ( CHostAddress InetAddr ); - void CreateCLServerListReqConnClientsListMes ( CHostAddress InetAddr ); + void ReqServerListQuery ( const CHostAddress& InetAddr ); + void CreateCLServerListPingMes ( const CHostAddress& InetAddr ); + void CreateCLServerListReqVerAndOSMes ( const CHostAddress& InetAddr ); + void CreateCLServerListReqConnClientsListMes ( const CHostAddress& InetAddr ); }; diff --git a/src/protocol.h b/src/protocol.h index ba939a3eab..15dfd412c2 100644 --- a/src/protocol.h +++ b/src/protocol.h @@ -301,7 +301,7 @@ public slots: signals: // transmitting void MessReadyForSending ( CVector vecMessage ); - void CLMessReadyForSending ( CHostAddress InetAddr, CVector vecMessage ); + void CLMessReadyForSending ( const CHostAddress& InetAddr, CVector vecMessage ); // receiving void ChangeJittBufSize ( int iNewJitBufSize ); @@ -325,24 +325,24 @@ public slots: void VersionAndOSReceived ( COSUtil::EOpSystemType eOSType, QString strVersion ); void RecorderStateReceived ( ERecorderState eRecorderState ); - void CLPingReceived ( CHostAddress InetAddr, int iMs ); - void CLPingWithNumClientsReceived ( CHostAddress InetAddr, int iMs, int iNumClients ); - void CLRegisterServerReceived ( CHostAddress InetAddr, CHostAddress LInetAddr, CServerCoreInfo ServerInfo ); - void CLRegisterServerExReceived ( CHostAddress InetAddr, - CHostAddress LInetAddr, + void CLPingReceived ( const CHostAddress& InetAddr, int iMs ); + void CLPingWithNumClientsReceived ( const CHostAddress& InetAddr, int iMs, int iNumClients ); + void CLRegisterServerReceived ( const CHostAddress& InetAddr, const CHostAddress& LInetAddr, CServerCoreInfo ServerInfo ); + void CLRegisterServerExReceived ( const CHostAddress& InetAddr, + const CHostAddress& LInetAddr, CServerCoreInfo ServerInfo, COSUtil::EOpSystemType eOSType, QString strVersion ); - void CLUnregisterServerReceived ( CHostAddress InetAddr ); - void CLServerListReceived ( CHostAddress InetAddr, CVector vecServerInfo ); - void CLRedServerListReceived ( CHostAddress InetAddr, CVector vecServerInfo ); - void CLReqServerList ( CHostAddress InetAddr ); - void CLSendEmptyMes ( CHostAddress TargetInetAddr ); - void CLDisconnection ( CHostAddress InetAddr ); - void CLVersionAndOSReceived ( CHostAddress InetAddr, COSUtil::EOpSystemType eOSType, QString strVersion ); - void CLReqVersionAndOS ( CHostAddress InetAddr ); - void CLConnClientsListMesReceived ( CHostAddress InetAddr, CVector vecChanInfo ); - void CLReqConnClientsList ( CHostAddress InetAddr ); - void CLChannelLevelListReceived ( CHostAddress InetAddr, CVector vecLevelList ); - void CLRegisterServerResp ( CHostAddress InetAddr, ESvrRegResult eStatus ); + void CLUnregisterServerReceived ( const CHostAddress& InetAddr ); + void CLServerListReceived ( const CHostAddress& InetAddr, CVector vecServerInfo ); + void CLRedServerListReceived ( const CHostAddress& InetAddr, CVector vecServerInfo ); + void CLReqServerList ( const CHostAddress& InetAddr ); + void CLSendEmptyMes ( const CHostAddress& TargetInetAddr ); + void CLDisconnection ( const CHostAddress& InetAddr ); + void CLVersionAndOSReceived ( const CHostAddress& InetAddr, COSUtil::EOpSystemType eOSType, QString strVersion ); + void CLReqVersionAndOS ( const CHostAddress& InetAddr ); + void CLConnClientsListMesReceived ( const CHostAddress& InetAddr, CVector vecChanInfo ); + void CLReqConnClientsList ( const CHostAddress& InetAddr ); + void CLChannelLevelListReceived ( const CHostAddress& InetAddr, CVector vecLevelList ); + void CLRegisterServerResp ( const CHostAddress& InetAddr, ESvrRegResult eStatus ); }; diff --git a/src/recorder/jamcontroller.h b/src/recorder/jamcontroller.h index 84e0e6fa97..8b630a4705 100644 --- a/src/recorder/jamcontroller.h +++ b/src/recorder/jamcontroller.h @@ -68,7 +68,7 @@ class CJamController : public QObject void ClientDisconnected ( int iChID ); void AudioFrame ( const int iChID, const QString stChName, - const CHostAddress RecHostAddr, + const CHostAddress& RecHostAddr, const int iNumAudChan, const CVector vecsData ); }; diff --git a/src/recorder/jamrecorder.cpp b/src/recorder/jamrecorder.cpp index 91f30fe2a5..5944bf1ea5 100644 --- a/src/recorder/jamrecorder.cpp +++ b/src/recorder/jamrecorder.cpp @@ -41,7 +41,7 @@ using namespace recorder; * Creates a file for the raw PCM data and sets up a QDataStream to which to write received frames. * The data is stored Little Endian. */ -CJamClient::CJamClient ( const qint64 frame, const int _numChannels, const QString name, const CHostAddress address, const QDir recordBaseDir ) : +CJamClient::CJamClient ( const qint64 frame, const int _numChannels, const QString name, const CHostAddress& address, const QDir recordBaseDir ) : startFrame ( frame ), numChannels ( static_cast ( _numChannels ) ), name ( name ), @@ -227,7 +227,7 @@ void CJamSession::DisconnectClient ( int iChID ) */ void CJamSession::Frame ( const int iChID, const QString name, - const CHostAddress address, + const CHostAddress& address, const int numAudioChannels, const CVector data, int iServerFrameSizeSamples ) @@ -593,7 +593,7 @@ void CJamRecorder::OnDisconnected ( int iChID ) */ void CJamRecorder::OnFrame ( const int iChID, const QString name, - const CHostAddress address, + const CHostAddress& address, const int numAudioChannels, const CVector data ) { diff --git a/src/recorder/jamrecorder.h b/src/recorder/jamrecorder.h index cc6db1970f..5b52e6276a 100644 --- a/src/recorder/jamrecorder.h +++ b/src/recorder/jamrecorder.h @@ -74,7 +74,7 @@ class CJamClient : public QObject Q_OBJECT public: - CJamClient ( const qint64 frame, const int numChannels, const QString name, const CHostAddress address, const QDir recordBaseDir ); + CJamClient ( const qint64 frame, const int numChannels, const QString name, const CHostAddress& address, const QDir recordBaseDir ); void Frame ( const QString name, const CVector& pcm, int iServerFrameSizeSamples ); @@ -119,7 +119,7 @@ class CJamSession : public QObject void Frame ( const int iChID, const QString name, - const CHostAddress address, + const CHostAddress& address, const int numAudioChannels, const CVector data, int iServerFrameSizeSamples ); @@ -214,7 +214,7 @@ public slots: /** * @brief Handle a frame of data to process */ - void OnFrame ( const int iChID, const QString name, const CHostAddress address, const int numAudioChannels, const CVector data ); + void OnFrame ( const int iChID, const QString name, const CHostAddress& address, const int numAudioChannels, const CVector data ); }; } // namespace recorder diff --git a/src/server.cpp b/src/server.cpp index 4d4d8d0510..ac5aa5bf1e 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -375,7 +375,7 @@ void CServer::SendProtMessage ( int iChID, CVector vecMessage ) Socket.SendPacket ( vecMessage, vecChannels[iChID].GetAddress() ); } -void CServer::OnNewConnection ( int iChID, int iTotChans, CHostAddress RecHostAddr ) +void CServer::OnNewConnection ( int iChID, int iTotChans, const CHostAddress& RecHostAddr ) { QMutexLocker locker ( &Mutex ); @@ -453,7 +453,7 @@ void CServer::OnNewConnection ( int iChID, int iTotChans, CHostAddress RecHostAd Logging.AddNewConnection ( RecHostAddr.InetAddr, iTotChans ); } -void CServer::OnServerFull ( CHostAddress RecHostAddr ) +void CServer::OnServerFull ( const CHostAddress& RecHostAddr ) { // note: no mutex required here @@ -461,14 +461,14 @@ void CServer::OnServerFull ( CHostAddress RecHostAddr ) ConnLessProtocol.CreateCLServerFullMes ( RecHostAddr ); } -void CServer::OnSendCLProtMessage ( CHostAddress InetAddr, CVector vecMessage ) +void CServer::OnSendCLProtMessage ( const CHostAddress& InetAddr, CVector vecMessage ) { // the protocol queries me to call the function to send the message // send it through the network Socket.SendPacket ( vecMessage, InetAddr ); } -void CServer::OnCLDisconnection ( CHostAddress InetAddr ) +void CServer::OnCLDisconnection ( const CHostAddress& InetAddr ) { // check if the given address is actually a client which is connected to // this server, if yes, disconnect it @@ -1422,7 +1422,7 @@ void CServer::DumpChannels ( const QString& title ) } } -void CServer::OnProtocolCLMessageReceived ( int iRecID, CVector vecbyMesBodyData, CHostAddress RecHostAddr ) +void CServer::OnProtocolCLMessageReceived ( int iRecID, CVector vecbyMesBodyData, const CHostAddress& RecHostAddr ) { QMutexLocker locker ( &Mutex ); @@ -1430,7 +1430,7 @@ void CServer::OnProtocolCLMessageReceived ( int iRecID, CVector vecbyMe ConnLessProtocol.ParseConnectionLessMessageBody ( vecbyMesBodyData, iRecID, RecHostAddr ); } -void CServer::OnProtocolMessageReceived ( int iRecCounter, int iRecID, CVector vecbyMesBodyData, CHostAddress RecHostAddr ) +void CServer::OnProtocolMessageReceived ( int iRecCounter, int iRecID, CVector vecbyMesBodyData, const CHostAddress& RecHostAddr ) { QMutexLocker locker ( &Mutex ); diff --git a/src/server.h b/src/server.h index 285ac57a21..b2b4d24865 100644 --- a/src/server.h +++ b/src/server.h @@ -315,11 +315,11 @@ class CServer : public QObject, public CServerSlots void SvrRegStatusChanged(); void AudioFrame ( const int iChID, const QString stChName, - const CHostAddress RecHostAddr, + const CHostAddress& RecHostAddr, const int iNumAudChan, const CVector vecsData ); - void CLVersionAndOSReceived ( CHostAddress InetAddr, COSUtil::EOpSystemType eOSType, QString strVersion ); + void CLVersionAndOSReceived ( const CHostAddress& InetAddr, COSUtil::EOpSystemType eOSType, QString strVersion ); // pass through from jam controller void RestartRecorder(); @@ -330,24 +330,24 @@ class CServer : public QObject, public CServerSlots public slots: void OnTimer(); - void OnNewConnection ( int iChID, int iTotChans, CHostAddress RecHostAddr ); + void OnNewConnection ( int iChID, int iTotChans, const CHostAddress& RecHostAddr ); - void OnServerFull ( CHostAddress RecHostAddr ); + void OnServerFull ( const CHostAddress& RecHostAddr ); - void OnSendCLProtMessage ( CHostAddress InetAddr, CVector vecMessage ); + void OnSendCLProtMessage ( const CHostAddress& InetAddr, CVector vecMessage ); - void OnProtocolCLMessageReceived ( int iRecID, CVector vecbyMesBodyData, CHostAddress RecHostAddr ); + void OnProtocolCLMessageReceived ( int iRecID, CVector vecbyMesBodyData, const CHostAddress& RecHostAddr ); - void OnProtocolMessageReceived ( int iRecCounter, int iRecID, CVector vecbyMesBodyData, CHostAddress RecHostAddr ); + void OnProtocolMessageReceived ( int iRecCounter, int iRecID, CVector vecbyMesBodyData, const CHostAddress& RecHostAddr ); - void OnCLPingReceived ( CHostAddress InetAddr, int iMs ) { ConnLessProtocol.CreateCLPingMes ( InetAddr, iMs ); } + void OnCLPingReceived ( const CHostAddress& InetAddr, int iMs ) { ConnLessProtocol.CreateCLPingMes ( InetAddr, iMs ); } - void OnCLPingWithNumClientsReceived ( CHostAddress InetAddr, int iMs, int ) + void OnCLPingWithNumClientsReceived ( const CHostAddress& InetAddr, int iMs, int ) { ConnLessProtocol.CreateCLPingWithNumClientsMes ( InetAddr, iMs, GetNumberOfConnectedClients() ); } - void OnCLSendEmptyMes ( CHostAddress TargetInetAddr ) + void OnCLSendEmptyMes ( const CHostAddress& TargetInetAddr ) { // only send empty message if not a directory if ( !ServerListManager.IsDirectory() ) @@ -356,31 +356,31 @@ public slots: } } - void OnCLReqServerList ( CHostAddress InetAddr ) { ServerListManager.RetrieveAll ( InetAddr ); } + void OnCLReqServerList ( const CHostAddress& InetAddr ) { ServerListManager.RetrieveAll ( InetAddr ); } - void OnCLReqVersionAndOS ( CHostAddress InetAddr ) { ConnLessProtocol.CreateCLVersionAndOSMes ( InetAddr ); } + void OnCLReqVersionAndOS ( const CHostAddress& InetAddr ) { ConnLessProtocol.CreateCLVersionAndOSMes ( InetAddr ); } - void OnCLReqConnClientsList ( CHostAddress InetAddr ) { ConnLessProtocol.CreateCLConnClientsListMes ( InetAddr, CreateChannelList() ); } + void OnCLReqConnClientsList ( const CHostAddress& InetAddr ) { ConnLessProtocol.CreateCLConnClientsListMes ( InetAddr, CreateChannelList() ); } - void OnCLRegisterServerReceived ( CHostAddress InetAddr, CHostAddress LInetAddr, CServerCoreInfo ServerInfo ) + void OnCLRegisterServerReceived ( const CHostAddress& InetAddr, const CHostAddress& LInetAddr, CServerCoreInfo ServerInfo ) { ServerListManager.Append ( InetAddr, LInetAddr, ServerInfo ); } - void OnCLRegisterServerExReceived ( CHostAddress InetAddr, - CHostAddress LInetAddr, - CServerCoreInfo ServerInfo, + void OnCLRegisterServerExReceived ( const CHostAddress& InetAddr, + const CHostAddress& LInetAddr, + CServerCoreInfo ServerInfo, COSUtil::EOpSystemType, QString strVersion ) { ServerListManager.Append ( InetAddr, LInetAddr, ServerInfo, strVersion ); } - void OnCLRegisterServerResp ( CHostAddress /* unused */, ESvrRegResult eResult ) { ServerListManager.StoreRegistrationResult ( eResult ); } + void OnCLRegisterServerResp ( const CHostAddress& /* unused */, ESvrRegResult eResult ) { ServerListManager.StoreRegistrationResult ( eResult ); } - void OnCLUnregisterServerReceived ( CHostAddress InetAddr ) { ServerListManager.Remove ( InetAddr ); } + void OnCLUnregisterServerReceived ( const CHostAddress& InetAddr ) { ServerListManager.Remove ( InetAddr ); } - void OnCLDisconnection ( CHostAddress InetAddr ); + void OnCLDisconnection ( const CHostAddress& InetAddr ); void OnAboutToQuit(); diff --git a/src/serverdlg.cpp b/src/serverdlg.cpp index 7a14922f79..645ce86035 100644 --- a/src/serverdlg.cpp +++ b/src/serverdlg.cpp @@ -661,7 +661,7 @@ void CServerDlg::OnSysTrayActivated ( QSystemTrayIcon::ActivationReason ActReaso } } -void CServerDlg::OnCLVersionAndOSReceived ( CHostAddress, COSUtil::EOpSystemType, QString strVersion ) +void CServerDlg::OnCLVersionAndOSReceived ( const CHostAddress&, COSUtil::EOpSystemType, QString strVersion ) { // update check #if QT_VERSION >= QT_VERSION_CHECK( 5, 6, 0 ) diff --git a/src/serverdlg.h b/src/serverdlg.h index 7dca40800f..a73f1c49a2 100644 --- a/src/serverdlg.h +++ b/src/serverdlg.h @@ -123,7 +123,7 @@ public slots: void OnSvrRegStatusChanged() { UpdateGUIDependencies(); } void OnRecordingSessionStarted ( QString sessionDir ) { UpdateRecorderStatus ( sessionDir ); } void OnStopRecorder(); - void OnCLVersionAndOSReceived ( CHostAddress, COSUtil::EOpSystemType, QString strVersion ); + void OnCLVersionAndOSReceived ( const CHostAddress&, COSUtil::EOpSystemType, QString strVersion ); // Our timer void OnTimer(); diff --git a/src/serverlist.cpp b/src/serverlist.cpp index 412278cacd..59d2362bd1 100644 --- a/src/serverlist.cpp +++ b/src/serverlist.cpp @@ -727,7 +727,7 @@ void CServerListManager::RetrieveAll ( const CHostAddress& InetAddr ) } } -int CServerListManager::IndexOf ( CHostAddress haSearchTerm ) +int CServerListManager::IndexOf ( const CHostAddress& haSearchTerm ) { // Called with lock set. diff --git a/src/serverlist.h b/src/serverlist.h index 8c5729f940..8e48ae1fbc 100644 --- a/src/serverlist.h +++ b/src/serverlist.h @@ -181,7 +181,7 @@ class CServerListManager : public QObject void Register(); void SetRegistered ( bool bIsRegister ); - int IndexOf ( CHostAddress haSearchTerm ); + int IndexOf ( const CHostAddress& haSearchTerm ); bool Load(); void Save(); void SetSvrRegStatus ( ESvrRegStatus eNSvrRegStatus ); diff --git a/src/socket.cpp b/src/socket.cpp index 911e6d97a4..fb273d318b 100644 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -70,7 +70,7 @@ CSocket::CSocket ( CServer* pNServP, const quint16 iPortNumber, const quint16 iQ QObject::connect ( this, &CSocket::ProtocolCLMessageReceived, pServer, &CServer::OnProtocolCLMessageReceived ); QObject::connect ( this, - static_cast ( &CSocket::NewConnection ), + static_cast ( &CSocket::NewConnection ), pServer, &CServer::OnNewConnection ); diff --git a/src/socket.h b/src/socket.h index b2ea19b19c..26935e4984 100644 --- a/src/socket.h +++ b/src/socket.h @@ -98,15 +98,15 @@ class CSocket : public QObject void NewConnection(); // for the client void NewConnection ( int iChID, int iTotChans, - CHostAddress RecHostAddr ); // for the server + const CHostAddress& RecHostAddr ); // for the server - void ServerFull ( CHostAddress RecHostAddr ); + void ServerFull ( const CHostAddress& RecHostAddr ); - void InvalidPacketReceived ( CHostAddress RecHostAddr ); + void InvalidPacketReceived ( const CHostAddress& RecHostAddr ); - void ProtocolMessageReceived ( int iRecCounter, int iRecID, CVector vecbyMesBodyData, CHostAddress HostAdr ); + void ProtocolMessageReceived ( int iRecCounter, int iRecID, CVector vecbyMesBodyData, const CHostAddress& HostAdr ); - void ProtocolCLMessageReceived ( int iRecID, CVector vecbyMesBodyData, CHostAddress HostAdr ); + void ProtocolCLMessageReceived ( int iRecID, CVector vecbyMesBodyData, const CHostAddress& HostAdr ); }; /* Socket which runs in a separate high priority thread --------------------- */ @@ -212,7 +212,7 @@ class CHighPrioSocket : public QObject CSocket Socket; signals: - void InvalidPacketReceived ( CHostAddress RecHostAddr ); + void InvalidPacketReceived ( const CHostAddress& RecHostAddr ); }; // overlay generic, IPv4 and IPv6 sockaddr structures diff --git a/src/testbench.h b/src/testbench.h index 1c0c331e32..e86c44c6b3 100644 --- a/src/testbench.h +++ b/src/testbench.h @@ -303,5 +303,5 @@ public slots: Protocol.Reset(); } - void OnSendCLMessage ( CHostAddress, CVector vecMessage ) { OnSendProtMessage ( vecMessage ); } + void OnSendCLMessage ( const CHostAddress&, CVector vecMessage ) { OnSendProtMessage ( vecMessage ); } }; diff --git a/src/util.h b/src/util.h index 23b76fb473..cf9938cb00 100644 --- a/src/util.h +++ b/src/util.h @@ -126,7 +126,7 @@ class CVector : public std::vector CVector ( const int iNeSi ) { Init ( iNeSi ); } CVector ( const int iNeSi, const TData tInVa ) { Init ( iNeSi, tInVa ); } - CVector ( CVector const& ) = default; + CVector ( CVector const& ) = default; CVector& operator= ( CVector const& ) = default; void Init ( const int iNewSize ); @@ -747,7 +747,7 @@ class CHostAddress CHostAddress() : InetAddr ( static_cast ( 0 ) ), iPort ( 0 ) {} - CHostAddress ( const QHostAddress NInetAddr, const quint16 iNPort ) : InetAddr ( NInetAddr ), iPort ( iNPort ) {} + CHostAddress ( const QHostAddress& NInetAddr, const quint16 iNPort ) : InetAddr ( NInetAddr ), iPort ( iNPort ) {} CHostAddress ( const CHostAddress& NHAddr ) : InetAddr ( NHAddr.InetAddr ), iPort ( NHAddr.iPort ) {}