diff --git a/src/analyzerconsole.h b/src/analyzerconsole.h index 6a8af738..35bacf0d 100644 --- a/src/analyzerconsole.h +++ b/src/analyzerconsole.h @@ -47,8 +47,8 @@ class CAnalyzerConsole : public QDialog public: CAnalyzerConsole ( CClient* pNCliP, - QWidget* parent = 0, - Qt::WindowFlags f = 0 ); + QWidget* parent = nullptr, + Qt::WindowFlags f = nullptr ); protected: diff --git a/src/audiomixerboard.h b/src/audiomixerboard.h index 4c1f5601..40595105 100755 --- a/src/audiomixerboard.h +++ b/src/audiomixerboard.h @@ -95,7 +95,7 @@ class CAudioMixerBoard : public QGroupBox Q_OBJECT public: - CAudioMixerBoard ( QWidget* parent = 0, Qt::WindowFlags f = 0 ); + CAudioMixerBoard ( QWidget* parent = nullptr, Qt::WindowFlags f = nullptr ); void HideAll(); void ApplyNewConClientList ( CVector& vecChanInfo ); diff --git a/src/channel.cpp b/src/channel.cpp index 3db4807d..c08688d6 100755 --- a/src/channel.cpp +++ b/src/channel.cpp @@ -27,7 +27,7 @@ // CChannel implementation ***************************************************** CChannel::CChannel ( const bool bNIsServer ) : - vecdGains ( MAX_NUM_CHANNELS, (double) 1.0 ), + vecdGains ( MAX_NUM_CHANNELS, 1.0 ), bDoAutoSockBufSize ( true ), bIsEnabled ( false ), bIsServer ( bNIsServer ) @@ -355,9 +355,9 @@ void CChannel::OnNetTranspPropsReceived ( CNetworkTransportProps NetworkTranspor { // store received parameters eAudioCompressionType = NetworkTransportProps.eAudioCodingType; - iNumAudioChannels = NetworkTransportProps.iNumAudioChannels; + iNumAudioChannels = static_cast ( NetworkTransportProps.iNumAudioChannels ); iNetwFrameSizeFact = NetworkTransportProps.iBlockSizeFact; - iNetwFrameSize = NetworkTransportProps.iBaseNetworkPacketSize; + iNetwFrameSize = static_cast ( NetworkTransportProps.iBaseNetworkPacketSize ); MutexSocketBuf.lock(); { @@ -388,14 +388,13 @@ CNetworkTransportProps CChannel::GetNetworkTransportPropsFromCurrentSettings() { // use current stored settings of the channel to fill the network transport // properties structure - return CNetworkTransportProps ( - iNetwFrameSize, - iNetwFrameSizeFact, - iNumAudioChannels, - SYSTEM_SAMPLE_RATE_HZ, - eAudioCompressionType, - 0, // version of the codec - 0 ); + return CNetworkTransportProps ( static_cast ( iNetwFrameSize ), + static_cast ( iNetwFrameSizeFact ), + static_cast ( iNumAudioChannels ), + SYSTEM_SAMPLE_RATE_HZ, + eAudioCompressionType, + 0, // version of the codec + 0 ); } void CChannel::Disconnect() diff --git a/src/chatdlg.h b/src/chatdlg.h index 87014f25..dc1b2233 100755 --- a/src/chatdlg.h +++ b/src/chatdlg.h @@ -39,7 +39,7 @@ class CChatDlg : public QDialog, private Ui_CChatDlgBase Q_OBJECT public: - CChatDlg ( QWidget* parent = 0, Qt::WindowFlags f = 0 ); + CChatDlg ( QWidget* parent = nullptr, Qt::WindowFlags f = nullptr ); void AddChatText ( QString strChatText ); diff --git a/src/client.cpp b/src/client.cpp index c4ba7fd2..f76dc98a 100755 --- a/src/client.cpp +++ b/src/client.cpp @@ -1090,7 +1090,7 @@ void CClient::ProcessAudioDataIntern ( CVector& vecsStereoSndCrd ) if ( eAudioCompressionType == CT_OPUS ) { opus_custom_decode ( OpusDecoderMono, - NULL, + nullptr, iCeltNumCodedBytes, &vecsAudioSndCrdMono[i * SYSTEM_FRAME_SIZE_SAMPLES], SYSTEM_FRAME_SIZE_SAMPLES ); @@ -1101,7 +1101,7 @@ void CClient::ProcessAudioDataIntern ( CVector& vecsStereoSndCrd ) if ( eAudioCompressionType == CT_OPUS ) { opus_custom_decode ( OpusDecoderStereo, - NULL, + nullptr, iCeltNumCodedBytes, &vecsStereoSndCrd[i * 2 * SYSTEM_FRAME_SIZE_SAMPLES], SYSTEM_FRAME_SIZE_SAMPLES ); @@ -1158,7 +1158,7 @@ int CClient::EstimatedOverallDelay ( const int iPingTimeMs ) // Consider the jitter buffer on the client and on the server side, too. const double dTotalJitterBufferDelayMs = SYSTEM_BLOCK_DURATION_MS_FLOAT * static_cast ( GetSockBufNumFrames() + - GetServerSockBufNumFrames() ) * 0.7f; + GetServerSockBufNumFrames() ) * 0.7; // consider delay introduced by the sound card conversion buffer by using // "GetSndCrdConvBufAdditionalDelayMonoBlSize()" diff --git a/src/clientdlg.cpp b/src/clientdlg.cpp index ce0a2ade..5f1dd467 100755 --- a/src/clientdlg.cpp +++ b/src/clientdlg.cpp @@ -920,8 +920,8 @@ void CClientDlg::OnTimerSigMet() } // show current level - lbrInputLevelL->setValue ( (int) ceil ( dCurSigLevelL ) ); - lbrInputLevelR->setValue ( (int) ceil ( dCurSigLevelR ) ); + lbrInputLevelL->setValue ( static_cast ( ceil ( dCurSigLevelL ) ) ); + lbrInputLevelR->setValue ( static_cast ( ceil ( dCurSigLevelR ) ) ); } void CClientDlg::OnTimerBuffersLED() @@ -1036,9 +1036,7 @@ void CClientDlg::Connect ( const QString& strSelectedAddress, catch ( CGenErr generr ) { // show error message and return the function - QMessageBox::critical ( - this, APP_NAME, generr.GetErrorText(), "Close", 0 ); - + QMessageBox::critical ( this, APP_NAME, generr.GetErrorText(), "Close", nullptr ); return; } diff --git a/src/clientsettingsdlg.cpp b/src/clientsettingsdlg.cpp index 432a6467..5a66d018 100755 --- a/src/clientsettingsdlg.cpp +++ b/src/clientsettingsdlg.cpp @@ -455,7 +455,7 @@ QString CClientSettingsDlg::GenSndCrdBufferDelayString ( const int iFrameSiz { // use two times the buffer delay for the entire delay since // we have input and output - return QString().setNum ( (double) iFrameSize * 2 * + return QString().setNum ( static_cast ( iFrameSize ) * 2 * 1000 / SYSTEM_SAMPLE_RATE_HZ, 'f', 2 ) + " ms (" + QString().setNum ( iFrameSize ) + strAddText + ")"; } @@ -629,7 +629,7 @@ void CClientSettingsDlg::OnSoundcardActivated ( int iSndDevIdx ) QString ( tr ( "The selected audio device could not be used " "because of the following error: " ) ) + strError + QString ( tr ( " The previous driver will be selected." ) ), - "Ok", 0 ); + "Ok", nullptr ); // recover old selection cbxSoundcard->setCurrentIndex ( pClient->GetSndCrdDev() ); diff --git a/src/clientsettingsdlg.h b/src/clientsettingsdlg.h index 5e768a3c..dc2d61bf 100755 --- a/src/clientsettingsdlg.h +++ b/src/clientsettingsdlg.h @@ -52,8 +52,8 @@ class CClientSettingsDlg : public QDialog, private Ui_CClientSettingsDlgBase public: CClientSettingsDlg ( CClient* pNCliP, - QWidget* parent = 0, - Qt::WindowFlags f = 0 ); + QWidget* parent = nullptr, + Qt::WindowFlags f = nullptr ); void SetStatus ( const CMultiColorLED::ELightColor eStatus ) { ledNetw->SetLight ( eStatus ); } diff --git a/src/connectdlg.cpp b/src/connectdlg.cpp index 8a4f9a99..d72c922e 100755 --- a/src/connectdlg.cpp +++ b/src/connectdlg.cpp @@ -440,7 +440,7 @@ void CConnectDlg::OnServerListItemDoubleClicked ( QTreeWidgetItem* Item, { // if a server list item was double clicked, it is the same as if the // connect button was clicked - if ( Item != 0 ) + if ( Item != nullptr ) { OnConnectClicked(); } @@ -632,7 +632,7 @@ QTreeWidgetItem* CConnectDlg::FindListViewItem ( const CHostAddress& InetAddr ) } } - return NULL; + return nullptr; } QTreeWidgetItem* CConnectDlg::GetParentListViewItem ( QTreeWidgetItem* pItem ) diff --git a/src/connectdlg.h b/src/connectdlg.h index c467575e..63f89e1e 100755 --- a/src/connectdlg.h +++ b/src/connectdlg.h @@ -48,8 +48,8 @@ class CConnectDlg : public QDialog, private Ui_CConnectDlgBase public: CConnectDlg ( const bool bNewShowCompleteRegList, - QWidget* parent = 0, - Qt::WindowFlags f = 0 ); + QWidget* parent = nullptr, + Qt::WindowFlags f = nullptr ); void Init ( const QString strNewCentralServerAddr, const CVector& vstrIPAddresses ); diff --git a/src/multicolorled.h b/src/multicolorled.h index 642eeac9..9d3bde34 100755 --- a/src/multicolorled.h +++ b/src/multicolorled.h @@ -51,7 +51,7 @@ public: RL_RED }; - CMultiColorLED ( QWidget* parent = 0, Qt::WindowFlags f = 0 ); + CMultiColorLED ( QWidget* parent = nullptr, Qt::WindowFlags f = nullptr ); void Reset(); void SetLight ( const ELightColor eNewStatus ); diff --git a/src/multicolorledbar.h b/src/multicolorledbar.h index f3f151e8..d275d724 100755 --- a/src/multicolorledbar.h +++ b/src/multicolorledbar.h @@ -39,7 +39,7 @@ class CMultiColorLEDBar : public QFrame Q_OBJECT public: - CMultiColorLEDBar ( QWidget* parent = 0, Qt::WindowFlags f = 0 ); + CMultiColorLEDBar ( QWidget* parent = nullptr, Qt::WindowFlags f = nullptr ); virtual ~CMultiColorLEDBar(); void setValue ( const int value ); diff --git a/src/server.cpp b/src/server.cpp index 113d7d5f..4a5930a7 100755 --- a/src/server.cpp +++ b/src/server.cpp @@ -797,7 +797,7 @@ JitterMeas.Measure(); if ( vecChannels[iCurChanID].GetAudioCompressionType() == CT_OPUS ) { opus_custom_decode ( OpusDecoderMono[iCurChanID], - NULL, + nullptr, iCeltNumCodedBytes, &vecvecsData[i][0], SYSTEM_FRAME_SIZE_SAMPLES ); @@ -809,7 +809,7 @@ JitterMeas.Measure(); if ( vecChannels[iCurChanID].GetAudioCompressionType() == CT_OPUS ) { opus_custom_decode ( OpusDecoderStereo[iCurChanID], - NULL, + nullptr, iCeltNumCodedBytes, &vecvecsData[i][0], SYSTEM_FRAME_SIZE_SAMPLES ); @@ -1252,11 +1252,11 @@ bool CServer::PutAudioData ( const CVector& vecbyRecBuf, // time reset gains of this channel ID for all other channels for ( int i = 0; i < iMaxNumChannels; i++ ) { - vecChannels[iCurChanID].SetGain ( i, (double) 1.0 ); + vecChannels[iCurChanID].SetGain ( i, 1.0 ); // other channels (we do not distinguish the case if // i == iCurChanID for simplicity) - vecChannels[i].SetGain ( iCurChanID, (double) 1.0 ); + vecChannels[i].SetGain ( iCurChanID, 1.0 ); } } else diff --git a/src/serverdlg.cpp b/src/serverdlg.cpp index 9bee3988..1c328f18 100755 --- a/src/serverdlg.cpp +++ b/src/serverdlg.cpp @@ -450,7 +450,7 @@ void CServerDlg::OnTimer() // fill list with connected clients for ( int i = 0; i < iNumChannels; i++ ) { - if ( !( vecHostAddresses[i].InetAddr == QHostAddress ( (quint32) 0 ) ) ) + if ( !( vecHostAddresses[i].InetAddr == QHostAddress ( static_cast ( 0 ) ) ) ) { // IP, port number vecpListViewItems[i]->setText ( 0, diff --git a/src/serverdlg.h b/src/serverdlg.h index 1c8fdc01..205f255c 100755 --- a/src/serverdlg.h +++ b/src/serverdlg.h @@ -53,8 +53,8 @@ public: CServerDlg ( CServer* pNServP, CSettings* pNSetP, const bool bStartMinimized, - QWidget* parent = 0, - Qt::WindowFlags f = 0 ); + QWidget* parent = nullptr, + Qt::WindowFlags f = nullptr ); protected: virtual void changeEvent ( QEvent* pEvent ); diff --git a/src/socket.h b/src/socket.h index c87f7db5..79d8f570 100755 --- a/src/socket.h +++ b/src/socket.h @@ -170,7 +170,7 @@ protected: class CSocketThread : public QThread { public: - CSocketThread ( CSocket* pNewSocket = NULL, QObject* parent = 0 ) : + CSocketThread ( CSocket* pNewSocket = nullptr, QObject* parent = nullptr ) : QThread ( parent ), pSocket ( pNewSocket ), bRun ( true ) {} void Stop() @@ -191,7 +191,7 @@ protected: void run() { // make sure the socket pointer is initialized (should be always the // case) - if ( pSocket != NULL ) + if ( pSocket != nullptr ) { while ( bRun ) { diff --git a/src/soundbase.cpp b/src/soundbase.cpp index f8e64665..40068850 100755 --- a/src/soundbase.cpp +++ b/src/soundbase.cpp @@ -186,13 +186,13 @@ QString CSoundBase::SetDev ( const int iNewDev ) // have changed so that they are not compatible to our // software anymore QMessageBox::critical ( - 0, APP_NAME, QString ( tr ( "The audio driver properties " + nullptr, APP_NAME, QString ( tr ( "The audio driver properties " "have changed to a state which is incompatible to this " "software. The selected audio device could not be used " "because of the following error: " ) ) + strErrorMessage + QString ( tr ( "

Please restart the software." ) ), - "Close", 0 ); + "Close", nullptr ); _exit ( 0 ); } diff --git a/src/util.cpp b/src/util.cpp index 6dab7a53..6463cf59 100755 --- a/src/util.cpp +++ b/src/util.cpp @@ -170,13 +170,13 @@ void CAudioReverb::Init ( const int iSampleRate, // delay lengths for 44100 Hz sample rate int lengths[9] = { 1116, 1356, 1422, 1617, 225, 341, 441, 211, 179 }; - const double scaler = (double) iSampleRate / 44100.0; + const double scaler = static_cast ( iSampleRate ) / 44100.0; if ( scaler != 1.0 ) { for ( i = 0; i < 9; i++ ) { - delay = (int) floor ( scaler * lengths[i] ); + delay = static_cast ( floor ( scaler * lengths[i] ) ); if ( ( delay & 1 ) == 0 ) { @@ -206,7 +206,7 @@ void CAudioReverb::Init ( const int iSampleRate, setT60 ( rT60, iSampleRate ); outLeftDelay.Init ( lengths[7] ); outRightDelay.Init ( lengths[8] ); - allpassCoefficient = (double) 0.7; + allpassCoefficient = 0.7; Clear(); } @@ -223,7 +223,7 @@ bool CAudioReverb::isPrime ( const int number ) if ( number & 1 ) { - for ( int i = 3; i < (int) sqrt ( (double) number ) + 1; i += 2 ) + for ( int i = 3; i < static_cast ( sqrt ( static_cast ( number ) ) ) + 1; i += 2 ) { if ( ( number % i ) == 0 ) { @@ -263,7 +263,7 @@ void CAudioReverb::setT60 ( const double rT60, // set the reverberation T60 decay time for ( int i = 0; i < 4; i++ ) { - combCoefficient[i] = pow ( (double) 10.0, (double) ( -3.0 * + combCoefficient[i] = pow ( 10.0, static_cast ( -3.0 * combDelays[i].Size() / ( rT60 * iSampleRate ) ) ); } } diff --git a/src/util.h b/src/util.h index 0c8f0982..779ee080 100755 --- a/src/util.h +++ b/src/util.h @@ -83,7 +83,7 @@ inline short Double2Short ( const double dInput ) return _MAXSHORT; } - return (short) dInput; + return static_cast ( dInput ); } // debug error handling @@ -412,7 +412,7 @@ class CAboutDlg : public QDialog, private Ui_CAboutDlgBase Q_OBJECT public: - CAboutDlg ( QWidget* parent = 0 ); + CAboutDlg ( QWidget* parent = nullptr ); static QString GetVersionAndNameStr ( const bool bWithHtml = true ); }; @@ -424,7 +424,7 @@ class CLicenceDlg : public QDialog Q_OBJECT public: - CLicenceDlg ( QWidget* parent = 0 ); + CLicenceDlg ( QWidget* parent = nullptr ); protected: QPushButton* butAccept; @@ -441,7 +441,7 @@ class CMusProfDlg : public QDialog public: CMusProfDlg ( CClient* pNCliP, - QWidget* parent = 0 ); + QWidget* parent = nullptr ); protected: virtual void showEvent ( QShowEvent* ); @@ -469,7 +469,7 @@ class CHelpMenu : public QMenu Q_OBJECT public: - CHelpMenu ( QWidget* parent = 0 ); + CHelpMenu ( QWidget* parent = nullptr ); protected: CAboutDlg AboutDlg; @@ -993,13 +993,13 @@ public: { switch ( eOSType ) { - case OT_WINDOWS: return "Windows"; break; - case OT_MAC_OS: return "MacOS"; break; - case OT_LINUX: return "Linux"; break; - case OT_ANDROID: return "Android"; break; - case OT_I_OS: return "iOS"; break; - case OT_UNIX: return "Unix"; break; - default: return "Unknown"; break; + case OT_WINDOWS: return "Windows"; + case OT_MAC_OS: return "MacOS"; + case OT_LINUX: return "Linux"; + case OT_ANDROID: return "Android"; + case OT_I_OS: return "iOS"; + case OT_UNIX: return "Unix"; + default: return "Unknown"; } } @@ -1024,7 +1024,7 @@ class CAudioReverb public: CAudioReverb() {} - void Init ( const int iSampleRate, const double rT60 = (double) 1.1 ); + void Init ( const int iSampleRate, const double rT60 = 1.1 ); void Clear(); void ProcessSample ( int16_t& iInputOutputLeft, int16_t& iInputOutputRight, @@ -1083,7 +1083,7 @@ class MathUtils public: static int round ( double x ) { - return (int) ( ( x - floor ( x ) ) >= 0.5 ) ? ceil(x) : floor(x); + return static_cast ( ( x - floor ( x ) ) >= 0.5 ) ? static_cast ( ceil ( x ) ) : static_cast ( floor ( x ) ); } static void UpDownIIR1 ( double& dOldValue,