[asterisk-commits] rmudgett: branch group/v14_colp r147012 - in /team/group/v14_colp: ./ apps/ c...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Oct 6 21:09:26 CDT 2008


Author: rmudgett
Date: Mon Oct  6 21:09:25 2008
New Revision: 147012

URL: http://svn.digium.com/view/asterisk?view=rev&rev=147012
Log:
Merged revisions 146799 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r146799 | tilghman | 2008-10-06 15:52:04 -0500 (Mon, 06 Oct 2008) | 8 lines
  
  Dialplan functions should not actually return 0, unless they have modified the
  workspace.  To signal an error (and no change to the workspace), -1 should be
  returned instead.
  (closes issue #13340)
   Reported by: kryptolus
   Patches: 
         20080827__bug13340__2.diff.txt uploaded by Corydon76 (license 14)
........

Modified:
    team/group/v14_colp/   (props changed)
    team/group/v14_colp/apps/app_speech_utils.c
    team/group/v14_colp/channels/chan_iax2.c
    team/group/v14_colp/channels/chan_sip.c
    team/group/v14_colp/funcs/func_callerid.c
    team/group/v14_colp/funcs/func_cdr.c
    team/group/v14_colp/funcs/func_curl.c
    team/group/v14_colp/funcs/func_groupcount.c
    team/group/v14_colp/funcs/func_math.c
    team/group/v14_colp/funcs/func_odbc.c
    team/group/v14_colp/funcs/func_timeout.c
    team/group/v14_colp/res/res_smdi.c

Propchange: team/group/v14_colp/
------------------------------------------------------------------------------
    automerge = *

Propchange: team/group/v14_colp/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Oct  6 21:09:25 2008
@@ -1,1 +1,1 @@
-/branches/1.4:1-146728
+/branches/1.4:1-146950

Modified: team/group/v14_colp/apps/app_speech_utils.c
URL: http://svn.digium.com/view/asterisk/team/group/v14_colp/apps/app_speech_utils.c?view=diff&rev=147012&r1=147011&r2=147012
==============================================================================
--- team/group/v14_colp/apps/app_speech_utils.c (original)
+++ team/group/v14_colp/apps/app_speech_utils.c Mon Oct  6 21:09:25 2008
@@ -193,8 +193,11 @@
 	if (data == NULL || speech == NULL || !(result = find_result(speech->results, data)))
                 return -1;
 
-	if (result->text != NULL)
+	if (result->text != NULL) {
 		ast_copy_string(buf, result->text, len);
+	} else {
+		buf[0] = '\0';
+	}
 
         return 0;
 }
@@ -219,8 +222,11 @@
 	if (data == NULL || speech == NULL || !(result = find_result(speech->results, data)))
                 return -1;
 
-	if (result->grammar != NULL)
+	if (result->grammar != NULL) {
 		ast_copy_string(buf, result->grammar, len);
+	} else {
+		buf[0] = '\0';
+	}
 
         return 0;
 }
@@ -322,6 +328,8 @@
 		}
 		snprintf(tmp, sizeof(tmp), "%d", results);
 		ast_copy_string(buf, tmp, len);
+	} else {
+		buf[0] = '\0';
 	}
 
 	return 0;

Modified: team/group/v14_colp/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/group/v14_colp/channels/chan_iax2.c?view=diff&rev=147012&r1=147011&r2=147012
==============================================================================
--- team/group/v14_colp/channels/chan_iax2.c (original)
+++ team/group/v14_colp/channels/chan_iax2.c Mon Oct  6 21:09:25 2008
@@ -10776,7 +10776,11 @@
 		index = atoi(codecnum);
 		if((codec = ast_codec_pref_index(&peer->prefs, index))) {
 			ast_copy_string(buf, ast_getformatname(codec), len);
-		}
+		} else {
+			buf[0] = '\0';
+		}
+	} else {
+		buf[0] = '\0';
 	}
 
 	peer_unref(peer);

Modified: team/group/v14_colp/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/group/v14_colp/channels/chan_sip.c?view=diff&rev=147012&r1=147011&r2=147012
==============================================================================
--- team/group/v14_colp/channels/chan_sip.c (original)
+++ team/group/v14_colp/channels/chan_sip.c Mon Oct  6 21:09:25 2008
@@ -12381,7 +12381,11 @@
 		index = atoi(codecnum);
 		if((codec = ast_codec_pref_index(&peer->prefs, index))) {
 			ast_copy_string(buf, ast_getformatname(codec), len);
-		}
+		} else {
+			buf[0] = '\0';
+		}
+	} else {
+		buf[0] = '\0';
 	}
 
 	ASTOBJ_UNREF(peer, sip_destroy_peer);

Modified: team/group/v14_colp/funcs/func_callerid.c
URL: http://svn.digium.com/view/asterisk/team/group/v14_colp/funcs/func_callerid.c?view=diff&rev=147012&r1=147011&r2=147012
==============================================================================
--- team/group/v14_colp/funcs/func_callerid.c (original)
+++ team/group/v14_colp/funcs/func_callerid.c Mon Oct  6 21:09:25 2008
@@ -79,8 +79,8 @@
 
 		if (!strncasecmp("all", data, 3)) {
 			snprintf(buf, len, "\"%s\" <%s>",
-				 S_OR(chan->cid.cid_name, ""),
-				 S_OR(chan->cid.cid_num, ""));
+				S_OR(chan->cid.cid_name, ""),
+				S_OR(chan->cid.cid_num, ""));
 		} else if (!strncasecmp("name", data, 4)) {
 			if (chan->cid.cid_name) {
 				ast_copy_string(buf, chan->cid.cid_name, len);

Modified: team/group/v14_colp/funcs/func_cdr.c
URL: http://svn.digium.com/view/asterisk/team/group/v14_colp/funcs/func_cdr.c?view=diff&rev=147012&r1=147011&r2=147012
==============================================================================
--- team/group/v14_colp/funcs/func_cdr.c (original)
+++ team/group/v14_colp/funcs/func_cdr.c Mon Oct  6 21:09:25 2008
@@ -88,7 +88,7 @@
 		       ast_test_flag(&flags, OPT_RECURSIVE),
 			   ast_test_flag(&flags, OPT_UNPARSED));
 
-	return 0;
+	return ret ? 0 : -1;
 }
 
 static int cdr_write(struct ast_channel *chan, char *cmd, char *parse,

Modified: team/group/v14_colp/funcs/func_curl.c
URL: http://svn.digium.com/view/asterisk/team/group/v14_colp/funcs/func_curl.c?view=diff&rev=147012&r1=147011&r2=147012
==============================================================================
--- team/group/v14_colp/funcs/func_curl.c (original)
+++ team/group/v14_colp/funcs/func_curl.c Mon Oct  6 21:09:25 2008
@@ -97,6 +97,7 @@
 
 static int curl_internal(struct MemoryStruct *chunk, char *url, char *post)
 {
+	int ret;
 	CURL **curl;
 
 	if (!(curl = ast_threadstorage_get(&curl_instance, sizeof(*curl))))
@@ -119,16 +120,17 @@
 		curl_easy_setopt(*curl, CURLOPT_POSTFIELDS, post);
 	}
 
-	curl_easy_perform(*curl);
+	ret = curl_easy_perform(*curl);
 
 	if (post)
 		curl_easy_setopt(*curl, CURLOPT_POST, 0);
 
-	return 0;
+	return ret ? -1 : 0;
 }
 
 static int acf_curl_exec(struct ast_channel *chan, char *cmd, char *info, char *buf, size_t len)
 {
+	int ret = -1;
 	struct ast_module_user *u;
 	struct MemoryStruct chunk = { NULL, 0 };
 	AST_DECLARE_APP_ARGS(args,
@@ -159,6 +161,7 @@
 			ast_copy_string(buf, chunk.memory, len);
 			free(chunk.memory);
 		}
+		ret = 0;
 	} else {
 		ast_log(LOG_ERROR, "Cannot allocate curl structure\n");
 	}
@@ -168,7 +171,7 @@
 
 	ast_module_user_remove(u);
 
-	return 0;
+	return ret;
 }
 
 struct ast_custom_function acf_curl = {

Modified: team/group/v14_colp/funcs/func_groupcount.c
URL: http://svn.digium.com/view/asterisk/team/group/v14_colp/funcs/func_groupcount.c?view=diff&rev=147012&r1=147011&r2=147012
==============================================================================
--- team/group/v14_colp/funcs/func_groupcount.c (original)
+++ team/group/v14_colp/funcs/func_groupcount.c Mon Oct  6 21:09:25 2008
@@ -39,6 +39,7 @@
 static int group_count_function_read(struct ast_channel *chan, char *cmd,
 				     char *data, char *buf, size_t len)
 {
+	int ret = -1;
 	int count = -1;
 	char group[80] = "", category[80] = "";
 
@@ -64,12 +65,14 @@
 		ast_app_group_list_unlock();
 	}
 
-	if ((count = ast_app_group_get_count(group, category)) == -1)
+	if ((count = ast_app_group_get_count(group, category)) == -1) {
 		ast_log(LOG_NOTICE, "No group could be found for channel '%s'\n", chan->name);
-	else
+	} else {
 		snprintf(buf, len, "%d", count);
-
-	return 0;
+		ret = 0;
+	}
+
+	return ret;
 }
 
 static struct ast_custom_function group_count_function = {
@@ -96,9 +99,10 @@
 	if (!ast_strlen_zero(group)) {
 		count = ast_app_group_match_get_count(group, category);
 		snprintf(buf, len, "%d", count);
-	}
-
-	return 0;
+		return 0;
+	}
+
+	return -1;
 }
 
 static struct ast_custom_function group_match_count_function = {
@@ -116,6 +120,7 @@
 static int group_function_read(struct ast_channel *chan, char *cmd,
 			       char *data, char *buf, size_t len)
 {
+	int ret = -1;
 	struct ast_group_info *gi = NULL;
 	
 	ast_app_group_list_lock();
@@ -129,12 +134,14 @@
 			break;
 	}
 	
-	if (gi)
+	if (gi) {
 		ast_copy_string(buf, gi->group, len);
+		ret = 0;
+	}
 	
 	ast_app_group_list_unlock();
 	
-	return 0;
+	return ret;
 }
 
 static int group_function_write(struct ast_channel *chan, char *cmd,

Modified: team/group/v14_colp/funcs/func_math.c
URL: http://svn.digium.com/view/asterisk/team/group/v14_colp/funcs/func_math.c?view=diff&rev=147012&r1=147011&r2=147012
==============================================================================
--- team/group/v14_colp/funcs/func_math.c (original)
+++ team/group/v14_colp/funcs/func_math.c Mon Oct  6 21:09:25 2008
@@ -78,14 +78,14 @@
 	);
 
 	if (ast_strlen_zero(parse)) {
-		ast_log(LOG_WARNING, "Syntax: Math(<number1><op><number 2>[,<type_of_result>]) - missing argument!\n");
+		ast_log(LOG_WARNING, "Syntax: MATH(<number1><op><number 2>[,<type_of_result>]) - missing argument!\n");
 		return -1;
 	}
 
 	AST_STANDARD_APP_ARGS(args, parse);
 
 	if (args.argc < 1) {
-		ast_log(LOG_WARNING, "Syntax: Math(<number1><op><number 2>[,<type_of_result>]) - missing argument!\n");
+		ast_log(LOG_WARNING, "Syntax: MATH(<number1><op><number 2>[,<type_of_result>]) - missing argument!\n");
 		return -1;
 	}
 

Modified: team/group/v14_colp/funcs/func_odbc.c
URL: http://svn.digium.com/view/asterisk/team/group/v14_colp/funcs/func_odbc.c?view=diff&rev=147012&r1=147011&r2=147012
==============================================================================
--- team/group/v14_colp/funcs/func_odbc.c (original)
+++ team/group/v14_colp/funcs/func_odbc.c Mon Oct  6 21:09:25 2008
@@ -218,7 +218,7 @@
 	struct odbc_obj *obj;
 	struct acf_odbc_query *query;
 	char sql[2048] = "", varname[15];
-	int res, x, buflen = 0, escapecommas, bogus_chan = 0;
+	int res, x, buflen = 1, escapecommas, bogus_chan = 0;
 	AST_DECLARE_APP_ARGS(args,
 		AST_APP_ARG(field)[100];
 	);

Modified: team/group/v14_colp/funcs/func_timeout.c
URL: http://svn.digium.com/view/asterisk/team/group/v14_colp/funcs/func_timeout.c?view=diff&rev=147012&r1=147011&r2=147012
==============================================================================
--- team/group/v14_colp/funcs/func_timeout.c (original)
+++ team/group/v14_colp/funcs/func_timeout.c Mon Oct  6 21:09:25 2008
@@ -80,7 +80,7 @@
 
 	default:
 		ast_log(LOG_ERROR, "Unknown timeout type specified.\n");
-		break;
+		return -1;
 	}
 
 	return 0;

Modified: team/group/v14_colp/res/res_smdi.c
URL: http://svn.digium.com/view/asterisk/team/group/v14_colp/res/res_smdi.c?view=diff&rev=147012&r1=147011&r2=147012
==============================================================================
--- team/group/v14_colp/res/res_smdi.c (original)
+++ team/group/v14_colp/res/res_smdi.c Mon Oct  6 21:09:25 2008
@@ -1265,7 +1265,7 @@
 return_error:
 	ast_module_user_remove(u);
 
-	return 0;
+	return res;
 }
 
 static struct ast_custom_function smdi_msg_retrieve_function = {




More information about the asterisk-commits mailing list