diff --git a/src/audio/alaw.cpp b/src/audio/alaw.cpp index 041ee3337f86f22056eb7ebb5ef3911495de306a..3c3dc34fdb743b1943d0ddfd227c8c91784568c2 100644 --- a/src/audio/alaw.cpp +++ b/src/audio/alaw.cpp @@ -20,7 +20,7 @@ #include "g711.h" #include "alaw.h" -Alaw::Alaw(int payload, const string& codec) : AudioCodec(payload, codec) +Alaw::Alaw(int payload, const std::string& codec) : AudioCodec(payload, codec) { _codecName = codec; _payload = payload; diff --git a/src/audio/alaw.h b/src/audio/alaw.h index 27a6038670cac02314fd47b321c8035aec352949..c75e0a550b239542e9395453515ea4da127f4c27 100644 --- a/src/audio/alaw.h +++ b/src/audio/alaw.h @@ -24,14 +24,14 @@ class Alaw : public AudioCodec { public: - Alaw (int payload, const string& codec); + Alaw (int payload, const std::string& codec); ~Alaw (void); int codecDecode (short *, unsigned char *, unsigned int); int codecEncode (unsigned char *, short *, unsigned int); private: - string _codecName; + std::string _codecName; int _payload; }; diff --git a/src/audio/audiocodec.cpp b/src/audio/audiocodec.cpp index 146b0cd137fbe145a8718bcac9478f9d3cf892d5..358aeb616efe1a9bc867ed0c0c53c10195c3ce64 100644 --- a/src/audio/audiocodec.cpp +++ b/src/audio/audiocodec.cpp @@ -22,10 +22,7 @@ #include "audiocodec.h" -using namespace std; - - -AudioCodec::AudioCodec (int payload, const string& codec) { +AudioCodec::AudioCodec (int payload, const std::string& codec) { _codecName = codec; _payload = payload; } @@ -34,12 +31,12 @@ AudioCodec::~AudioCodec (void) { } void -AudioCodec::setCodecName (const string& codec) +AudioCodec::setCodecName (const std::string& codec) { _codecName = codec; } -string +std::string AudioCodec::getCodecName (void) { return _codecName; diff --git a/src/audio/audiocodec.h b/src/audio/audiocodec.h index a464ba76c362ac2cb7474f7393ad6ea15695ea07..cf682f89bf3be06e7c82b187bbb5114adf225e51 100644 --- a/src/audio/audiocodec.h +++ b/src/audio/audiocodec.h @@ -1,5 +1,6 @@ /** * Copyright (C) 2004-2005 Savoir-Faire Linux inc. + * Author: Yan Morin <yan.morin@savoirfairelinux.com> * Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -24,23 +25,19 @@ #include <string> #include "../global.h" -using namespace std; - - - class AudioCodec { public: - AudioCodec(int payload, const string& codec); + AudioCodec(int payload, const std::string& codec); virtual ~AudioCodec (void); virtual int codecDecode (short *, unsigned char *, unsigned int) = 0; virtual int codecEncode (unsigned char *, short *, unsigned int) = 0; - void setCodecName (const string& codec); - string getCodecName (void); + void setCodecName (const std::string& codec); + std::string getCodecName (void); private: - string _codecName; + std::string _codecName; int _payload; }; diff --git a/src/audio/audiolayer.cpp b/src/audio/audiolayer.cpp index 66811e2853def16d30dd687d065ad3146380f61b..c5ba9570e5289fe37b6b150be333ea1264199bc3 100644 --- a/src/audio/audiolayer.cpp +++ b/src/audio/audiolayer.cpp @@ -19,18 +19,15 @@ */ #ifdef AUDIO_PORTAUDIO - + #include <stdio.h> #include <stdlib.h> -#include <string.h> #include "audiolayer.h" #include "../error.h" #include "../global.h" #include "../manager.h" -using namespace std; - AudioLayer::AudioLayer () : _urgentRingBuffer(SIZEBUF) , _mainSndRingBuffer(SIZEBUF) @@ -210,8 +207,8 @@ AudioLayer::audioCallback (const void *inputBuffer, void *outputBuffer, toPut = (micAvailPut <= (int)framesPerBuffer) ? micAvailPut : framesPerBuffer; _micRingBuffer.Put(in, SAMPLES_SIZE(toPut)); - - return paContinue; + + return paContinue; } #endif // defined(AUDIO_PORTAUDIO) diff --git a/src/audio/audiortp.cpp b/src/audio/audiortp.cpp index b22b7da30817f26642e776c4cdf9f2c6b8603b47..b85805c167478c52c4825e1446dc09f4bcc1ee25 100644 --- a/src/audio/audiortp.cpp +++ b/src/audio/audiortp.cpp @@ -21,8 +21,7 @@ #include <cstdio> #include <cstdlib> #include <ccrtp/rtp.h> -#include <assert.h> -#include <iostream> +#include <assert.h> #include <string> #include "../global.h" @@ -36,10 +35,6 @@ #include "../sipcall.h" #include "../../stund/stun.h" -using namespace ost; -using namespace std; - - //////////////////////////////////////////////////////////////////////////////// // AudioRtp //////////////////////////////////////////////////////////////////////////////// @@ -48,7 +43,6 @@ AudioRtp::AudioRtp () { } AudioRtp::~AudioRtp (void) { - terminate(); delete _RTXThread; _RTXThread = NULL; } @@ -102,21 +96,24 @@ AudioRtp::closeRtpSession (SipCall *ca) { AudioRtpRTX::AudioRtpRTX (SipCall *sipcall, AudioLayer* driver, bool sym) { - time = new Time(); + time = new ost::Time(); _ca = sipcall; _sym = sym; _audioDevice = driver; // TODO: Change bind address according to user settings. std::string localipConfig = _ca->getLocalIp(); - InetHostAddress local_ip(localipConfig.c_str()); + ost::InetHostAddress local_ip(localipConfig.c_str()); _debug("RTP: listening on IP %s local port : %d\n", localipConfig.c_str(), _ca->getLocalAudioPort()); if (!_sym) { - _sessionRecv = new RTPSession (local_ip, _ca->getLocalAudioPort()); - _sessionSend = new RTPSession (local_ip); + _sessionRecv = new ost::RTPSession (local_ip, _ca->getLocalAudioPort()); + _sessionSend = new ost::RTPSession (local_ip); + _session = NULL; } else { - _session = new SymmetricRTPSession (local_ip, _ca->getLocalAudioPort()); + _session = new ost::SymmetricRTPSession (local_ip, _ca->getLocalAudioPort()); + _sessionRecv = NULL; + _sessionSend = NULL; } } @@ -135,7 +132,7 @@ AudioRtpRTX::~AudioRtpRTX () { void AudioRtpRTX::initAudioRtpSession (void) { - InetHostAddress remote_ip(_ca->getRemoteSdpAudioIp()); + ost::InetHostAddress remote_ip(_ca->getRemoteSdpAudioIp()); if (!remote_ip) { _debug("RTP: Target IP address [%s] is not correct!\n", _ca->getRemoteSdpAudioIp()); @@ -170,8 +167,8 @@ AudioRtpRTX::initAudioRtpSession (void) //setPayloadFormat(StaticPayloadFormat(sptPCMU)); _debug("Payload Format: %d\n", _ca->payload); - _sessionRecv->setPayloadFormat(StaticPayloadFormat((StaticPayloadType) _ca->payload)); - _sessionSend->setPayloadFormat(StaticPayloadFormat((StaticPayloadType) _ca->payload)); + _sessionRecv->setPayloadFormat(ost::StaticPayloadFormat((ost::StaticPayloadType) _ca->payload)); + _sessionSend->setPayloadFormat(ost::StaticPayloadFormat((ost::StaticPayloadType) _ca->payload)); setCancel(cancelImmediate); _sessionSend->setMark(true); @@ -180,7 +177,7 @@ AudioRtpRTX::initAudioRtpSession (void) if (!_session->addDestination (remote_ip, (unsigned short) _ca->getRemoteSdpAudioPort())) { return; } else { - _session->setPayloadFormat(StaticPayloadFormat((StaticPayloadType) _ca->payload)); + _session->setPayloadFormat(ost::StaticPayloadFormat((ost::StaticPayloadType) _ca->payload)); setCancel(cancelImmediate); } } @@ -232,7 +229,7 @@ AudioRtpRTX::receiveSessionForSpkr (int16* data_for_speakers, { int expandedSize; int k; - const AppDataUnit* adu = NULL; + const ost::AppDataUnit* adu = NULL; // Get audio data stream if (!_sym) { diff --git a/src/audio/codecDescriptor.cpp b/src/audio/codecDescriptor.cpp index 1c6ed5261a30bedcf7ac11bed643375641323652..7c64f397a793ca191011af361b13e62ec35efd5e 100644 --- a/src/audio/codecDescriptor.cpp +++ b/src/audio/codecDescriptor.cpp @@ -129,23 +129,23 @@ CodecDescriptor::rtpmapPayload (int payload) { // we create one, but in MainManager for the list switch (payload) { case PAYLOAD_CODEC_ALAW: - return string("PCMA"); + return std::string("PCMA"); break; case PAYLOAD_CODEC_ULAW: - return string("PCMU"); + return std::string("PCMU"); break; case PAYLOAD_CODEC_GSM: - return string("GSM"); + return std::string("GSM"); break; case PAYLOAD_CODEC_ILBC: - return string("iLBC"); + return std::string("iLBC"); break; case PAYLOAD_CODEC_SPEEX: - return string("speex"); + return std::string("speex"); break; default: diff --git a/src/audio/gsmcodec.cpp b/src/audio/gsmcodec.cpp index 9f18951de4d7cae9779dc6f989eb31847f35613b..36767d1c410c18f8e7fb6bd99c8ad1273e20481b 100644 --- a/src/audio/gsmcodec.cpp +++ b/src/audio/gsmcodec.cpp @@ -21,7 +21,7 @@ #include "gsmcodec.h" #include "../global.h" -Gsm::Gsm(int payload, const string& codec) : AudioCodec(payload, codec) +Gsm::Gsm(int payload, const std::string& codec) : AudioCodec(payload, codec) { _codecName = codec; _payload = payload; diff --git a/src/audio/gsmcodec.h b/src/audio/gsmcodec.h index 03fcd3542731a337c43a1713df34632d482275de..27073fbb322b7c3fbf275b5cc2c345eb61d70058 100644 --- a/src/audio/gsmcodec.h +++ b/src/audio/gsmcodec.h @@ -27,14 +27,14 @@ extern "C" { class Gsm : public AudioCodec { public: - Gsm (int payload, const string& codec); + Gsm (int payload, const std::string& codec); ~Gsm (void); int codecDecode (short *, unsigned char *, unsigned int); int codecEncode (unsigned char *, short *, unsigned int); private: - string _codecName; + std::string _codecName; int _payload; gsm _decode_gsmhandle; gsm _encode_gsmhandle; diff --git a/src/audio/tonegenerator.cpp b/src/audio/tonegenerator.cpp index 1842f6f443d5b9f86ce02a323f1257c7e1076359..18508b92d7caf86f8363d010d396a4f813c923fd 100644 --- a/src/audio/tonegenerator.cpp +++ b/src/audio/tonegenerator.cpp @@ -31,8 +31,6 @@ #include "../manager.h" #include "../user_cfg.h" -using namespace std; - int AMPLITUDE = 8192; @@ -184,14 +182,14 @@ ToneGenerator::generateSin (int lowerfreq, int higherfreq, int16* ptr, int len) */ void ToneGenerator::buildTone (unsigned int idCountry, unsigned int idTones, int16* temp) { - string s; + std::string s; int count = 0; int byte = 0; int nbcomma = 0; int16 *buffer = new int16[SIZEBUF]; //1kb int pos; - string str(toneZone[idCountry][idTones]); + std::string str(toneZone[idCountry][idTones]); nbcomma = contains(toneZone[idCountry][idTones], ','); // Number of format sections @@ -271,7 +269,7 @@ ToneGenerator::buildTone (unsigned int idCountry, unsigned int idTones, int16* t * @return id of the zone */ int -ToneGenerator::idZoneName (const string& name) { +ToneGenerator::idZoneName (const std::string& name) { if (name.compare("North America") == 0) { return ID_NORTH_AMERICA; } else if (name.compare("France") == 0) { @@ -350,16 +348,16 @@ ToneGenerator::playRingtone (const char *fileName) { return 0; } - fstream file; - file.open(fileName, fstream::in); + std::fstream file; + file.open(fileName, std::fstream::in); if (!file.is_open()) { return 0; } // get length of file: - file.seekg (0, ios::end); + file.seekg (0, std::ios::end); length = file.tellg(); - file.seekg (0, ios::beg); + file.seekg (0, std::ios::beg); // allocate memory: _src = new char [length]; @@ -382,12 +380,12 @@ ToneGenerator::playRingtone (const char *fileName) { } int -ToneGenerator::contains (const string& str, char c) +ToneGenerator::contains (const std::string& str, char c) { static int nb = 0; unsigned int pos = str.find(c); - if (pos != string::npos) { + if (pos != std::string::npos) { nb = nb + 1; return contains(str.substr(pos + 1, str.length()), c); } else { diff --git a/src/audio/ulaw.cpp b/src/audio/ulaw.cpp index fd3cddd0c0e0031e65146e6172ec9d1b3dfca612..3830587d93af1ba31efbb83f292cf1fd27596c68 100644 --- a/src/audio/ulaw.cpp +++ b/src/audio/ulaw.cpp @@ -20,7 +20,7 @@ #include "g711.h" #include "ulaw.h" -Ulaw::Ulaw(int payload, const string& codec) : AudioCodec(payload, codec) +Ulaw::Ulaw(int payload, const std::string& codec) : AudioCodec(payload, codec) { _codecName = codec; _payload = payload; diff --git a/src/audio/ulaw.h b/src/audio/ulaw.h index 418f224804b2feac25d853fa21232d919cf6be66..eff25df25393d8d2b5a7b4fe33d2ec238889c8b0 100644 --- a/src/audio/ulaw.h +++ b/src/audio/ulaw.h @@ -24,14 +24,14 @@ class Ulaw : public AudioCodec { public: - Ulaw (int payload, const string& codec); + Ulaw (int payload, const std::string& codec); ~Ulaw (void); int codecDecode (short *, unsigned char *, unsigned int); int codecEncode (unsigned char *, short *, unsigned int); private: - string _codecName; + std::string _codecName; int _payload; }; diff --git a/src/error.cpp b/src/error.cpp index 57395a10c2a7e69432d78aed8c46d9051385e601..bcc3985a8dda1e3973bfe21e5b553bee7d88fb05 100644 --- a/src/error.cpp +++ b/src/error.cpp @@ -22,8 +22,6 @@ #include "global.h" #include "error.h" #include "manager.h" - -using namespace std; Error::Error (){ issetError = 0; @@ -31,7 +29,6 @@ Error::Error (){ int Error::errorName (Error_enum num_name) { - string str; switch (num_name){ // Handle opening device errors case OPEN_FAILED_DEVICE: diff --git a/src/eventthread.cpp b/src/eventthread.cpp index fd25ed60e489d7d5309f72a6626850e6ca71508e..67cff80b7367a9abc059efcd2276a218e04991e4 100644 --- a/src/eventthread.cpp +++ b/src/eventthread.cpp @@ -17,13 +17,9 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <iostream> - #include "eventthread.h" #include "sipvoiplink.h" -using namespace std; - EventThread::EventThread (SipVoIPLink* sip) : Thread () { _sipthread = sip; diff --git a/src/gui/guiframework.cpp b/src/gui/guiframework.cpp index 00d013c679bb91c3e53b90ad032d710ea83cd1e1..c927faf0831816f95dd991c64143f0d8b95bfaee 100644 --- a/src/gui/guiframework.cpp +++ b/src/gui/guiframework.cpp @@ -19,8 +19,6 @@ */ #include <string> -using namespace std; - #include "guiframework.h" #include "../manager.h" @@ -30,7 +28,7 @@ GuiFramework::GuiFramework () GuiFramework::~GuiFramework (void) {} int -GuiFramework::outgoingCall (const string& to) +GuiFramework::outgoingCall (const std::string& to) { return Manager::instance().outgoingCall(to); } @@ -86,7 +84,7 @@ GuiFramework::offHoldCall (CALLID id) } int -GuiFramework::transferCall (CALLID id, const string& to) +GuiFramework::transferCall (CALLID id, const std::string& to) { if (Manager::instance().transferCall(id, to) == 0) { return 1; diff --git a/src/managerimpl.cpp b/src/managerimpl.cpp index 6aa65dddf20ba71da6fe553f44242229ebdf1e42..ada5d845ee9ad753968ed27839b85d6e153a19d6 100644 --- a/src/managerimpl.cpp +++ b/src/managerimpl.cpp @@ -55,9 +55,6 @@ #define fill_config_int(name, value) \ (_config.addConfigTreeItem(section, Conf::ConfigTreeItem(std::string(name), std::string(value), type_int))) -//using namespace std; -//using namespace ost; - ManagerImpl::ManagerImpl (void) { // initialize random generator @@ -133,7 +130,7 @@ ManagerImpl::init (void) displayError(e.what()); throw e; } - catch (const exception &e) + catch (const std::exception &e) { displayError(e.what()); throw e; diff --git a/src/sipcall.cpp b/src/sipcall.cpp index 6917fbef1e9d5feacaeaf5142a4ad5ac18b68980..2028c1481fb2a02a3445ba30b1cda76e87ee30f0 100644 --- a/src/sipcall.cpp +++ b/src/sipcall.cpp @@ -21,10 +21,8 @@ */ #include <osipparser2/sdp_message.h> -#include <string.h> +#include <string.h> // strcpy -#include <iostream> - // For AF_INET #include <sys/socket.h> @@ -33,8 +31,6 @@ #include "audio/codecDescriptor.h" #include "sipcall.h" -using namespace std; - SipCall::SipCall (CALLID id, CodecDescriptorVector* cdv) : _localIp("127.0.0.1") { _id = id; // Same id of Call object diff --git a/src/sipcall.h b/src/sipcall.h index 0b3cf478cdaffed39a46c8dd1e5f606a67a6f6a0..18cb3864ae54fbde343acc1ec2f2bf92089a903a 100644 --- a/src/sipcall.h +++ b/src/sipcall.h @@ -36,7 +36,7 @@ class AudioCodec; #define _RECVONLY 2 // Vector of CodecDescriptor -typedef std::vector<CodecDescriptor*, allocator<CodecDescriptor*> > CodecDescriptorVector; +typedef std::vector<CodecDescriptor*, std::allocator<CodecDescriptor*> > CodecDescriptorVector; class SipCall { public: diff --git a/src/sipvoiplink.cpp b/src/sipvoiplink.cpp index 3936a1a7d089f3a4349b61f645e3c96159d63928..e187dea7728c22e32c9e7b1a3164317fba070bab 100644 --- a/src/sipvoiplink.cpp +++ b/src/sipvoiplink.cpp @@ -53,8 +53,8 @@ SipVoIPLink::SipVoIPLink() SipVoIPLink::~SipVoIPLink(void) { endSipCalls(); - eXosip_quit(); delete _evThread; _evThread = NULL; + eXosip_quit(); } // for voIPLink interface @@ -1310,9 +1310,9 @@ FULL_NAME); std::string -SipVoIPLink::toHeader(const string& to) +SipVoIPLink::toHeader(const std::string& to) { - if (to.find("sip:") == string::npos) { + if (to.find("sip:") == std::string::npos) { return ("sip:" + to ); } else { return to; diff --git a/src/voIPLink.cpp b/src/voIPLink.cpp index b74cb20fe0c85dd2aa160b079bf2d396469d1380..36ce64c74434589424ecbc3f1c8f0195d9b620af 100644 --- a/src/voIPLink.cpp +++ b/src/voIPLink.cpp @@ -24,10 +24,6 @@ #include "voIPLink.h" #include "manager.h" - -using namespace std; - - VoIPLink::VoIPLink () { initConstructor(); @@ -50,36 +46,36 @@ VoIPLink::getType (void) } void -VoIPLink::setFullName (const string& fullname) +VoIPLink::setFullName (const std::string& fullname) { _fullname = fullname; } -string +std::string VoIPLink::getFullName (void) { return _fullname; } void -VoIPLink::setHostName (const string& hostname) +VoIPLink::setHostName (const std::string& hostname) { _hostname = hostname; } -string +std::string VoIPLink::getHostName (void) { return _hostname; } void -VoIPLink::setLocalIpAddress (const string& ipAdress) +VoIPLink::setLocalIpAddress (const std::string& ipAdress) { _localIpAddress = ipAdress; } -string +std::string VoIPLink::getLocalIpAddress (void) { return _localIpAddress;