Commit 0678844a authored by Alexandre Bourget's avatar Alexandre Bourget
Browse files

Please use NULL instead of 0 when pointers are reset and compared.

+ minor cosmetics
parent 4538278e
...@@ -75,7 +75,7 @@ public: ...@@ -75,7 +75,7 @@ public:
/** /**
* Init the voiplink to run (event listener) * Init the voiplink to run (event listener)
* @return false is an error occurs * @return false if an error occurs
*/ */
virtual bool init() = 0; virtual bool init() = 0;
...@@ -92,8 +92,8 @@ public: ...@@ -92,8 +92,8 @@ public:
bool shouldInitOnStart() {return _shouldInitOnStart; } bool shouldInitOnStart() {return _shouldInitOnStart; }
/** /**
* Tell if we should init the account on start * Tell if we should register the account on start
* @return true if we must init the link * @return true if we must register the account
*/ */
bool shouldRegisterOnStart() {return _shouldRegisterOnStart; } bool shouldRegisterOnStart() {return _shouldRegisterOnStart; }
......
...@@ -65,13 +65,13 @@ IAXVoIPLink::IAXVoIPLink(const AccountID& accountID) ...@@ -65,13 +65,13 @@ IAXVoIPLink::IAXVoIPLink(const AccountID& accountID)
: VoIPLink(accountID) : VoIPLink(accountID)
{ {
_evThread = new EventThread(this); _evThread = new EventThread(this);
_regSession = 0; _regSession = NULL;
// to get random number for RANDOM_PORT // to get random number for RANDOM_PORT
srand (time(NULL)); srand (time(NULL));
audiocodec = 0; audiocodec = NULL;
audiolayer = 0; audiolayer = NULL;
_receiveDataDecoded = new int16[IAX__20S_48KHZ_MAX]; _receiveDataDecoded = new int16[IAX__20S_48KHZ_MAX];
_sendDataEncoded = new unsigned char[IAX__20S_8KHZ_MAX]; _sendDataEncoded = new unsigned char[IAX__20S_8KHZ_MAX];
...@@ -86,19 +86,19 @@ IAXVoIPLink::IAXVoIPLink(const AccountID& accountID) ...@@ -86,19 +86,19 @@ IAXVoIPLink::IAXVoIPLink(const AccountID& accountID)
IAXVoIPLink::~IAXVoIPLink() IAXVoIPLink::~IAXVoIPLink()
{ {
delete _evThread; _evThread = 0; delete _evThread; _evThread = NULL;
_regSession = 0; // shall not delete it _regSession = NULL; // shall not delete it
terminate(); terminate();
audiocodec = 0; audiocodec = NULL;
audiolayer = 0; audiolayer = NULL;
delete [] _intBuffer8000; _intBuffer8000 = 0; delete [] _intBuffer8000; _intBuffer8000 = NULL;
delete [] _floatBuffer48000; _floatBuffer48000 = 0; delete [] _floatBuffer48000; _floatBuffer48000 = NULL;
delete [] _floatBuffer8000; _floatBuffer8000 = 0; delete [] _floatBuffer8000; _floatBuffer8000 = NULL;
delete [] _dataAudioLayer; _dataAudioLayer = 0; delete [] _dataAudioLayer; _dataAudioLayer = NULL;
delete [] _sendDataEncoded; _sendDataEncoded = 0; delete [] _sendDataEncoded; _sendDataEncoded = NULL;
delete [] _receiveDataDecoded; _receiveDataDecoded = 0; delete [] _receiveDataDecoded; _receiveDataDecoded = NULL;
} }
bool bool
...@@ -176,12 +176,12 @@ IAXVoIPLink::getEvent() ...@@ -176,12 +176,12 @@ IAXVoIPLink::getEvent()
// mutex here // mutex here
_mutexIAX.enterMutex(); _mutexIAX.enterMutex();
iax_event* event = 0; iax_event* event = NULL;
IAXCall* call = 0; IAXCall* call = NULL;
while ( (event = iax_get_event(0)) != 0 ) { while ( (event = iax_get_event(TRUE)) != NULL ) {
//_debug ("Receive IAX Event: %d\n", event->etype); //_debug ("Receive IAX Event: %d\n", event->etype);
call = iaxFindCallBySession(event->session); call = iaxFindCallBySession(event->session);
if (call!=0) { if (call != 0) {
iaxHandleCallEvent(event, call); iaxHandleCallEvent(event, call);
} else if (event->session != 0 && event->session == _regSession) { } else if (event->session != 0 && event->session == _regSession) {
// in iaxclient, there is many session handling, here, only one // in iaxclient, there is many session handling, here, only one
...@@ -235,7 +235,7 @@ bool ...@@ -235,7 +235,7 @@ bool
IAXVoIPLink::setRegister() IAXVoIPLink::setRegister()
{ {
bool result = false; bool result = false;
if (_regSession==0) { if (_regSession == NULL) {
if (_host.empty()) { if (_host.empty()) {
Manager::instance().displayConfigError("Fill host field for IAX Account"); Manager::instance().displayConfigError("Fill host field for IAX Account");
return false; return false;
...@@ -276,11 +276,11 @@ IAXVoIPLink::setRegister() ...@@ -276,11 +276,11 @@ IAXVoIPLink::setRegister()
bool bool
IAXVoIPLink::setUnregister() IAXVoIPLink::setUnregister()
{ {
if (_regSession==0) { if (_regSession == NULL) {
// lock here // lock here
_mutexIAX.enterMutex(); _mutexIAX.enterMutex();
iax_destroy(_regSession); iax_destroy(_regSession);
_regSession = 0; _regSession = NULL;
// unlock here // unlock here
_mutexIAX.leaveMutex(); _mutexIAX.leaveMutex();
return false; return false;
...@@ -520,7 +520,7 @@ IAXVoIPLink::iaxHandleCallEvent(iax_event* event, IAXCall* call) ...@@ -520,7 +520,7 @@ IAXVoIPLink::iaxHandleCallEvent(iax_event* event, IAXCall* call)
break; break;
case IAX_EVENT_VOICE: case IAX_EVENT_VOICE:
if (audiocodec != 0 && audiolayer!=0) { if (audiocodec != NULL && audiolayer != NULL) {
//_debug("Receive: len=%d, format=%d, _receiveDataDecoded=%p\n", event->datalen, call->getFormat(), _receiveDataDecoded); //_debug("Receive: len=%d, format=%d, _receiveDataDecoded=%p\n", event->datalen, call->getFormat(), _receiveDataDecoded);
unsigned char* data = (unsigned char*)event->data; unsigned char* data = (unsigned char*)event->data;
unsigned int size = event->datalen; unsigned int size = event->datalen;
...@@ -609,7 +609,7 @@ IAXVoIPLink::iaxHandleRegReply(iax_event* event) ...@@ -609,7 +609,7 @@ IAXVoIPLink::iaxHandleRegReply(iax_event* event)
//unregister //unregister
if (event->etype == IAX_EVENT_REGREJ) { if (event->etype == IAX_EVENT_REGREJ) {
iax_destroy(_regSession); iax_destroy(_regSession);
_regSession = 0; _regSession = NULL;
Manager::instance().registrationFailed(getAccountID()); Manager::instance().registrationFailed(getAccountID());
} else if (event->etype == IAX_EVENT_REGACK) { } else if (event->etype == IAX_EVENT_REGACK) {
Manager::instance().registrationSucceed(getAccountID()); Manager::instance().registrationSucceed(getAccountID());
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment