Blob Blame Raw
From: Peter Lemenkov <lemenkov@gmail.com>
Date: Fri, 11 Jan 2013 14:32:19 +0400
Subject: [PATCH] Don't modify interim return value.

Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>

diff --git a/modules/sipmsgops/codecs.c b/modules/sipmsgops/codecs.c
index e502140..159cf6a 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;
 }
 
@@ -679,7 +677,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;
@@ -690,7 +688,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;
@@ -717,7 +715,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;
@@ -737,7 +735,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;
 }
@@ -746,7 +744,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;
 }
@@ -755,7 +753,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;
 }
@@ -781,7 +779,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;
 }
@@ -800,7 +798,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;
 }
@@ -809,7 +807,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;
 }
@@ -835,7 +833,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;
 }
@@ -854,7 +852,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;
 }
@@ -863,7 +861,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;
 }
@@ -889,7 +887,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;
 }