[asterisk-commits] trunk r22045 - /trunk/res/res_musiconhold.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Fri Apr 21 11:26:56 MST 2006
Author: rizzo
Date: Fri Apr 21 13:26:54 2006
New Revision: 22045
URL: http://svn.digium.com/view/asterisk?rev=22045&view=rev
Log:
more strncpy/ast_copy_string replacement.
On passing, simplify code by using strsep() as appropriate
Modified:
trunk/res/res_musiconhold.c
Modified: trunk/res/res_musiconhold.c
URL: http://svn.digium.com/view/asterisk/trunk/res/res_musiconhold.c?rev=22045&r1=22044&r2=22045&view=diff
==============================================================================
--- trunk/res/res_musiconhold.c (original)
+++ trunk/res/res_musiconhold.c Fri Apr 21 13:26:54 2006
@@ -364,33 +364,25 @@
argv[argc++] = "8192";
/* Look for extra arguments and add them to the list */
- strncpy(xargs, class->args, sizeof(xargs) - 1);
+ ast_copy_string(xargs, class->args, sizeof(xargs));
argptr = xargs;
while (!ast_strlen_zero(argptr)) {
argv[argc++] = argptr;
- argptr = strchr(argptr, ',');
- if (argptr) {
- *argptr = '\0';
- argptr++;
- }
+ strsep(&argptr, ",");
}
} else {
/* Format arguments for argv vector */
- strncpy(xargs, class->args, sizeof(xargs) - 1);
+ ast_copy_string(xargs, class->args, sizeof(xargs));
argptr = xargs;
while (!ast_strlen_zero(argptr)) {
argv[argc++] = argptr;
- argptr = strchr(argptr, ' ');
- if (argptr) {
- *argptr = '\0';
- argptr++;
- }
+ strsep(&argptr, " ");
}
}
if (strstr(class->dir,"http://") || strstr(class->dir,"HTTP://")) {
- strncpy(fns[files], class->dir, sizeof(fns[files]) - 1);
+ ast_copy_string(fns[files], class->dir, sizeof(fns[files]));
argv[argc++] = fns[files];
files++;
} else if (dir) {
@@ -400,7 +392,7 @@
(!strcasecmp(de->d_name + strlen(de->d_name) - 4, ".raw") ||
!strcasecmp(de->d_name + strlen(de->d_name) - 4, ".sln"))) ||
!strcasecmp(de->d_name + strlen(de->d_name) - 4, ".mp3"))) {
- strncpy(fns[files], de->d_name, sizeof(fns[files]) - 1);
+ ast_copy_string(fns[files], de->d_name, sizeof(fns[files]));
argv[argc++] = fns[files];
files++;
}
More information about the asterisk-commits
mailing list