[Asterisk-cvs] asterisk/apps app_directory.c,1.20,1.21 app_enumlookup.c,1.7,1.8 app_festival.c,1.19,1.20 app_groupcount.c,1.2,1.3 app_playback.c,1.11,1.12 app_queue.c,1.58,1.59 app_read.c,1.4,1.5 app_senddtmf.c,1.4,1.5 app_setcdruserfield.c,1.3,1.4 app_setcidname.c,1.1,1.2 app_setcidnum.c,1.1,1.2

citats at lists.digium.com citats at lists.digium.com
Sun May 9 03:42:10 CDT 2004


Update of /usr/cvsroot/asterisk/apps
In directory mongoose.digium.com:/tmp/cvs-serv28353/apps

Modified Files:
	app_directory.c app_enumlookup.c app_festival.c 
	app_groupcount.c app_playback.c app_queue.c app_read.c 
	app_senddtmf.c app_setcdruserfield.c app_setcidname.c 
	app_setcidnum.c 
Log Message:
More ast_strlen_zero changes


Index: app_directory.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_directory.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- app_directory.c	3 May 2004 04:36:46 -0000	1.20
+++ app_directory.c	9 May 2004 07:51:44 -0000	1.21
@@ -19,6 +19,7 @@
 #include <asterisk/module.h>
 #include <asterisk/config.h>
 #include <asterisk/say.h>
+#include <asterisk/utils.h>
 #include <string.h>
 #include <ctype.h>
 #include <stdlib.h>
@@ -132,7 +133,7 @@
 	char *start, *pos, *conv,*stringp=NULL;
 	char fn[256];
 	char fn2[256];
-	if (!context || !strlen(context)) {
+	if (!context || ast_strlen_zero(context)) {
 		ast_log(LOG_WARNING, "Directory must be called with an argument (context in which to interpret extensions)\n");
 		return -1;
 	}
@@ -190,7 +191,7 @@
 						res = ast_waitstream(chan, AST_DIGIT_ANY);
 					ast_stopstream(chan);
 				} else {
-					res = ast_say_character_str(chan, strlen(name) ? name : v->name, AST_DIGIT_ANY, chan->language);
+					res = ast_say_character_str(chan, !ast_strlen_zero(name) ? name : v->name, AST_DIGIT_ANY, chan->language);
 				}
 ahem:
 				if (!res)
@@ -260,9 +261,9 @@
 	} else
 		dialcontext = context;
 	dirintro = ast_variable_retrieve(cfg, context, "directoryintro");
-	if (!dirintro || !strlen(dirintro))
+	if (!dirintro || ast_strlen_zero(dirintro))
 		dirintro = ast_variable_retrieve(cfg, "general", "directoryintro");
-	if (!dirintro || !strlen(dirintro))
+	if (!dirintro || ast_strlen_zero(dirintro))
 		dirintro = "dir-intro";
 	if (chan->_state != AST_STATE_UP) 
 		res = ast_answer(chan);

Index: app_enumlookup.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_enumlookup.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- app_enumlookup.c	6 Oct 2003 00:36:17 -0000	1.7
+++ app_enumlookup.c	9 May 2004 07:51:44 -0000	1.8
@@ -20,6 +20,7 @@
 #include <asterisk/config.h>
 #include <asterisk/module.h>
 #include <asterisk/enum.h>
+#include <asterisk/utils.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <string.h>
@@ -64,7 +65,7 @@
 	char tmp[256];
 	char *c,*t;
 	struct localuser *u;
-	if (!data || !strlen(data)) {
+	if (!data || ast_strlen_zero(data)) {
 		ast_log(LOG_WARNING, "EnumLookup requires an argument (extension)\n");
 		res = 1;
 	}
@@ -128,7 +129,7 @@
 				else
 					res = 0;
 			}
-		} else if (strlen(tech)) {
+		} else if (!ast_strlen_zero(tech)) {
 			ast_log(LOG_NOTICE, "Don't know how to handle technology '%s'\n", tech);
 			res = 0;
 		}

Index: app_festival.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_festival.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- app_festival.c	22 Apr 2004 00:20:33 -0000	1.19
+++ app_festival.c	9 May 2004 07:51:44 -0000	1.20
@@ -19,6 +19,7 @@
 #include <asterisk/module.h>
 #include <asterisk/md5.h>
 #include <asterisk/config.h>
+#include <asterisk/utils.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <string.h>
@@ -304,10 +305,7 @@
 	if (!(festivalcommand = ast_variable_retrieve(cfg, "general", "festivalcommand"))) {
 		festivalcommand = "(tts_textasterisk \"%s\" 'file)(quit)\n";
 	}
-	
-		
-
-	if (!vdata || !strlen(vdata)) {
+	if (!vdata || ast_strlen_zero(vdata)) {
 		ast_log(LOG_WARNING, "festival requires an argument (text)\n");
 		return -1;
 	}

Index: app_groupcount.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_groupcount.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- app_groupcount.c	9 May 2004 06:23:30 -0000	1.2
+++ app_groupcount.c	9 May 2004 07:51:44 -0000	1.3
@@ -21,6 +21,7 @@
 #include <asterisk/channel.h>
 #include <asterisk/pbx.h>
 #include <asterisk/module.h>
+#include <asterisk/utils.h>
 
 static char *tdesc = "Group Management Routines";
 
@@ -64,7 +65,7 @@
 	struct ast_channel *chan;
 	int count = 0;
 	char *test;
-	if (group && strlen(group)) {
+	if (group && !ast_strlen_zero(group)) {
 		chan = ast_channel_walk(NULL);
 		while(chan) {
 			test = pbx_builtin_getvar_helper(chan, "GROUP");
@@ -87,7 +88,7 @@
 	LOCAL_USER_ADD(u);
 
 	/* Check and parse arguments */
-	if (data && strlen(data)) {
+	if (data && !ast_strlen_zero(data)) {
 		group = (char *)data;
 	} else {
 		group = pbx_builtin_getvar_helper(chan, "GROUP");
@@ -106,7 +107,7 @@
 
 	LOCAL_USER_ADD(u);
 	/* Check and parse arguments */
-	if (data && strlen(data)) {
+	if (data && !ast_strlen_zero(data)) {
 		pbx_builtin_setvar_helper(chan, "GROUP", (char *)data);
 	} else
 		ast_log(LOG_WARNING, "GroupSet requires an argument (group name)\n");

Index: app_playback.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_playback.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- app_playback.c	11 Nov 2002 16:37:01 -0000	1.11
+++ app_playback.c	9 May 2004 07:51:44 -0000	1.12
@@ -18,6 +18,7 @@
 #include <asterisk/pbx.h>
 #include <asterisk/module.h>
 #include <asterisk/translate.h>
+#include <asterisk/utils.h>
 #include <string.h>
 #include <stdlib.h>
 #include <pthread.h>
@@ -52,7 +53,7 @@
 	int option_skip=0;
 	int option_noanswer = 0;
 	char *stringp;
-	if (!data || !strlen((char *)data)) {
+	if (!data || ast_strlen_zero((char *)data)) {
 		ast_log(LOG_WARNING, "Playback requires an argument (filename)\n");
 		return -1;
 	}

Index: app_queue.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_queue.c,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -d -r1.58 -r1.59
--- app_queue.c	29 Apr 2004 02:30:14 -0000	1.58
+++ app_queue.c	9 May 2004 07:51:44 -0000	1.59
@@ -39,9 +39,10 @@
 #include <asterisk/parking.h>
 #include <asterisk/musiconhold.h>
 #include <asterisk/cli.h>
-#include <asterisk/manager.h> /* JDG */
+#include <asterisk/manager.h>
 #include <asterisk/config.h>
 #include <asterisk/monitor.h>
+#include <asterisk/utils.h>
 #include <stdlib.h>
 #include <errno.h>
 #include <unistd.h>
@@ -576,7 +577,7 @@
 static int valid_exit(struct queue_ent *qe, char digit)
 {
 	char tmp[2];
-	if (!strlen(qe->context))
+	if (ast_strlen_zero(qe->context))
 		return 0;
 	tmp[0] = digit;
 	tmp[1] = '\0';
@@ -880,9 +881,9 @@
 	strncpy(queuename, qe->parent->name, sizeof(queuename) - 1);
 	time(&now);
 	cur = qe->parent->members;
-	if (strlen(qe->announce))
+	if (!ast_strlen_zero(qe->announce))
 		announce = qe->announce;
-	if (announceoverride && strlen(announceoverride))
+	if (announceoverride && !ast_strlen_zero(announceoverride))
 		announce = announceoverride;
 	while(cur) {
 		/* Get a technology/[device:]number pair */
@@ -1022,11 +1023,10 @@
 		}
 		/* Drop out of the queue at this point, to prepare for next caller */
 		leave_queue(qe);			
- 		/* JDG: sendurl */
- 		if( url && strlen(url) && ast_channel_supports_html(peer) ) {
+ 		if( url && !ast_strlen_zero(url) && ast_channel_supports_html(peer) ) {
  			ast_log(LOG_DEBUG, "app_queue: sendurl=%s.\n", url);
  			ast_channel_sendurl( peer, url );
- 		} /* /JDG */
+ 		}
 		ast_queue_log(queuename, qe->chan->uniqueid, peer->name, "CONNECT", "%ld", (long)time(NULL) - qe->start);
 		strncpy(oldcontext, qe->chan->context, sizeof(oldcontext) - 1);
 		strncpy(oldexten, qe->chan->exten, sizeof(oldexten) - 1);

Index: app_read.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_read.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- app_read.c	22 Mar 2004 03:46:19 -0000	1.4
+++ app_read.c	9 May 2004 07:51:44 -0000	1.5
@@ -20,6 +20,7 @@
 #include <asterisk/module.h>
 #include <asterisk/translate.h>
 #include <asterisk/options.h>
+#include <asterisk/utils.h>
 #include <string.h>
 #include <stdlib.h>
 #include <pthread.h>
@@ -53,7 +54,7 @@
 	char *stringp;
 	char *maxdigitstr;
 	int maxdigits=255;
-	if (!data || !strlen((char *)data)) {
+	if (!data || ast_strlen_zero((char *)data)) {
 		ast_log(LOG_WARNING, "Read requires an argument (variable)\n");
 		return -1;
 	}
@@ -63,17 +64,16 @@
 	varname = strsep(&stringp, "|");
 	filename = strsep(&stringp, "|");
 	maxdigitstr = strsep(&stringp,"|");
-	if (!(filename) || (strlen(filename)==0)) filename = NULL;
-	if (maxdigitstr)
-	{
+	if (!(filename) || ast_strlen_zero(filename)) 
+		filename = NULL;
+	if (maxdigitstr) {
 	    maxdigits = atoi(maxdigitstr);
 	    if ((maxdigits<1) || (maxdigits>255)) {
     		maxdigits = 255;
-	    }
-	    else
+	    } else
 		ast_verbose(VERBOSE_PREFIX_3 "Accepting a maximum of %i digits.\n", maxdigits);
 	}	
-	if (!(varname) || (strlen(varname)==0)) {
+	if (!(varname) || ast_strlen_zero(varname)) {
 		ast_log(LOG_WARNING, "Read requires an variable name\n");
 		return -1;
 	}

Index: app_senddtmf.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_senddtmf.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- app_senddtmf.c	7 May 2004 20:39:14 -0000	1.4
+++ app_senddtmf.c	9 May 2004 07:51:44 -0000	1.5
@@ -19,6 +19,7 @@
 #include <asterisk/module.h>
 #include <asterisk/translate.h>
 #include <asterisk/options.h>
+#include <asterisk/utils.h>
 #include <string.h>
 #include <stdlib.h>
 #include <pthread.h>
@@ -44,7 +45,7 @@
 	struct localuser *u;
 	char *digits = data;
 
-	if (!digits || !strlen(digits)) {
+	if (!digits || ast_strlen_zero(digits)) {
 		ast_log(LOG_WARNING, "SendDTMF requires an argument (digits or *#aAbBcCdD)\n");
 		return -1;
 	}

Index: app_setcdruserfield.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_setcdruserfield.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- app_setcdruserfield.c	26 Mar 2004 06:28:56 -0000	1.3
+++ app_setcdruserfield.c	9 May 2004 07:51:44 -0000	1.4
@@ -19,7 +19,7 @@
 #include <asterisk/logger.h>
 #include <asterisk/config.h>
 #include <asterisk/manager.h>
-
+#include <asterisk/utils.h>
 #include <stdlib.h>
 #include <string.h>
 
@@ -68,11 +68,11 @@
 	char *channel = astman_get_header(m, "Channel");
 	char *append = astman_get_header(m, "Append");
 
-	if (!strlen(channel)) {
+	if (ast_strlen_zero(channel)) {
 		astman_send_error(s, m, "No Channel specified");
 		return 0;
 	}
-	if (!strlen(userfield)) {
+	if (ast_strlen_zero(userfield)) {
 		astman_send_error(s, m, "No UserField specified");
 		return 0;
 	}

Index: app_setcidname.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_setcidname.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- app_setcidname.c	3 Dec 2002 16:43:14 -0000	1.1
+++ app_setcidname.c	9 May 2004 07:51:44 -0000	1.2
@@ -20,6 +20,7 @@
 #include <asterisk/translate.h>
 #include <asterisk/image.h>
 #include <asterisk/callerid.h>
+#include <asterisk/utils.h>
 #include <string.h>
 #include <stdlib.h>
 #include <pthread.h>
@@ -63,17 +64,17 @@
 		strncpy(oldcid, chan->callerid, sizeof(oldcid) - 1);
 		ast_callerid_parse(oldcid, &n, &l);
 		n = tmp;
-		if (strlen(n)) {
-			if (l && strlen(l))
+		if (!ast_strlen_zero(n)) {
+			if (l && !ast_strlen_zero(l))
 				snprintf(newcid, sizeof(newcid), "\"%s\" <%s>", n, l);
 			else
 				strncpy(newcid, tmp, sizeof(newcid) - 1);
-		} else if (l && strlen(l)) {
+		} else if (l && !ast_strlen_zero(l)) {
 			strncpy(newcid, l, sizeof(newcid) - 1);
 		}
 	} else
 		strncpy(newcid, tmp, sizeof(newcid));
-	ast_set_callerid(chan, strlen(newcid) ? newcid : NULL, anitoo);
+	ast_set_callerid(chan, !ast_strlen_zero(newcid) ? newcid : NULL, anitoo);
 	LOCAL_USER_REMOVE(u);
 	return res;
 }

Index: app_setcidnum.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_setcidnum.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- app_setcidnum.c	25 Aug 2003 15:42:25 -0000	1.1
+++ app_setcidnum.c	9 May 2004 07:51:44 -0000	1.2
@@ -21,6 +21,7 @@
 #include <asterisk/translate.h>
 #include <asterisk/image.h>
 #include <asterisk/callerid.h>
+#include <asterisk/utils.h>
 #include <string.h>
 #include <stdlib.h>
 #include <pthread.h>
@@ -64,17 +65,17 @@
 		strncpy(oldcid, chan->callerid, sizeof(oldcid) - 1);
 		ast_callerid_parse(oldcid, &n, &l);
 		l = tmp;
-		if (strlen(l)) {
-			if (n && strlen(n))
+		if (!ast_strlen_zero(l)) {
+			if (n && !ast_strlen_zero(n))
 				snprintf(newcid, sizeof(newcid), "\"%s\" <%s>", n, l);
 			else
 				strncpy(newcid, tmp, sizeof(newcid) - 1);
-		} else if (n && strlen(n)) {
+		} else if (n && !ast_strlen_zero(n)) {
 			strncpy(newcid, n, sizeof(newcid) - 1);
 		}
 	} else
 		strncpy(newcid, tmp, sizeof(newcid));
-	ast_set_callerid(chan, strlen(newcid) ? newcid : NULL, anitoo);
+	ast_set_callerid(chan, !ast_strlen_zero(newcid) ? newcid : NULL, anitoo);
 	LOCAL_USER_REMOVE(u);
 	return res;
 }




More information about the svn-commits mailing list