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