From: Peter Lemenkov Date: Fri, 11 Jan 2013 14:32:19 +0400 Subject: [PATCH] Don't modify interim return value. Signed-off-by: Peter Lemenkov diff --git a/modules/sipmsgops/codecs.c b/modules/sipmsgops/codecs.c index ac6b14f..274bff7 100644 --- a/modules/sipmsgops/codecs.c +++ b/modules/sipmsgops/codecs.c @@ -349,8 +349,6 @@ static int do_for_all_streams(struct sip_msg* msg, str* str1,str * str2, } - if( rez <0 ) - rez = 0; return rez; } @@ -688,7 +686,7 @@ int codec_find (struct sip_msg* msg, char* str1 ) LM_DBG("searching for codec <%.*s> \n",res.len,res.s); if( do_for_all_streams( msg, &res, NULL, NULL, - FIND, DESC_NAME) == 0) + FIND, DESC_NAME) <= 0) return -1; return 1; @@ -699,7 +697,7 @@ int codec_find_re (struct sip_msg* msg, char* str1 ) { if( do_for_all_streams(msg, NULL, NULL, (regex_t*)str1, - FIND, DESC_REGEXP) == 0) + FIND, DESC_REGEXP) <= 0) return -1; return 1; @@ -726,7 +724,7 @@ int codec_find_clock (struct sip_msg* msg, char* str1,char * str2 ) codec.len,codec.s,clock.len,clock.s); if( do_for_all_streams( msg, &codec, &clock, NULL, - FIND, DESC_NAME_AND_CLOCK) == 0) + FIND, DESC_NAME_AND_CLOCK) <= 0) return -1; return 1; @@ -746,7 +744,7 @@ int codec_delete (struct sip_msg* msg, char* str1 ) LM_DBG("deleting codec <%.*s> \n",res.len,res.s); if( do_for_all_streams( msg, &res, NULL, NULL, - DELETE, DESC_NAME) == 0) + DELETE, DESC_NAME) <= 0) return -1; return 1; } @@ -755,7 +753,7 @@ int codec_delete (struct sip_msg* msg, char* str1 ) int codec_delete_re (struct sip_msg* msg, char* str1 ) { if( do_for_all_streams( msg, NULL, NULL, (regex_t*) str1, - DELETE, DESC_REGEXP) == 0) + DELETE, DESC_REGEXP) <= 0) return -1; return 1; } @@ -764,7 +762,7 @@ int codec_delete_re (struct sip_msg* msg, char* str1 ) int codec_delete_except_re (struct sip_msg* msg, char* str1 ) { if( do_for_all_streams( msg, NULL, NULL, (regex_t*) str1, - DELETE, DESC_REGEXP_COMPLEMENT) == 0) + DELETE, DESC_REGEXP_COMPLEMENT) <= 0) return -1; return 1; } @@ -790,7 +788,7 @@ int codec_delete_clock (struct sip_msg* msg, char* str1 ,char * str2) codec.len,codec.s,clock.len,clock.s); if( do_for_all_streams( msg, &codec, &clock, NULL, - DELETE, DESC_NAME_AND_CLOCK) == 0) + DELETE, DESC_NAME_AND_CLOCK) <= 0) return -1; return 1; } @@ -809,7 +807,7 @@ int codec_move_up (struct sip_msg* msg, char* str1) LM_DBG("moving up codec <%.*s> \n",res.len,res.s); if( do_for_all_streams( msg, &res, NULL, NULL, - ADD_TO_FRONT, DESC_NAME) == 0) + ADD_TO_FRONT, DESC_NAME) <= 0) return -1; return 1; } @@ -818,7 +816,7 @@ int codec_move_up (struct sip_msg* msg, char* str1) int codec_move_up_re (struct sip_msg* msg, char* str1) { if( do_for_all_streams( msg, NULL, NULL, (regex_t*)str1, - ADD_TO_FRONT, DESC_REGEXP) == 0) + ADD_TO_FRONT, DESC_REGEXP) <= 0) return -1; return 1; } @@ -844,7 +842,7 @@ int codec_move_up_clock (struct sip_msg* msg, char* str1 ,char * str2) codec.len,codec.s,clock.len,clock.s); if( do_for_all_streams( msg, &codec, &clock, NULL, - ADD_TO_FRONT, DESC_NAME_AND_CLOCK) == 0) + ADD_TO_FRONT, DESC_NAME_AND_CLOCK) <= 0) return -1; return 1; } @@ -863,7 +861,7 @@ int codec_move_down (struct sip_msg* msg, char* str1) LM_DBG("moving down codec <%.*s> \n",res.len,res.s); if( do_for_all_streams( msg, &res, NULL, NULL, - ADD_TO_BACK, DESC_NAME) == 0) + ADD_TO_BACK, DESC_NAME) <= 0) return -1; return 1; } @@ -872,7 +870,7 @@ int codec_move_down (struct sip_msg* msg, char* str1) int codec_move_down_re (struct sip_msg* msg, char* str1) { if( do_for_all_streams( msg, NULL, NULL, (regex_t*)str1, - ADD_TO_BACK, DESC_REGEXP) == 0) + ADD_TO_BACK, DESC_REGEXP) <= 0) return -1; return 1; } @@ -898,7 +896,7 @@ int codec_move_down_clock (struct sip_msg* msg, char* str1 ,char * str2) codec.len,codec.s,clock.len,clock.s); if( do_for_all_streams( msg, &codec, &clock, NULL, - ADD_TO_BACK, DESC_NAME_AND_CLOCK) == 0) + ADD_TO_BACK, DESC_NAME_AND_CLOCK) <= 0) return -1; return 1; }