Module: sip-router Branch: admorten/sca Commit: 073bbd45093e100e3578462658fc134f8d28aff3 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=073bbd45...
Author: Andrew Mortensen admorten@isc.upenn.edu Committer: Andrew Mortensen admorten@isc.upenn.edu Date: Sat Mar 16 16:35:29 2013 -0400
modules/sca: fix -Waddress warnings caused by static strs in SCA_STR_EMPTY
- Tested on Ubunut 12.04 LTS. Report from Konstantin Mosesov.
---
modules/sca/sca_call_info.c | 40 +++++++++++++++++++--------------------- modules/sca/sca_common.h | 3 +-- modules/sca/sca_rpc.c | 4 +--- modules/sca/sca_subscribe.c | 2 +- 4 files changed, 22 insertions(+), 27 deletions(-)
diff --git a/modules/sca/sca_call_info.c b/modules/sca/sca_call_info.c index 7444bf9..8f681fd 100644 --- a/modules/sca/sca_call_info.c +++ b/modules/sca/sca_call_info.c @@ -700,29 +700,27 @@ sca_call_info_seize_held_call( sip_msg_t *msg, sca_call_info *call_info, sca_hash_table_unlock_index( sca->appearances, slot_idx ); slot_idx = -1;
- if ( !SCA_STR_EMPTY( &callee_aor )) { - if ( sca_uri_lock_if_shared_appearance( sca, &callee_aor, &slot_idx )) { - app = sca_appearance_for_tags_unsafe( sca, &callee_aor, - &prev_callid, &prev_totag, NULL, slot_idx ); - if ( app == NULL ) { - LM_ERR( "sca_call_info_seize_held_call: failed to find " - "appearance of %.*s with dialog %.*s;%.*s", - STR_FMT( &callee_aor ), STR_FMT( &prev_callid ), - STR_FMT( &prev_totag )); - goto done; - } + if ( sca_uri_lock_if_shared_appearance( sca, &callee_aor, &slot_idx )) { + app = sca_appearance_for_tags_unsafe( sca, &callee_aor, + &prev_callid, &prev_totag, NULL, slot_idx ); + if ( app == NULL ) { + LM_ERR( "sca_call_info_seize_held_call: failed to find " + "appearance of %.*s with dialog %.*s;%.*s", + STR_FMT( &callee_aor ), STR_FMT( &prev_callid ), + STR_FMT( &prev_totag )); + goto done; + }
- app->flags |= SCA_APPEARANCE_FLAG_CALLEE_PENDING; + app->flags |= SCA_APPEARANCE_FLAG_CALLEE_PENDING;
- if ( sca_appearance_update_callee_unsafe( app, contact_uri ) < 0 ) { - LM_ERR( "sca_call_info_seize_held_call: failed to update callee" ); - goto done; - } - if ( sca_appearance_update_dialog_unsafe( app, &msg->callid->body, - &to->tag_value, &from->tag_value ) < 0 ) { - LM_ERR( "sca_call_info_seize_held_call: failed to update dialog" ); - goto done; - } + if ( sca_appearance_update_callee_unsafe( app, contact_uri ) < 0 ) { + LM_ERR( "sca_call_info_seize_held_call: failed to update callee" ); + goto done; + } + if ( sca_appearance_update_dialog_unsafe( app, &msg->callid->body, + &to->tag_value, &from->tag_value ) < 0 ) { + LM_ERR( "sca_call_info_seize_held_call: failed to update dialog" ); + goto done; } }
diff --git a/modules/sca/sca_common.h b/modules/sca/sca_common.h index c4c806f..daef534 100644 --- a/modules/sca/sca_common.h +++ b/modules/sca/sca_common.h @@ -93,8 +93,7 @@ memcmp((str1)->s, (str2)->s, (str1)->len) == 0)
#define SCA_STR_EMPTY( str1 ) \ - (((str1) != NULL && ((str1)->s == NULL || (str1)->len <= 0 )) \ - || (str1) == NULL ) + ((str1) == NULL || ((str1)->s == NULL || (str1)->len <= 0 ))
#define SCA_HEADER_EMPTY( hdr1 ) \ ((hdr1) == NULL || SCA_STR_EMPTY( &(hdr1)->body )) diff --git a/modules/sca/sca_rpc.c b/modules/sca/sca_rpc.c index 0fc0f40..f0ee345 100644 --- a/modules/sca/sca_rpc.c +++ b/modules/sca/sca_rpc.c @@ -366,9 +366,7 @@ sca_rpc_update_appearance( rpc_t *rpc, void *ctx ) return; } if ( rpc->scan( ctx, "*S", &app_uri ) == 1 ) { - if ( !SCA_STR_EMPTY( &app_uri )) { - app_uri_p = &app_uri; - } + app_uri_p = &app_uri; }
app_state = sca_appearance_state_from_str( &app_state_str ); diff --git a/modules/sca/sca_subscribe.c b/modules/sca/sca_subscribe.c index 66e63c8..2e73b8a 100644 --- a/modules/sca/sca_subscribe.c +++ b/modules/sca/sca_subscribe.c @@ -1017,7 +1017,7 @@ sca_subscription_from_request( sca_mod *scam, sip_msg_t *msg, int event_type, }
to_tag = to->tag_value; - if ( SCA_STR_EMPTY( &to_tag )) { + if ( to_tag.s == NULL ) { /* * XXX need hook to detect when we have a subscription and the * subscriber sends an out-of-dialog SUBSCRIBE, which indicates the