[asterisk-commits] trunk r9085 - in /trunk/channels: chan_misdn.c chan_nbs.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Feb 2 11:33:23 MST 2006


Author: mattf
Date: Thu Feb  2 12:33:23 2006
New Revision: 9085

URL: http://svn.digium.com/view/asterisk?rev=9085&view=rev
Log:
More stringfield related changes

Modified:
    trunk/channels/chan_misdn.c
    trunk/channels/chan_nbs.c

Modified: trunk/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_misdn.c?rev=9085&r1=9084&r2=9085&view=diff
==============================================================================
--- trunk/channels/chan_misdn.c (original)
+++ trunk/channels/chan_misdn.c Thu Feb  2 12:33:23 2006
@@ -58,6 +58,7 @@
 #include <asterisk/indications.h>
 #include <asterisk/app.h>
 #include <asterisk/features.h>
+#include <asterisk/stringfields.h>
 
 #include "chan_misdn_config.h"
 #include "isdn_lib.h"
@@ -1081,15 +1082,12 @@
 	
 
 	misdn_cfg_get( port, MISDN_CFG_LANGUAGE, lang, BUFFERSIZE);
-	ast_copy_string(ast->language, lang, sizeof(ast->language));
-	ast->language[sizeof(ast->language)]=0;
-
-
-	char musicclass[BUFFERSIZE];
-	
-	misdn_cfg_get( port, MISDN_CFG_MUSICCLASS, musicclass, BUFFERSIZE);
-	ast_copy_string(ast->musicclass, musicclass, sizeof(ast->musicclass));
-	ast->musicclass[sizeof(ast->musicclass)]=0;
+	ast_string_field_set(ast, language, lang);
+
+	char localmusicclass[BUFFERSIZE];
+	
+	misdn_cfg_get( port, MISDN_CFG_MUSICCLASS, localmusicclass, BUFFERSIZE);
+	ast_string_field_set(ast, musicclass, localmusicclass);
 	
 	
 	misdn_cfg_get( port, MISDN_CFG_TXGAIN, &bc->txgain, sizeof(int));
@@ -2314,14 +2312,12 @@
 		
 		if (c<=0) {
 			c=glob_channel++;
-			snprintf(tmp->name, sizeof(tmp->name), "%s/%d-u%d",
+			ast_string_field_build(tmp, name, "%s/%d-u%d",
 				 misdn_type, port, c);
 		} else {
-			snprintf(tmp->name, sizeof(tmp->name), "%s/%d-%d",
+			ast_string_field_build(tmp, name, "%s/%d-%d",
 				 misdn_type, port, c);
 		}
-		
-		tmp->type = misdn_type;
 		
 		tmp->nativeformats = prefformat;
 

Modified: trunk/channels/chan_nbs.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_nbs.c?rev=9085&r1=9084&r2=9085&view=diff
==============================================================================
--- trunk/channels/chan_nbs.c (original)
+++ trunk/channels/chan_nbs.c Thu Feb  2 12:33:23 2006
@@ -51,7 +51,6 @@
 #include "asterisk/utils.h"
 
 static const char desc[] = "Network Broadcast Sound Support";
-static const char type[] = "NBS";
 static const char tdesc[] = "Network Broadcast Sound Driver";
 
 static int usecnt =0;
@@ -62,6 +61,7 @@
 AST_MUTEX_DEFINE_STATIC(usecnt_lock);
 
 static char context[AST_MAX_EXTENSION] = "default";
+static char type[] = "NBS";
 
 /* NBS creates private structures on demand */
    
@@ -233,8 +233,7 @@
 	tmp = ast_channel_alloc(1);
 	if (tmp) {
 		tmp->tech = &nbs_tech;
-		snprintf(tmp->name, sizeof(tmp->name), "NBS/%s", i->stream);
-		tmp->type = type;
+		ast_string_field_build(tmp, name, "NBS/%s", i->stream);
 		tmp->fds[0] = nbs_fd(i->nbs);
 		tmp->nativeformats = prefformat;
 		tmp->rawreadformat = prefformat;
@@ -247,7 +246,7 @@
 		tmp->tech_pvt = i;
 		strncpy(tmp->context, context, sizeof(tmp->context)-1);
 		strncpy(tmp->exten, "s",  sizeof(tmp->exten) - 1);
-		tmp->language[0] = '\0';
+		ast_string_field_set(tmp, language, "");
 		i->owner = tmp;
 		ast_mutex_lock(&usecnt_lock);
 		usecnt++;



More information about the asterisk-commits mailing list