Skip to content

Commit bb1639a

Browse files
authored
Merge pull request jamulussoftware#3259 from softins/const-ref
Add some missing const refs to CHostAddress params
2 parents 6f57737 + 05c6e01 commit bb1639a

File tree

9 files changed

+11
-12
lines changed

9 files changed

+11
-12
lines changed

src/channel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ void CChannel::PutProtocolData ( const int iRecCounter, const int iRecID, const
526526
}
527527
}
528528

529-
EPutDataStat CChannel::PutAudioData ( const CVector<uint8_t>& vecbyData, const int iNumBytes, CHostAddress RecHostAddr )
529+
EPutDataStat CChannel::PutAudioData ( const CVector<uint8_t>& vecbyData, const int iNumBytes, const CHostAddress& RecHostAddr )
530530
{
531531
// init return state
532532
EPutDataStat eRet = PS_GEN_ERROR;

src/channel.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class CChannel : public QObject
7070

7171
void PutProtocolData ( const int iRecCounter, const int iRecID, const CVector<uint8_t>& vecbyMesBodyData, const CHostAddress& RecHostAddr );
7272

73-
EPutDataStat PutAudioData ( const CVector<uint8_t>& vecbyData, const int iNumBytes, CHostAddress RecHostAddr );
73+
EPutDataStat PutAudioData ( const CVector<uint8_t>& vecbyData, const int iNumBytes, const CHostAddress& RecHostAddr );
7474

7575
EGetDataStat GetData ( CVector<uint8_t>& vecbyData, const int iNumBytes );
7676

@@ -83,7 +83,7 @@ class CChannel : public QObject
8383
void SetEnable ( const bool bNEnStat );
8484
bool IsEnabled() { return bIsEnabled; }
8585

86-
void SetAddress ( const CHostAddress NAddr ) { InetAddr = NAddr; }
86+
void SetAddress ( const CHostAddress& NAddr ) { InetAddr = NAddr; }
8787
const CHostAddress& GetAddress() const { return InetAddr; }
8888

8989
void ResetInfo()

src/recorder/jamrecorder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ using namespace recorder;
4141
* Creates a file for the raw PCM data and sets up a QDataStream to which to write received frames.
4242
* The data is stored Little Endian.
4343
*/
44-
CJamClient::CJamClient ( const qint64 frame, const int _numChannels, const QString name, const CHostAddress address, const QDir recordBaseDir ) :
44+
CJamClient::CJamClient ( const qint64 frame, const int _numChannels, const QString name, const CHostAddress& address, const QDir recordBaseDir ) :
4545
startFrame ( frame ),
4646
numChannels ( static_cast<uint16_t> ( _numChannels ) ),
4747
name ( name ),

src/recorder/jamrecorder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class CJamClient : public QObject
7474
Q_OBJECT
7575

7676
public:
77-
CJamClient ( const qint64 frame, const int numChannels, const QString name, const CHostAddress address, const QDir recordBaseDir );
77+
CJamClient ( const qint64 frame, const int numChannels, const QString name, const CHostAddress& address, const QDir recordBaseDir );
7878

7979
void Frame ( const QString name, const CVector<int16_t>& pcm, int iServerFrameSizeSamples );
8080

src/serverlist.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,7 @@ void CServerListManager::RetrieveAll ( const CHostAddress& InetAddr )
727727
}
728728
}
729729

730-
int CServerListManager::IndexOf ( CHostAddress haSearchTerm )
730+
int CServerListManager::IndexOf ( const CHostAddress& haSearchTerm )
731731
{
732732
// Called with lock set.
733733

src/serverlist.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ class CServerListManager : public QObject
181181
void Register();
182182
void SetRegistered ( bool bIsRegister );
183183

184-
int IndexOf ( CHostAddress haSearchTerm );
184+
int IndexOf ( const CHostAddress& haSearchTerm );
185185
bool Load();
186186
void Save();
187187
void SetSvrRegStatus ( ESvrRegStatus eNSvrRegStatus );

src/socket.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,8 @@ void CSocket::OnDataReceived()
365365
use the signal/slot mechanism (i.e. we use messages for that).
366366
*/
367367

368+
CHostAddress RecHostAddr;
369+
368370
// read block from network interface and query address of sender
369371
uSockAddr UdpSocketAddr;
370372
#ifdef _WIN32
@@ -381,6 +383,7 @@ void CSocket::OnDataReceived()
381383
return;
382384
}
383385

386+
// convert address of client
384387
if ( UdpSocketAddr.sa.sa_family == AF_INET6 )
385388
{
386389
if ( IN6_IS_ADDR_V4MAPPED ( &( UdpSocketAddr.sa6.sin6_addr ) ) )
@@ -396,7 +399,6 @@ void CSocket::OnDataReceived()
396399
}
397400
else
398401
{
399-
// convert address of client
400402
RecHostAddr.InetAddr.setAddress ( ntohl ( UdpSocketAddr.sa4.sin_addr.s_addr ) );
401403
RecHostAddr.iPort = ntohs ( UdpSocketAddr.sa4.sin_port );
402404
}

src/socket.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,6 @@ class CSocket : public QObject
7878
QMutex Mutex;
7979

8080
CVector<uint8_t> vecbyRecBuf;
81-
CHostAddress RecHostAddr;
82-
QHostAddress SenderAddress;
83-
quint16 SenderPort;
8481

8582
CChannel* pChannel; // for client
8683
CServer* pServer; // for server

src/util.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,7 @@ class CHostAddress
747747

748748
CHostAddress() : InetAddr ( static_cast<quint32> ( 0 ) ), iPort ( 0 ) {}
749749

750-
CHostAddress ( const QHostAddress NInetAddr, const quint16 iNPort ) : InetAddr ( NInetAddr ), iPort ( iNPort ) {}
750+
CHostAddress ( const QHostAddress& NInetAddr, const quint16 iNPort ) : InetAddr ( NInetAddr ), iPort ( iNPort ) {}
751751

752752
CHostAddress ( const CHostAddress& NHAddr ) : InetAddr ( NHAddr.InetAddr ), iPort ( NHAddr.iPort ) {}
753753

0 commit comments

Comments
 (0)