[asterisk-commits] tilghman: branch 1.6.0 r244332 - in /branches/1.6.0: ./ funcs/func_math.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Feb 2 12:59:22 CST 2010


Author: tilghman
Date: Tue Feb  2 12:59:20 2010
New Revision: 244332

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=244332
Log:
Merged revisions 244331 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
  r244331 | tilghman | 2010-02-02 12:54:33 -0600 (Tue, 02 Feb 2010) | 9 lines
  
  Correct some off-by-one errors, especially when expressions don't contain expected spaces.
  
  Also include the tests provided by the reporter, as regression tests.
  
  (closes issue #16667)
   Reported by: wdoekes
   Patches: 
         astsvn-func_match-off-by-one.diff uploaded by wdoekes (license 717)
........

Modified:
    branches/1.6.0/   (props changed)
    branches/1.6.0/funcs/func_math.c

Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.0/funcs/func_math.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.0/funcs/func_math.c?view=diff&rev=244332&r1=244331&r2=244332
==============================================================================
--- branches/1.6.0/funcs/func_math.c (original)
+++ branches/1.6.0/funcs/func_math.c Tue Feb  2 12:59:20 2010
@@ -114,47 +114,47 @@
 		*op = '\0';
 	} else if ((op = strstr(mvalue1, "AND"))) {
 		iaction = BITWISEANDFUNCTION;
-		op += 3;
-		*op = '\0';
+		*op = '\0';
+		op += 2;
 	} else if ((op = strstr(mvalue1, "XOR"))) {
 		iaction = BITWISEXORFUNCTION;
-		op += 3;
-		*op = '\0';
+		*op = '\0';
+		op += 2;
 	} else if ((op = strstr(mvalue1, "OR"))) {
 		iaction = BITWISEORFUNCTION;
-		op += 2;
-		*op = '\0';
+		*op = '\0';
+		++op;
 	} else if ((op = strchr(mvalue1, '>'))) {
 		iaction = GTFUNCTION;
 		*op = '\0';
 		if (*(op + 1) == '=') {
-			*++op = '\0';
 			iaction = GTEFUNCTION;
+			++op;
 		} else if (*(op + 1) == '>') {
-			*++op = '\0';
 			iaction = SHRIGHTFUNCTION;
+			++op;
 		}
 	} else if ((op = strchr(mvalue1, '<'))) {
 		iaction = LTFUNCTION;
 		*op = '\0';
 		if (*(op + 1) == '=') {
-			*++op = '\0';
 			iaction = LTEFUNCTION;
+			++op;
 		} else if (*(op + 1) == '<') {
-			*++op = '\0';
 			iaction = SHLEFTFUNCTION;
+			++op;
 		}
 	} else if ((op = strchr(mvalue1, '='))) {
 		*op = '\0';
 		if (*(op + 1) == '=') {
-			*++op = '\0';
 			iaction = EQFUNCTION;
+			++op;
 		} else
 			op = NULL;
 	} else if ((op = strchr(mvalue1, '+'))) {
 		iaction = ADDFUNCTION;
 		*op = '\0';
-	} else if ((op = strchr(mvalue1, '-'))) { /* subtraction MUST always be last, in case we have a negative first number */
+	} else if ((op = strchr(mvalue1, '-'))) { /* subtraction MUST always be last, in case we have a negative second number */
 		iaction = SUBTRACTFUNCTION;
 		*op = '\0';
 	}




More information about the asterisk-commits mailing list