[Freeswitch-svn] [commit] r12834 - freeswitch/trunk/src/include

FreeSWITCH SVN mrene at freeswitch.org
Sun Mar 29 10:12:40 PDT 2009


Author: mrene
Date: Sun Mar 29 12:12:40 2009
New Revision: 12834

Log:
In switch_true/switch_false, check switch_is_number(expr) && atoi(expr) instead of just atoi(expr). Fixes a bug when continue_on_fail contains cause codes only (atoi evals the 1st number so it would always be true)

Modified:
   freeswitch/trunk/src/include/switch_utils.h

Modified: freeswitch/trunk/src/include/switch_utils.h
==============================================================================
--- freeswitch/trunk/src/include/switch_utils.h	(original)
+++ freeswitch/trunk/src/include/switch_utils.h	Sun Mar 29 12:12:40 2009
@@ -121,7 +121,7 @@
 !strcasecmp(expr, "enabled") ||\
 !strcasecmp(expr, "active") ||\
 !strcasecmp(expr, "allow") ||\
-atoi(expr))) ? SWITCH_TRUE : SWITCH_FALSE)
+(switch_is_number(expr) && atoi(expr)))) ? SWITCH_TRUE : SWITCH_FALSE)
 
 #define switch_true_buf(expr)\
 ((( !strcasecmp(expr, "yes") ||\
@@ -130,7 +130,7 @@
 !strcasecmp(expr, "enabled") ||\
 !strcasecmp(expr, "active") ||\
 !strcasecmp(expr, "allow") ||\
-atoi(expr))) ? SWITCH_TRUE : SWITCH_FALSE)
+(switch_is_number(expr) && atoi(expr)))) ? SWITCH_TRUE : SWITCH_FALSE)
 
 /*!
   \brief Evaluate the falsefullness of a string expression
@@ -144,7 +144,7 @@
 !strcasecmp(expr, "disabled") ||\
 !strcasecmp(expr, "inactive") ||\
 !strcasecmp(expr, "disallow") ||\
-!atoi(expr))) ? SWITCH_TRUE : SWITCH_FALSE)
+!(switch_is_number(expr) && atoi(expr)))) ? SWITCH_TRUE : SWITCH_FALSE)
 
 
 /*!



More information about the Freeswitch-svn mailing list