diff --git a/sflphone-common/src/MimeParameters.h b/sflphone-common/src/MimeParameters.h index 6699dcc1da1dd5b3be35344baf6785c3a9d7082e..8aa682e78e828865336609f0e6305be40c3e9d1b 100644 --- a/sflphone-common/src/MimeParameters.h +++ b/sflphone-common/src/MimeParameters.h @@ -30,8 +30,6 @@ #ifndef __SFL_MIME_PARAMETERS_H__ #define __SFL_MIME_PARAMETERS_H__ -using namespace std; - /** * Start a new payload format definition. */ diff --git a/sflphone-common/src/audio/audiorecord.cpp b/sflphone-common/src/audio/audiorecord.cpp index 98413b7ae6340ae89b9a824bbeede92d616d9613..52cc81b9d894ae6500f37b8553b55bded0b8c530 100644 --- a/sflphone-common/src/audio/audiorecord.cpp +++ b/sflphone-common/src/audio/audiorecord.cpp @@ -29,6 +29,8 @@ */ #include "audiorecord.h" +#include <cstring> // for strstr +#include <sstream> // for stringstream // structure for the wave header @@ -249,7 +251,7 @@ void AudioRecord::createFilename() rawtime = time (NULL); timeinfo = localtime (&rawtime); - stringstream out; + std::stringstream out; // DATE out << timeinfo->tm_year+1900; diff --git a/sflphone-common/src/audio/audiorecord.h b/sflphone-common/src/audio/audiorecord.h index 73bd1a0a75cc70090008fcad2678236157af08b3..8432130c6008eaf887182c4cfb06a85fbe51e456 100644 --- a/sflphone-common/src/audio/audiorecord.h +++ b/sflphone-common/src/audio/audiorecord.h @@ -31,15 +31,11 @@ #ifndef _AUDIO_RECORD_H #define _AUDIO_RECORD_H -#include <iostream> -#include <string.h> -#include <stdlib.h> -#include <sstream> +#include <string> +#include <cstdlib> #include "global.h" -using namespace std; - typedef std::string CallID; class AudioRecord diff --git a/sflphone-common/src/audio/audiortp/AudioRtpRecordHandler.cpp b/sflphone-common/src/audio/audiortp/AudioRtpRecordHandler.cpp index 02aa5ee387e1412aeaaa93cf7c09f3a41893729e..eccbaa98b327f331da29b6d7488e516cc39ffb30 100644 --- a/sflphone-common/src/audio/audiortp/AudioRtpRecordHandler.cpp +++ b/sflphone-common/src/audio/audiortp/AudioRtpRecordHandler.cpp @@ -28,6 +28,7 @@ */ #include "AudioRtpRecordHandler.h" +#include <fstream> #include "audio/audiolayer.h" #include "manager.h" @@ -249,7 +250,7 @@ void AudioRtpRecordHandler::putDtmfEvent (int digit) _debug ("AudioRtpSession: Put Dtmf Event %d", digit); } -ofstream teststream("test_process_data_encode.raw"); +std::ofstream teststream("test_process_data_encode.raw"); int AudioRtpRecordHandler::processDataEncode (void) { diff --git a/sflphone-common/src/audio/audiortp/AudioRtpRecordHandler.h b/sflphone-common/src/audio/audiortp/AudioRtpRecordHandler.h index e1d76d2f34778a4b0b4090e395a8cb3790c36a48..506fadd0c234ef9b02112a09685193a21223861d 100644 --- a/sflphone-common/src/audio/audiortp/AudioRtpRecordHandler.h +++ b/sflphone-common/src/audio/audiortp/AudioRtpRecordHandler.h @@ -40,6 +40,7 @@ #include "audio/gaincontrol.h" #include "managerimpl.h" #include <ccrtp/rtp.h> +#include <list> namespace sfl { @@ -80,7 +81,7 @@ typedef struct DtmfEvent { bool newevent; } DtmfEvent; -typedef list<DtmfEvent *> EventQueue; +typedef std::list<DtmfEvent *> EventQueue; /** * Class meant to store internal data in order to encode/decode, diff --git a/sflphone-common/src/audio/echocancel.cpp b/sflphone-common/src/audio/echocancel.cpp index a19b309f1acd1474e8623387a2d106d449c967b2..e0f2fa077f8b67ad0c660197f27e95a0b03aa4e7 100644 --- a/sflphone-common/src/audio/echocancel.cpp +++ b/sflphone-common/src/audio/echocancel.cpp @@ -69,8 +69,8 @@ EchoCancel::EchoCancel (int smplRate, int frameLength) : _samplingRate (smplRate // echoFile = new ofstream("echoData", ofstream::binary); // spkrFile = new ofstream("spkrData", ofstream::binary); - micLevelData = new ofstream ("micLevelData", ofstream::binary); - spkrLevelData = new ofstream ("spkrLevelData", ofstream::binary); + micLevelData = new std::ofstream ("micLevelData", std::ofstream::binary); + spkrLevelData = new std::ofstream ("spkrLevelData", std::ofstream::binary); _micData = new RingBuffer (50000); diff --git a/sflphone-common/src/audio/echocancel.h b/sflphone-common/src/audio/echocancel.h index d7bed3ccaca8366b6b9c53806c6f3496c460d83f..263a386c8a6dcd0080066d2b2d598a796f760a7f 100644 --- a/sflphone-common/src/audio/echocancel.h +++ b/sflphone-common/src/audio/echocancel.h @@ -31,6 +31,7 @@ #ifndef ECHOCANCEL_H #define ECHOCANCEL_H +#include <iosfwd> // for forward declarations of ofstream #include <cc++/thread.h> #include <speex/speex_preprocess.h> @@ -376,12 +377,12 @@ class EchoCancel : public Algorithm int _correlationArray[BUFF_SIZE]; - ofstream *micFile; - ofstream *spkrFile; - ofstream *echoFile; + std::ofstream *micFile; + std::ofstream *spkrFile; + std::ofstream *echoFile; - ofstream *micLevelData; - ofstream *spkrLevelData; + std::ofstream *micLevelData; + std::ofstream *spkrLevelData; // #ifdef HAVE_SPEEXDSP_LIB /** diff --git a/sflphone-common/src/audio/mainbuffer.cpp b/sflphone-common/src/audio/mainbuffer.cpp index 1ca2794e5573fc2da31587c41720eef8ae33107b..83f4b51941e503f0205ebdd7285c6d45721eec41 100644 --- a/sflphone-common/src/audio/mainbuffer.cpp +++ b/sflphone-common/src/audio/mainbuffer.cpp @@ -30,7 +30,7 @@ */ #include "mainbuffer.h" - +#include <utility> // for std::pair #include "manager.h" MainBuffer::MainBuffer() : _internalSamplingRate (8000) @@ -84,7 +84,7 @@ bool MainBuffer::createCallIDSet (CallID set_id) CallIDSet* newCallIDSet = new CallIDSet; - _callIDMap.insert (pair<CallID, CallIDSet*> (set_id, newCallIDSet)); + _callIDMap.insert (std::pair<CallID, CallIDSet*> (set_id, newCallIDSet)); return true; @@ -149,7 +149,7 @@ RingBuffer* MainBuffer::createRingBuffer (CallID call_id) { RingBuffer* newRingBuffer = new RingBuffer (SIZEBUF, call_id); - _ringBufferMap.insert (pair<CallID, RingBuffer*> (call_id, newRingBuffer)); + _ringBufferMap.insert (std::pair<CallID, RingBuffer*> (call_id, newRingBuffer)); return newRingBuffer; } @@ -646,8 +646,8 @@ void MainBuffer::stateInfo() while (iter_call != _callIDMap.end()) { std::string dbg_str (" Call: "); - dbg_str.append (std::string (iter_call->first.c_str())); - dbg_str.append (std::string (" is bound to: ")); + dbg_str.append (iter_call->first); + dbg_str.append (" is bound to: "); CallIDSet* call_id_set = (CallIDSet*) iter_call->second; @@ -655,8 +655,8 @@ void MainBuffer::stateInfo() while (iter_call_id != call_id_set->end()) { - dbg_str.append (std::string (*iter_call_id)); - dbg_str.append (std::string (", ")); + dbg_str.append (*iter_call_id); + dbg_str.append (", "); iter_call_id++; } @@ -676,8 +676,8 @@ void MainBuffer::stateInfo() std::string dbg_str (" Buffer: "); - dbg_str.append (std::string (iter_buffer->first.c_str())); - dbg_str.append (std::string (" as read pointer: ")); + dbg_str.append (iter_buffer->first); + dbg_str.append (" as read pointer: "); if (rbuffer) rpointer = rbuffer->getReadPointerList(); @@ -688,8 +688,8 @@ void MainBuffer::stateInfo() while (iter_pointer != rpointer->end()) { - dbg_str.append (string (iter_pointer->first.c_str())); - dbg_str.append (string (", ")); + dbg_str.append (iter_pointer->first); + dbg_str.append (", "); iter_pointer++; } diff --git a/sflphone-common/src/audio/ringbuffer.cpp b/sflphone-common/src/audio/ringbuffer.cpp index 7790f362a7de343fa8863770f9e04ea465a3eca0..9d51374049ea789790c944239874dacbb8644298 100644 --- a/sflphone-common/src/audio/ringbuffer.cpp +++ b/sflphone-common/src/audio/ringbuffer.cpp @@ -32,9 +32,10 @@ * as that of the covered work. */ -#include <assert.h> -#include <stdlib.h> -#include <string.h> +#include <cassert> +#include <cstdlib> +#include <cstring> +#include <utility> // for std::pair #include "ringbuffer.h" #include "global.h" @@ -180,7 +181,7 @@ void RingBuffer::createReadPointer (CallID call_id) { if (!hasThisReadPointer (call_id)) - _readpointer.insert (pair<CallID, int> (call_id, mEnd)); + _readpointer.insert (std::pair<CallID, int> (call_id, mEnd)); } diff --git a/sflphone-common/src/audio/ringbuffer.h b/sflphone-common/src/audio/ringbuffer.h index b52cd3417c21f953cd85aeb47ca936547a89f484..cbb532cb65859338fa45a0b2b0decc7a564c8000 100644 --- a/sflphone-common/src/audio/ringbuffer.h +++ b/sflphone-common/src/audio/ringbuffer.h @@ -29,7 +29,7 @@ typedef unsigned char* samplePtr; -typedef map<CallID, int> ReadPointer; +typedef std::map<CallID, int> ReadPointer; static CallID default_id = "audiolayer_id"; diff --git a/sflphone-common/src/managerimpl.cpp b/sflphone-common/src/managerimpl.cpp index f38c7bb4499195421290ab4498f88c03a0f1f759..088f998385d5b05ce74581c4da31eb949dde09aa 100644 --- a/sflphone-common/src/managerimpl.cpp +++ b/sflphone-common/src/managerimpl.cpp @@ -1803,7 +1803,7 @@ bool ManagerImpl::incomingCall (Call* call, const AccountID& accountId) int startIndex = peerNumber.find ("sip:"); - if (startIndex != (int) string::npos) { + if (startIndex != (int) std::string::npos) { std::string strippedPeerNumber = peerNumber.substr (startIndex + 4); call->setPeerNumber (strippedPeerNumber); } diff --git a/sflphone-common/src/sip/sipvoiplink.cpp b/sflphone-common/src/sip/sipvoiplink.cpp index e8f42747d9f42178d6b306a69f004d93a9abc200..c2f0dbc58789f9229ae4c563430fc14842048a24 100644 --- a/sflphone-common/src/sip/sipvoiplink.cpp +++ b/sflphone-common/src/sip/sipvoiplink.cpp @@ -59,6 +59,7 @@ #include <arpa/nameser.h> #include <resolv.h> #include <istream> +#include <utility> // for std::pair #include <sys/types.h> #include <sys/socket.h> @@ -467,7 +468,7 @@ void SIPVoIPLink::sendRegister (AccountID id) throw(VoipLinkException) account->setRegister (true); // Set the expire value of the message from the config file - istringstream stream (account->getRegistrationExpire()); + std::istringstream stream (account->getRegistrationExpire()); stream >> expire_value; if (!expire_value) { @@ -2380,7 +2381,7 @@ bool SIPVoIPLink::addTransportToMap (std::string key, pjsip_transport* transport } _debug ("UserAgent: Storing newly created transport in map using key %s", key.c_str()); - _transportMap.insert (pair<std::string, pjsip_transport*> (key, transport)); + _transportMap.insert (std::pair<std::string, pjsip_transport*> (key, transport)); return true; @@ -3530,11 +3531,11 @@ void sdp_media_update_cb (pjsip_inv_session *inv, pj_status_t status) call->getAudioRtp()->updateSessionMedia (static_cast<AudioCodec *>(audiocodec)); } - } - catch (exception& rtpException) { + } // FIXME: should this really be std::exception? If so, it should be caught last + catch (const std::exception& rtpException) { _error ("UserAgent: Exception: %s", rtpException.what()); } - catch (SdpException &e) { + catch (const SdpException &e) { _error("UserAgent: Exception: %s", e.what()); } @@ -3912,7 +3913,7 @@ transaction_request_cb (pjsip_rx_data *rdata) Manager::instance().hookPreference.getUrlCommand()); } } else - throw length_error ("UserAgent: Url exceeds std::string max_size"); + throw std::length_error ("UserAgent: Url exceeds std::string max_size"); }