[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Linphone-users] ortp: fix some gcc warnings
From: |
Simon Morlat |
Subject: |
Re: [Linphone-users] ortp: fix some gcc warnings |
Date: |
Mon, 4 Sep 2006 18:03:49 +0200 |
User-agent: |
KMail/1.9.3 |
I'm sorry I can't apply this patch:
File to patch: ./include/ortp/payloadtype.h
patching file ./include/ortp/payloadtype.h
patch: **** malformed patch at line 9: #ifdef __cplusplus
I guess it's because it was inlined in the email, thus sensitive to strange
non-ascii encodings. Can you please re-send it to me as an attachment ?
Thanks a lot
Simon
Le jeudi 31 août 2006 14:48, Andre Noll a écrit :
> On 13:26, Simon Morlat wrote:
> > Of course I'll accept this patch.
> > I would prefer that you use the cvs tree and cvs diff to generate it, so
> > that I'll be sure of having no problems in applying it (was not the case
> > of previous patch, but as it was trivial I fixed it manually).
>
> Okay, so here we go.
> Andre
>
> Index: include/ortp/payloadtype.h
> ===================================================================
> RCS file: /sources/linphone/linphone/oRTP/include/ortp/payloadtype.h,v
> retrieving revision 1.22
> diff -u -r1.22 payloadtype.h
> --- include/ortp/payloadtype.h 31 Aug 2006 09:43:02 -0000 1.22
> +++ include/ortp/payloadtype.h 31 Aug 2006 12:43:40 -0000
> @@ -87,7 +87,7 @@
> #ifdef __cplusplus
> extern "C"{
> #endif
> -PayloadType *payload_type_new();
> +PayloadType *payload_type_new(void);
> PayloadType *payload_type_clone(PayloadType *payload);
> void payload_type_destroy(PayloadType *pt);
> void payload_type_set_recv_fmtp(PayloadType *pt, const char *fmtp);
> @@ -115,16 +115,16 @@
> extern "C"{
> #endif
>
> -void rtp_profile_set_payload(RtpProfile *prof, int index, PayloadType
> *pt); +void rtp_profile_set_payload(RtpProfile *prof, int idx, PayloadType
> *pt);
>
> #define
> rtp_profile_clear_payload(profile,index)
> rtp_profile_set_payload(profile,in
>dex,NULL)
>
> /* I prefer have this function inlined because it is very often called in
> the code */ -static inline PayloadType * rtp_profile_get_payload(RtpProfile
> *prof, int index){ - if (index<0 || index>=RTP_PROFILE_MAX_PAYLOADS) {
> +static inline PayloadType * rtp_profile_get_payload(RtpProfile *prof, int
> idx){ + if (idx<0 || idx>=RTP_PROFILE_MAX_PAYLOADS) {
> return NULL;
> }
> - return prof->payload[index];
> + return prof->payload[idx];
> }
> void rtp_profile_clear_all(RtpProfile *prof);
> void rtp_profile_set_name(RtpProfile *prof, const char *name);
> Index: include/ortp/rtcp.h
> ===================================================================
> RCS file: /sources/linphone/linphone/oRTP/include/ortp/rtcp.h,v
> retrieving revision 1.8
> diff -u -r1.8 rtcp.h
> --- include/ortp/rtcp.h 22 Aug 2006 14:44:28 -0000 1.8
> +++ include/ortp/rtcp.h 31 Aug 2006 12:43:40 -0000
> @@ -218,12 +218,12 @@
> bool_t rtcp_is_SR(const mblk_t *m);
> uint32_t rtcp_SR_get_ssrc(const mblk_t *m);
> const sender_info_t * rtcp_SR_get_sender_info(const mblk_t *m);
> -const report_block_t * rtcp_SR_get_report_block(const mblk_t *m, int
> index); +const report_block_t * rtcp_SR_get_report_block(const mblk_t *m,
> int idx);
>
> /*Receiver report accessors*/
> bool_t rtcp_is_RR(const mblk_t *m);
> uint32_t rtcp_RR_get_ssrc(const mblk_t *m);
> -const report_block_t * rtcp_RR_get_report_block(const mblk_t *m,int
> index); +const report_block_t * rtcp_RR_get_report_block(const mblk_t
> *m,int idx);
>
> /*SDES accessors */
> bool_t rtcp_is_SDES(const mblk_t *m);
> @@ -232,7 +232,7 @@
>
> /*BYE accessors */
> bool_t rtcp_is_BYE(const mblk_t *m);
> -bool_t rtcp_BYE_get_ssrc(const mblk_t *m, int index, uint32_t *ssrc);
> +bool_t rtcp_BYE_get_ssrc(const mblk_t *m, int idx, uint32_t *ssrc);
> bool_t rtcp_BYE_get_reason(const mblk_t *m, const char **reason, int
> *reason_len);
>
> /*APP accessors */
> Index: include/ortp/rtpsession.h
> ===================================================================
> RCS file: /sources/linphone/linphone/oRTP/include/ortp/rtpsession.h,v
> retrieving revision 1.28
> diff -u -r1.28 rtpsession.h
> --- include/ortp/rtpsession.h 22 Aug 2006 14:44:28 -0000 1.28
> +++ include/ortp/rtpsession.h 31 Aug 2006 12:43:40 -0000
> @@ -202,8 +202,8 @@
> void rtp_session_set_blocking_mode(RtpSession *session, int yesno);
> void rtp_session_set_profile(RtpSession *session,RtpProfile *profile);
> RtpProfile *rtp_session_get_profile(RtpSession *session);
> -int rtp_session_signal_connect(RtpSession *session,const char *signal,
> RtpCallback cb, unsigned long user_data); -int
> rtp_session_signal_disconnect_by_callback(RtpSession *session,const char
> *signal, RtpCallback cb); +int rtp_session_signal_connect(RtpSession
> *session,const char *signal_name, RtpCallback cb, unsigned long user_data);
> +int rtp_session_signal_disconnect_by_callback(RtpSession *session,const
> char *signal_name, RtpCallback cb); void rtp_session_set_ssrc(RtpSession
> *session, uint32_t ssrc);
> void rtp_session_set_seq_number(RtpSession *session, uint16_t seq);
> uint16_t rtp_session_get_seq_number(RtpSession *session);
> @@ -254,7 +254,7 @@
> mblk_t * rtp_session_create_packet_in_place(RtpSession *session,uint8_t
> *buffer, int size, void (*freefn)(void*) ); int rtp_session_sendm_with_ts
> (RtpSession * session, mblk_t *mp, uint32_t userts); /* high level recv and
> send functions */
> -int rtp_session_recv_with_ts(RtpSession *session, uint8_t *buffer, int
> len, uint32_t time, int *have_more); +int
> rtp_session_recv_with_ts(RtpSession *session, uint8_t *buffer, int len,
> uint32_t ts, int *have_more); int rtp_session_send_with_ts(RtpSession
> *session, const uint8_t *buffer, int len, uint32_t userts);
>
> /* event API*/
> @@ -285,7 +285,7 @@
>
> /* in use with the scheduler to convert a timestamp in scheduler time unit
> (ms) */ uint32_t rtp_session_ts_to_time(RtpSession *session,uint32_t
> timestamp); -uint32_t rtp_session_time_to_ts(RtpSession *session, int
> time);
> +uint32_t rtp_session_time_to_ts(RtpSession *session, int millisecs);
> /* this function aims at simulating senders with "imprecise" clocks,
> resulting in rtp packets sent with timestamp uncorrelated with the system
> clock . This is only availlable to sessions working with the oRTP scheduler
> */ Index: src/payloadtype.c
> ===================================================================
> RCS file: /sources/linphone/linphone/oRTP/src/payloadtype.c,v
> retrieving revision 1.22
> diff -u -r1.22 payloadtype.c
> --- src/payloadtype.c 11 Jul 2006 21:29:38 -0000 1.22
> +++ src/payloadtype.c 31 Aug 2006 12:43:40 -0000
> @@ -48,7 +48,7 @@
> /**
> *rtp_profile_set_payload:
> address@hidden: an RTP profile (a #RtpProfile object)
> - address@hidden: the payload type number
> + address@hidden: the payload type number
> address@hidden: the payload type description (a #PayloadType
> object )
> *
> * Assign payload type number @index to payload type desribed in @pt for
> the RTP profile @@ -251,12 +251,12 @@
> return prof;
> }
>
> -void rtp_profile_set_payload(RtpProfile *prof, int index, PayloadType
> *pt){ - if (index<0 || index>=RTP_PROFILE_MAX_PAYLOADS) {
> - ortp_error("Bad index %i",index);
> +void rtp_profile_set_payload(RtpProfile *prof, int idx, PayloadType *pt){
> + if (idx<0 || idx>=RTP_PROFILE_MAX_PAYLOADS) {
> + ortp_error("Bad index %i",idx);
> return;
> }
> - prof->payload[index]=pt;
> + prof->payload[idx]=pt;
> }
>
> void rtp_profile_clear_all(RtpProfile *obj){
> Index: src/rtcpparse.c
> ===================================================================
> RCS file: /sources/linphone/linphone/oRTP/src/rtcpparse.c,v
> retrieving revision 1.11
> diff -u -r1.11 rtcpparse.c
> --- src/rtcpparse.c 22 Aug 2006 14:44:28 -0000 1.11
> +++ src/rtcpparse.c 31 Aug 2006 12:43:41 -0000
> @@ -80,15 +80,15 @@
> return &sr->si;
> }
>
> -const report_block_t * rtcp_SR_get_report_block(const mblk_t *m, int
> index){ +const report_block_t * rtcp_SR_get_report_block(const mblk_t *m,
> int idx){ rtcp_sr_t *sr=(rtcp_sr_t*)m->b_rptr;
> - report_block_t *rb=&sr->rb[index];
> + report_block_t *rb=&sr->rb[idx];
> int
> size=sizeof(rtcp_common_header_t)+(4*rtcp_common_header_get_length(&sr->ch)
>); if ( ( (uint8_t*)rb)+sizeof(report_block_t) <= m->b_rptr + size ) {
> return rb;
> }else{
> - if (index<rtcp_common_header_get_rc(&sr->ch)){
> - ortp_warning("RTCP packet should include a
> report_block_t at pos %i but
> has no space for it.",index); + if
> (idx<rtcp_common_header_get_rc(&sr->ch)){
> + ortp_warning("RTCP packet should include a
> report_block_t at pos %i but
> has no space for it.",idx); }
> }
> return NULL;
> @@ -112,15 +112,15 @@
> return ntohl(rr->ssrc);
> }
>
> -const report_block_t * rtcp_RR_get_report_block(const mblk_t *m,int
> index){ +const report_block_t * rtcp_RR_get_report_block(const mblk_t
> *m,int idx){ rtcp_rr_t *rr=(rtcp_rr_t*)m->b_rptr;
> - report_block_t *rb=&rr->rb[index];
> + report_block_t *rb=&rr->rb[idx];
> int
> size=sizeof(rtcp_common_header_t)+(4*rtcp_common_header_get_length(&rr->ch)
>); if ( ( (uint8_t*)rb)+sizeof(report_block_t) <= (m->b_rptr + size ) ){
> return rb;
> }else{
> - if (index<rtcp_common_header_get_rc(&rr->ch)){
> - ortp_warning("RTCP packet should include a
> report_block_t at pos %i but
> has no space for it.",index); + if
> (idx<rtcp_common_header_get_rc(&rr->ch)){
> + ortp_warning("RTCP packet should include a
> report_block_t at pos %i but
> has no space for it.",idx); }
> }
> return NULL;
> @@ -205,14 +205,14 @@
> return FALSE;
> }
>
> -bool_t rtcp_BYE_get_ssrc(const mblk_t *m, int index, uint32_t *ssrc){
> +bool_t rtcp_BYE_get_ssrc(const mblk_t *m, int idx, uint32_t *ssrc){
> rtcp_bye_t *bye=(rtcp_bye_t*)m->b_rptr;
> int rc=rtcp_common_header_get_rc(&bye->ch);
> int len=rtcp_common_header_get_length(&bye->ch);
> - if (index<rc){
> - if ((uint8_t*)&bye->ssrc[index]<=(m->b_rptr
> + if (idx<rc){
> + if ((uint8_t*)&bye->ssrc[idx]<=(m->b_rptr
> +sizeof(rtcp_common_header_t)+len-4)) {
> - *ssrc=ntohl(bye->ssrc[index]);
> + *ssrc=ntohl(bye->ssrc[idx]);
> return TRUE;
> }else{
> ortp_warning("RTCP BYE should contain %i ssrc, but
> there is not enough
> room for it."); Index: src/rtpsession.c
> ===================================================================
> RCS file: /sources/linphone/linphone/oRTP/src/rtpsession.c,v
> retrieving revision 1.141
> diff -u -r1.141 rtpsession.c
> --- src/rtpsession.c 22 Aug 2006 14:44:28 -0000 1.141
> +++ src/rtpsession.c 31 Aug 2006 12:43:41 -0000
> @@ -393,7 +393,7 @@
> /**
> *rtp_session_signal_connect:
> address@hidden: a rtp session
> - address@hidden: the name of a signal
> + address@hidden: the name of a signal
> address@hidden: a #RtpCallback
> address@hidden: a pointer to any data to be passed when invoking the
> callback. *
> @@ -424,17 +424,17 @@
> * can be assigned to the signal type.
> **/
> int
> -rtp_session_signal_connect (RtpSession * session, const char *signal,
> +rtp_session_signal_connect (RtpSession * session, const char *signal_name,
> RtpCallback cb, unsigned long user_data)
> {
> OList *elem;
> for (elem=session->signal_tables;elem!=NULL;elem=o_list_next(elem)){
> RtpSignalTable *s=(RtpSignalTable*) elem->data;
> - if (strcmp(signal,s->signal_name)==0){
> + if (strcmp(signal_name,s->signal_name)==0){
> return rtp_signal_table_add(s,cb,user_data);
> }
> }
> - ortp_warning ("rtp_session_signal_connect: inexistant signal
> %s",signal);
> + ortp_warning ("rtp_session_signal_connect: inexistant signal
> %s",signal_name); return -1;
> }
>
> @@ -442,7 +442,7 @@
> /**
> *rtp_session_signal_disconnect_by_callback:
> address@hidden: a rtp session
> - address@hidden: a signal name
> + address@hidden: a signal name
> address@hidden: a callback function.
> *
> * Removes callback function @cb to the list of callbacks for signal
> @signal. @@ -451,17 +451,17 @@
> **/
>
> int
> -rtp_session_signal_disconnect_by_callback (RtpSession * session, const
> char *signal, +rtp_session_signal_disconnect_by_callback (RtpSession *
> session, const char *signal_name, RtpCallback cb)
> {
> OList *elem;
> for (elem=session->signal_tables;elem!=NULL;elem=o_list_next(elem)){
> RtpSignalTable *s=(RtpSignalTable*) elem->data;
> - if (strcmp(signal,s->signal_name)==0){
> + if (strcmp(signal_name,s->signal_name)==0){
> return rtp_signal_table_remove_by_callback(s,cb);
> }
> }
> - ortp_warning ("rtp_session_signal_connect: inexistant signal
> %s",signal);
> + ortp_warning ("rtp_session_signal_connect: inexistant signal
> %s",signal_name); return -1;
> }
>
> @@ -1044,12 +1044,12 @@
> address@hidden: a rtp session.
> address@hidden: a user supplied buffer to write the data.
> address@hidden: the length in bytes of the user supplied buffer.
> - address@hidden: the timestamp wanted.
> + address@hidden: the timestamp wanted.
> address@hidden: the address of an integer to indicate if more data is
> availlable for the given timestamp. *
> - * Tries to read the bytes of the incoming rtp stream related to timestamp
> @time. In case + * Tries to read the bytes of the incoming rtp stream
> related to timestamp @ts. In case * where the user supplied buffer @buffer
> is not large enough to get all the data - * related to timestamp @time,
> then *( @have_more) is set to 1 to indicate that the application +
> * related to timestamp @ts, then *( @have_more) is set to 1 to indicate
> that the application * should recall the function with the same
> timestamp
> to get more data. *
> * When the rtp session is scheduled (see
> rtp_session_set_scheduling_mode() ), and the @@ -1058,7 +1058,7 @@
> * fits the query or not.
> *
> * Important note: it is clear that the application cannot know the
> timestamp of the first - * packet of the incoming stream, because it can be
> random. The @time timestamp given to the + * packet of the incoming stream,
> because it can be random. The @ts timestamp given to the * function is used
> relatively to first timestamp of the stream. In simple words, 0 is a good
> * value to start calling this function.
> *
> @@ -1076,7 +1076,7 @@
> * network transport, then the function returns zero.
> **/
> int rtp_session_recv_with_ts (RtpSession * session, uint8_t * buffer,
> - int len, uint32_t time, int * have_more)
> + int len, uint32_t ts, int * have_more)
> {
> mblk_t *mp;
> int rlen = len;
> @@ -1087,7 +1087,7 @@
>
> *have_more = 0;
>
> - mp = rtp_session_recvm_with_ts (session, time);
> + mp = rtp_session_recvm_with_ts (session, ts);
> payload =rtp_profile_get_payload (session->profile,
> session->recv_pt);
> if (payload==NULL){
> @@ -1097,9 +1097,9 @@
> }
> if (!(session->flags & RTP_SESSION_RECV_SYNC))
> {
> - //ortp_debug("time=%i
> rcv_last_ret_ts=%i",time,session->rtp.rcv_last_ret_ts);
> + //ortp_debug("ts=%i
> rcv_last_ret_ts=%i",ts,session->rtp.rcv_last_ret_ts); if
> (RTP_TIMESTAMP_IS_STRICTLY_NEWER_THAN
> - (time, session->rtp.rcv_last_ret_ts))
> + (ts, session->rtp.rcv_last_ret_ts))
> {
> /* the user has missed some data previously, so we are
> going to give
> him now. */ /* we must tell him to call the function once again with the
> same timestamp @@ -1139,9 +1139,8 @@
> //ortp_debug("User buffer not filled entirely");
> if (ts_int > 0)
> {
> - time = session->rtp.rcv_last_ret_ts;
> - ortp_debug("Need more: will ask for
> %i.",
> - time);
> + ts = session->rtp.rcv_last_ret_ts;
> + ortp_debug("Need more: will ask for
> %i.", ts);
> }
> else
> return len - rlen;
> @@ -1186,7 +1185,7 @@
> *have_more = 0;
> return 0;
> }
> - mp = rtp_session_recvm_with_ts (session, time);
> + mp = rtp_session_recvm_with_ts (session, ts);
> payload = rtp_profile_get_payload (session->profile,
> session->recv_pt);
> if (payload==NULL){
> @@ -1504,7 +1503,7 @@
>
>
>
> -uint32_t rtp_session_time_to_ts(RtpSession *session, int time){
> +uint32_t rtp_session_time_to_ts(RtpSession *session, int millisecs){
> PayloadType *payload;
> payload =
> rtp_profile_get_payload (session->profile,
> @@ -1516,7 +1515,7 @@
> return 0;
> }
> /* the return value is in milisecond */
> - return (uint32_t) (payload->clock_rate*(double) (time/1000.0f));
> + return (uint32_t) (payload->clock_rate*(double) (millisecs/1000.0f));
> }
>
> /* function used by the scheduler only:*/
- Re: [Linphone-users] ortp: fix some gcc warnings,
Simon Morlat <=