[asterisk-commits] kpfleming: branch 1.2 r38370 - /branches/1.2/apps/app_chanspy.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Jul 27 15:23:38 MST 2006


Author: kpfleming
Date: Thu Jul 27 17:23:38 2006
New Revision: 38370

URL: http://svn.digium.com/view/asterisk?rev=38370&view=rev
Log:
use the enum that defines the option arguments, so that the likelihood of mismatched option indexes is reduced (which in this case was a bug, the volume argument was not checked properly)

Modified:
    branches/1.2/apps/app_chanspy.c

Modified: branches/1.2/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/apps/app_chanspy.c?rev=38370&r1=38369&r2=38370&view=diff
==============================================================================
--- branches/1.2/apps/app_chanspy.c (original)
+++ branches/1.2/apps/app_chanspy.c Thu Jul 27 17:23:38 2006
@@ -419,19 +419,19 @@
 		char *opts[OPT_ARG_ARRAY_SIZE];
 		ast_app_parse_options(chanspy_opts, &flags, opts, options);
 		if (ast_test_flag(&flags, OPTION_GROUP)) {
-			mygroup = opts[1];
+			mygroup = opts[OPT_ARG_GROUP];
 		}
 		if (ast_test_flag(&flags, OPTION_RECORD)) {
-			if (!(recbase = opts[2])) {
+			if (!(recbase = opts[OPT_ARG_RECORD])) {
 				recbase = "chanspy";
 			}
 		}
 		silent = ast_test_flag(&flags, OPTION_QUIET);
 		bronly = ast_test_flag(&flags, OPTION_BRIDGED);
-		if (ast_test_flag(&flags, OPTION_VOLUME) && opts[1]) {
+		if (ast_test_flag(&flags, OPTION_VOLUME) && opts[OPT_ARG_VOLUME]) {
 			int vol;
 
-			if ((sscanf(opts[0], "%d", &vol) != 1) || (vol > 4) || (vol < -4))
+			if ((sscanf(opts[OPT_ARG_VOLUME], "%d", &vol) != 1) || (vol > 4) || (vol < -4))
 				ast_log(LOG_NOTICE, "Volume factor must be a number between -4 and 4\n");
 			else
 				volfactor = vol;



More information about the asterisk-commits mailing list