[sr-dev] git:master: core: sdp parser fixes
Ovidiu Sas
osas at voipembedded.com
Fri Jun 25 18:10:31 CEST 2010
Module: sip-router
Branch: master
Commit: 92761dbd0a2be28577829b919c250ae9d2680352
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=92761dbd0a2be28577829b919c250ae9d2680352
Author: Ovidiu Sas <osas at voipembedded.com>
Committer: Ovidiu Sas <osas at voipembedded.com>
Date: Fri Jun 25 12:14:14 2010 -0400
core: sdp parser fixes
- fix sdp session and stream getters
---
parser/sdp/sdp.c | 18 +++++++-----------
1 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/parser/sdp/sdp.c b/parser/sdp/sdp.c
index 3f0f6dc..fa1394d 100644
--- a/parser/sdp/sdp.c
+++ b/parser/sdp/sdp.c
@@ -266,14 +266,10 @@ sdp_session_cell_t* get_sdp_session_sdp(struct sdp_info* sdp, int session_num)
sdp_session_cell_t *session;
session = sdp->sessions;
- if (session_num > sdp->sessions_num)
- return NULL;
+ if (session_num >= sdp->sessions_num) return NULL;
while (session) {
- if (session->session_num == session_num) {
- return session;
- } else {
- session = session->next;
- }
+ if (session->session_num == session_num) return session;
+ session = session->next;
}
return NULL;
}
@@ -291,18 +287,18 @@ sdp_stream_cell_t* get_sdp_stream_sdp(struct sdp_info* sdp, int session_num, int
sdp_session_cell_t *session;
sdp_stream_cell_t *stream;
- if (sdp==NULL)
- return NULL;
- if (session_num > sdp->sessions_num)
- return NULL;
+ if (sdp==NULL) return NULL;
+ if (session_num >= sdp->sessions_num) return NULL;
session = sdp->sessions;
while (session) {
if (session->session_num == session_num) {
+ if (stream_num >= session->streams_num) return NULL;
stream = session->streams;
while (stream) {
if (stream->stream_num == stream_num) return stream;
stream = stream->next;
}
+ break;
} else {
session = session->next;
}
More information about the sr-dev
mailing list