[Asterisk-code-review] SDP: Make SDP translation to/from internal representation mo... (asterisk[master])

Joshua Colp asteriskteam at digium.com
Tue May 2 05:19:59 CDT 2017


Joshua Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/5554 )

Change subject: SDP: Make SDP translation to/from internal representation more const.
......................................................................


SDP: Make SDP translation to/from internal representation more const.

Change-Id: I473a174b869728604b37c60853896b0c458bc504
---
M include/asterisk/sdp_state.h
M include/asterisk/sdp_translator.h
M main/sdp_state.c
M main/sdp_translator.c
M res/res_sdp_translator_pjmedia.c
5 files changed, 14 insertions(+), 14 deletions(-)

Approvals:
  Mark Michelson: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved; Approved for Submit



diff --git a/include/asterisk/sdp_state.h b/include/asterisk/sdp_state.h
index 88660b6..c2122fb 100644
--- a/include/asterisk/sdp_state.h
+++ b/include/asterisk/sdp_state.h
@@ -164,7 +164,7 @@
  *
  * \since 15
  */
-int ast_sdp_state_set_remote_sdp_from_impl(struct ast_sdp_state *sdp_state, void *remote);
+int ast_sdp_state_set_remote_sdp_from_impl(struct ast_sdp_state *sdp_state, const void *remote);
 
 /*!
  * \brief Reset the SDP state and stream capabilities as if the SDP state had just been allocated.
diff --git a/include/asterisk/sdp_translator.h b/include/asterisk/sdp_translator.h
index 09901af..e1d51f0 100644
--- a/include/asterisk/sdp_translator.h
+++ b/include/asterisk/sdp_translator.h
@@ -34,9 +34,9 @@
 	/*! Free translator private data */
 	void (*translator_free)(void *translator_priv);
 	/*! Convert the channel-native SDP into an internal Asterisk SDP */
-	struct ast_sdp *(*to_sdp)(void *repr_sdp, void *translator_priv);
+	struct ast_sdp *(*to_sdp)(const void *repr_sdp, void *translator_priv);
 	/*! Convert an internal Asterisk SDP into a channel-native SDP */
-	void *(*from_sdp)(const struct ast_sdp *sdp, void *translator_priv);
+	const void *(*from_sdp)(const struct ast_sdp *sdp, void *translator_priv);
 };
 
 /*!
@@ -87,7 +87,7 @@
  * \retval NULL FAIL
  * \retval Non-NULL The translated SDP
  */
-struct ast_sdp *ast_sdp_translator_to_sdp(struct ast_sdp_translator *translator, void *native_sdp);
+struct ast_sdp *ast_sdp_translator_to_sdp(struct ast_sdp_translator *translator, const void *native_sdp);
 
 /*!
  * \brief Translate an internal Asterisk SDP to a native SDP
@@ -97,7 +97,7 @@
  * \retval NULL FAIL
  * \retval non-NULL The translated SDP
  */
-void *ast_sdp_translator_from_sdp(struct ast_sdp_translator *translator,
+const void *ast_sdp_translator_from_sdp(struct ast_sdp_translator *translator,
 	const struct ast_sdp *ast_sdp);
 
 #endif /* _ASTERISK_SDP_TRANSLATOR_H */
diff --git a/main/sdp_state.c b/main/sdp_state.c
index 2c018b1..dddc79c 100644
--- a/main/sdp_state.c
+++ b/main/sdp_state.c
@@ -1084,7 +1084,7 @@
 	return merge_sdps(sdp_state, sdp);
 }
 
-int ast_sdp_state_set_remote_sdp_from_impl(struct ast_sdp_state *sdp_state, void *remote)
+int ast_sdp_state_set_remote_sdp_from_impl(struct ast_sdp_state *sdp_state, const void *remote)
 {
 	struct ast_sdp *sdp;
 	int ret;
diff --git a/main/sdp_translator.c b/main/sdp_translator.c
index 2426b10..6fe330a 100644
--- a/main/sdp_translator.c
+++ b/main/sdp_translator.c
@@ -92,12 +92,12 @@
 }
 
 struct ast_sdp *ast_sdp_translator_to_sdp(struct ast_sdp_translator *translator,
-	void *native_sdp)
+	const void *native_sdp)
 {
 	return translator->ops->to_sdp(native_sdp, translator->translator_priv);
 }
 
-void *ast_sdp_translator_from_sdp(struct ast_sdp_translator *translator,
+const void *ast_sdp_translator_from_sdp(struct ast_sdp_translator *translator,
 	const struct ast_sdp *ast_sdp)
 {
 	return translator->ops->from_sdp(ast_sdp, translator->translator_priv);
diff --git a/res/res_sdp_translator_pjmedia.c b/res/res_sdp_translator_pjmedia.c
index 6ad1e9b..3b9c26c 100644
--- a/res/res_sdp_translator_pjmedia.c
+++ b/res/res_sdp_translator_pjmedia.c
@@ -89,7 +89,7 @@
 	return m_line;
 }
 
-static void pjmedia_copy_a_lines(struct ast_sdp *new_sdp, pjmedia_sdp_session *pjmedia_sdp)
+static void pjmedia_copy_a_lines(struct ast_sdp *new_sdp, const pjmedia_sdp_session *pjmedia_sdp)
 {
 	int i;
 
@@ -100,7 +100,7 @@
 }
 
 static void pjmedia_copy_m_lines(struct ast_sdp *new_sdp,
-	struct pjmedia_sdp_session *pjmedia_sdp)
+	const struct pjmedia_sdp_session *pjmedia_sdp)
 {
 	int i;
 
@@ -109,9 +109,9 @@
 	}
 }
 
-static struct ast_sdp *pjmedia_to_sdp(void *in, void *translator_priv)
+static struct ast_sdp *pjmedia_to_sdp(const void *in, void *translator_priv)
 {
-	struct pjmedia_sdp_session *pjmedia_sdp = in;
+	const struct pjmedia_sdp_session *pjmedia_sdp = in;
 
 	struct ast_sdp_o_line *o_line = ast_sdp_o_alloc(dupa_pj_str(pjmedia_sdp->origin.user),
 		pjmedia_sdp->origin.id, pjmedia_sdp->origin.version,
@@ -239,7 +239,7 @@
 	}
 }
 
-static void *sdp_to_pjmedia(const struct ast_sdp *sdp, void *translator_priv)
+static const void *sdp_to_pjmedia(const struct ast_sdp *sdp, void *translator_priv)
 {
 	pj_pool_t *pool = translator_priv;
 	pjmedia_sdp_session *pjmedia_sdp;
@@ -470,7 +470,7 @@
       "a=rtpmap:32 MPV/90000\r\n\r\n";
 	pj_pool_t *pool;
 	pjmedia_sdp_session *pjmedia_sdp_orig;
-	pjmedia_sdp_session *pjmedia_sdp_dup;
+	const pjmedia_sdp_session *pjmedia_sdp_dup;
 	struct ast_sdp *sdp = NULL;
 	pj_status_t status;
 	enum ast_test_result_state res = AST_TEST_PASS;

-- 
To view, visit https://gerrit.asterisk.org/5554
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I473a174b869728604b37c60853896b0c458bc504
Gerrit-PatchSet: 2
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>



More information about the asterisk-code-review mailing list