From 69061f3d6ad563bd6164386af373598df26f0299 Mon Sep 17 00:00:00 2001
From: Tristan Matthews <tristan.matthews@savoirfairelinux.com>
Date: Mon, 7 Nov 2011 18:20:22 -0500
Subject: [PATCH] * #7393: methods that return pointers to internal members
 should not be const

---
 daemon/src/managerimpl.cpp              | 2 +-
 daemon/src/managerimpl.h                | 4 ++--
 daemon/src/managerimpl_registration.cpp | 2 +-
 daemon/src/sip/sdp.cpp                  | 6 +++---
 daemon/src/sip/sdp.h                    | 4 ++--
 daemon/src/sip/sipaccount.h             | 4 ++--
 daemon/src/sip/sipvoiplink.cpp          | 2 +-
 plugins/addressbook/evolution/eds.c     | 1 -
 8 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/daemon/src/managerimpl.cpp b/daemon/src/managerimpl.cpp
index daf8379e97..14e8e391a9 100644
--- a/daemon/src/managerimpl.cpp
+++ b/daemon/src/managerimpl.cpp
@@ -2761,7 +2761,7 @@ bool ManagerImpl::accountExists(const std::string& accountID)
 }
 
 Account*
-ManagerImpl::getAccount(const std::string& accountID) const
+ManagerImpl::getAccount(const std::string& accountID)
 {
     AccountMap::const_iterator iter = accountMap_.find(accountID);
     if (iter != accountMap_.end())
diff --git a/daemon/src/managerimpl.h b/daemon/src/managerimpl.h
index 90bb4baf80..6370ee25da 100644
--- a/daemon/src/managerimpl.h
+++ b/daemon/src/managerimpl.h
@@ -1160,7 +1160,7 @@ class ManagerImpl {
          * @param accountID account ID to get
          * @return Account*	 The account pointer or 0
          */
-        Account* getAccount(const std::string& accountID) const;
+        Account* getAccount(const std::string& accountID);
 
         /** Return the std::string from a CallID
          * Protected by mutex
@@ -1174,7 +1174,7 @@ class ManagerImpl {
          * @param accountID	  Account ID to get
          * @return VoIPLink*   The voip link from the account pointer or 0
          */
-        VoIPLink* getAccountLink(const std::string& accountID="") const;
+        VoIPLink* getAccountLink(const std::string& accountID="");
 
         std::string getAccountIdFromNameAndServer(const std::string& userName, const std::string& server) const;
 
diff --git a/daemon/src/managerimpl_registration.cpp b/daemon/src/managerimpl_registration.cpp
index 5d7b4a101a..dbccb44eb6 100644
--- a/daemon/src/managerimpl_registration.cpp
+++ b/daemon/src/managerimpl_registration.cpp
@@ -63,7 +63,7 @@ ManagerImpl::registerAccounts()
 }
 
 
-VoIPLink* ManagerImpl::getAccountLink(const std::string& accountID) const
+VoIPLink* ManagerImpl::getAccountLink(const std::string& accountID)
 {
     if (not accountID.empty())
         return getAccount(accountID)->getVoIPLink();
diff --git a/daemon/src/sip/sdp.cpp b/daemon/src/sip/sdp.cpp
index 26301456a1..136515bb1c 100644
--- a/daemon/src/sip/sdp.cpp
+++ b/daemon/src/sip/sdp.cpp
@@ -113,7 +113,7 @@ void Sdp::setActiveRemoteSdpSession(const pjmedia_sdp_session *sdp)
     ERROR("Sdp: Error: Could not found dtmf event from remote sdp");
 }
 
-std::string Sdp::getCodecName() const
+std::string Sdp::getCodecName()
 {
     try {
         sfl::AudioCodec *codec = getSessionMedia();
@@ -123,12 +123,12 @@ std::string Sdp::getCodecName() const
     }
 }
 
-sfl::AudioCodec* Sdp::getSessionMedia() const
+sfl::AudioCodec* Sdp::getSessionMedia()
 {
     if (sessionAudioMedia_.size() < 1)
         throw SdpException("No codec description for this media");
 
-    return static_cast<sfl::AudioCodec *>(sessionAudioMedia_[0]);
+    return dynamic_cast<sfl::AudioCodec *>(sessionAudioMedia_[0]);
 }
 
 
diff --git a/daemon/src/sip/sdp.h b/daemon/src/sip/sdp.h
index c6a9f78ca4..586fb904af 100644
--- a/daemon/src/sip/sdp.h
+++ b/daemon/src/sip/sdp.h
@@ -138,7 +138,7 @@ class Sdp {
          * Return the codec of the first media after negotiation
          * @throw SdpException
          */
-        sfl::AudioCodec* getSessionMedia() const;
+        sfl::AudioCodec* getSessionMedia();
 
         /*
          * On building an invite outside a dialog, build the local offer and create the
@@ -271,7 +271,7 @@ class Sdp {
 
         void setMediaTransportInfoFromRemoteSdp();
 
-        std::string getCodecName() const;
+        std::string getCodecName();
 
         void receivingAnswerAfterInitialOffer(const pjmedia_sdp_session* remote);
 
diff --git a/daemon/src/sip/sipaccount.h b/daemon/src/sip/sipaccount.h
index 59075f5bf3..1473ec9775 100644
--- a/daemon/src/sip/sipaccount.h
+++ b/daemon/src/sip/sipaccount.h
@@ -204,7 +204,7 @@ class SIPAccount : public Account {
          * @param void
          * @return pjsip_regc* A pointer to the registration structure
          */
-        pjsip_regc* getRegistrationInfo() const {
+        pjsip_regc* getRegistrationInfo() {
             return regc_;
         }
 
@@ -223,7 +223,7 @@ class SIPAccount : public Account {
          * file, that can be used directly by PJSIP to initialize
          * TLS transport.
          */
-        const pjsip_tls_setting * getTlsSetting() const {
+        pjsip_tls_setting * getTlsSetting() {
             return &tlsSetting_;
         }
 
diff --git a/daemon/src/sip/sipvoiplink.cpp b/daemon/src/sip/sipvoiplink.cpp
index 97b9549909..48a5a577b8 100644
--- a/daemon/src/sip/sipvoiplink.cpp
+++ b/daemon/src/sip/sipvoiplink.cpp
@@ -282,7 +282,7 @@ SIPVoIPLink::getEvent()
 
 void SIPVoIPLink::sendRegister(Account *a)
 {
-    SIPAccount *account = static_cast<SIPAccount*>(a);
+    SIPAccount *account = dynamic_cast<SIPAccount*>(a);
     createSipTransport(account);
 
     account->setRegister(true);
diff --git a/plugins/addressbook/evolution/eds.c b/plugins/addressbook/evolution/eds.c
index ca036ea4d4..b1171fb430 100644
--- a/plugins/addressbook/evolution/eds.c
+++ b/plugins/addressbook/evolution/eds.c
@@ -41,7 +41,6 @@
 #include <string.h>
 #include <pango/pango.h>
 #include "eds.h"
-//#include <addressbook-config.h>
 #include <libedataserver/e-source.h>
 
 #include "config.h"
-- 
GitLab