diff options
author | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-06-05 16:32:16 +0000 |
---|---|---|
committer | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-06-05 16:32:16 +0000 |
commit | 2dd14b8c0e865f214f00ada06612d3e7cb4928e6 (patch) | |
tree | 1d36c89b23d1c07dd7adc9a1dbe08b4882358c96 /file.c | |
parent | ad9520e6b0bee1ace5d48ed81659581d63e97d10 (diff) |
more ast_copy_string() conversion
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@5849 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'file.c')
-rwxr-xr-x | file.c | 22 |
1 files changed, 11 insertions, 11 deletions
@@ -119,8 +119,8 @@ int ast_format_register(const char *name, const char *exts, int format, ast_mutex_unlock(&formatlock); return -1; } - strncpy(tmp->name, name, sizeof(tmp->name)-1); - strncpy(tmp->exts, exts, sizeof(tmp->exts)-1); + ast_copy_string(tmp->name, name, sizeof(tmp->name)); + ast_copy_string(tmp->exts, exts, sizeof(tmp->exts)); tmp->open = open; tmp->rewrite = rewrite; tmp->read = read; @@ -285,9 +285,9 @@ static char *build_filename(const char *filename, const char *ext) int fnsize = 0; if (!strcmp(ext, "wav49")) { - strncpy(type, "WAV", sizeof(type) - 1); + ast_copy_string(type, "WAV", sizeof(type)); } else { - strncpy(type, ext, sizeof(type) - 1); + ast_copy_string(type, ext, sizeof(type)); } if (filename[0] == '/') { @@ -313,7 +313,7 @@ static int exts_compare(const char *exts, const char *type) char *stringp = NULL, *ext; char tmp[256]; - strncpy(tmp, exts, sizeof(tmp) - 1); + ast_copy_string(tmp, exts, sizeof(tmp)); stringp = tmp; while ((ext = strsep(&stringp, "|"))) { if (!strcmp(ext, type)) { @@ -472,7 +472,7 @@ struct ast_filestream *ast_openstream_full(struct ast_channel *chan, const char ast_deactivate_generator(chan); } if (preflang && !ast_strlen_zero(preflang)) { - strncpy(filename3, filename, sizeof(filename3) - 1); + ast_copy_string(filename3, filename, sizeof(filename3)); endpart = strrchr(filename3, '/'); if (endpart) { *endpart = '\0'; @@ -483,7 +483,7 @@ struct ast_filestream *ast_openstream_full(struct ast_channel *chan, const char fmts = ast_fileexists(filename2, NULL, NULL); } if (fmts < 1) { - strncpy(filename2, filename, sizeof(filename2)-1); + ast_copy_string(filename2, filename, sizeof(filename2)); fmts = ast_fileexists(filename2, NULL, NULL); } if (fmts < 1) { @@ -524,13 +524,13 @@ struct ast_filestream *ast_openvstream(struct ast_channel *chan, const char *fil snprintf(filename2, sizeof(filename2), "%s/%s", preflang, filename); fmts = ast_fileexists(filename2, fmt, NULL); if (fmts < 1) { - strncpy(lang2, preflang, sizeof(lang2)-1); + ast_copy_string(lang2, preflang, sizeof(lang2)); snprintf(filename2, sizeof(filename2), "%s/%s", lang2, filename); fmts = ast_fileexists(filename2, fmt, NULL); } } if (fmts < 1) { - strncpy(filename2, filename, sizeof(filename2)-1); + ast_copy_string(filename2, filename, sizeof(filename2)); fmts = ast_fileexists(filename2, fmt, NULL); } if (fmts < 1) { @@ -723,7 +723,7 @@ int ast_fileexists(const char *filename, const char *fmt, const char *preflang) int res = -1; if (preflang && !ast_strlen_zero(preflang)) { /* Insert the language between the last two parts of the path */ - strncpy(tmp, filename, sizeof(tmp) - 1); + ast_copy_string(tmp, filename, sizeof(tmp)); c = strrchr(tmp, '/'); if (c) { *c = '\0'; @@ -738,7 +738,7 @@ int ast_fileexists(const char *filename, const char *fmt, const char *preflang) res = ast_filehelper(filename2, NULL, fmt, ACTION_EXISTS); if (res < 1) { char *stringp=NULL; - strncpy(lang2, preflang, sizeof(lang2)-1); + ast_copy_string(lang2, preflang, sizeof(lang2)); stringp=lang2; strsep(&stringp, "_"); /* If language is a specific locality of a language (like es_MX), strip the locality and try again */ |