Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some missing const refs to CHostAddress params #3259

Merged
merged 4 commits into from
May 25, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/channel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ void CChannel::PutProtocolData ( const int iRecCounter, const int iRecID, const
}
}

EPutDataStat CChannel::PutAudioData ( const CVector<uint8_t>& vecbyData, const int iNumBytes, CHostAddress RecHostAddr )
EPutDataStat CChannel::PutAudioData ( const CVector<uint8_t>& vecbyData, const int iNumBytes, const CHostAddress& RecHostAddr )
{
// init return state
EPutDataStat eRet = PS_GEN_ERROR;
Expand Down
4 changes: 2 additions & 2 deletions src/channel.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class CChannel : public QObject

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

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

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

Expand All @@ -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; }
pljones marked this conversation as resolved.
Show resolved Hide resolved
const CHostAddress& GetAddress() const { return InetAddr; }

void ResetInfo()
Expand Down
2 changes: 1 addition & 1 deletion src/recorder/jamrecorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) :
Copy link
Member

@ann0see ann0see May 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check for bugs here too.

I tested running the server on macOS and it needed multiple tries to show up as directory. The directory did not show up for a local client if a path for recordings is set. It may not be related and needs more investigation (test with a path that is not writable).

It seems as if on 3.10.0 the directory shows up instantly.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also the Now a directory text doesn't show up in green:
Now a directory

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. Ok. Current main also shows this issue. Seems to be unrelated.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, if this problem behaviour is repeatable post-3.10.0 but not in 3.10.0, it needs to be raised as a new issue. Maybe need to bisect to find where it was introduced?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue opened

CJamClient::CJamClient ( const qint64 frame, const int _numChannels, const QString name, const CHostAddress& address, const QDir recordBaseDir ) :
startFrame ( frame ),
numChannels ( static_cast<uint16_t> ( _numChannels ) ),
name ( name ),
Expand Down
2 changes: 1 addition & 1 deletion src/recorder/jamrecorder.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<int16_t>& pcm, int iServerFrameSizeSamples );

Expand Down
2 changes: 1 addition & 1 deletion src/serverlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion src/serverlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
2 changes: 2 additions & 0 deletions src/socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,8 @@ void CSocket::OnDataReceived()
use the signal/slot mechanism (i.e. we use messages for that).
*/

CHostAddress RecHostAddr;
pljones marked this conversation as resolved.
Show resolved Hide resolved

pljones marked this conversation as resolved.
Show resolved Hide resolved
// read block from network interface and query address of sender
uSockAddr UdpSocketAddr;
pljones marked this conversation as resolved.
Show resolved Hide resolved
#ifdef _WIN32
Expand Down
3 changes: 0 additions & 3 deletions src/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,6 @@ class CSocket : public QObject
QMutex Mutex;

CVector<uint8_t> vecbyRecBuf;
CHostAddress RecHostAddr;
QHostAddress SenderAddress;
quint16 SenderPort;

CChannel* pChannel; // for client
CServer* pServer; // for server
Expand Down
2 changes: 1 addition & 1 deletion src/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,7 @@ class CHostAddress

CHostAddress() : InetAddr ( static_cast<quint32> ( 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 ) {}

Expand Down