[asterisk-commits] mogorman: branch 1.2 r49447 - /branches/1.2/apps/app_voicemail.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Jan 4 10:45:17 MST 2007


Author: mogorman
Date: Thu Jan  4 11:45:16 2007
New Revision: 49447

URL: http://svn.digium.com/view/asterisk?view=rev&rev=49447
Log:
converted a lot of 256 to PATH_MAX and some white space fixes.

Modified:
    branches/1.2/apps/app_voicemail.c

Modified: branches/1.2/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/apps/app_voicemail.c?view=diff&rev=49447&r1=49446&r2=49447
==============================================================================
--- branches/1.2/apps/app_voicemail.c (original)
+++ branches/1.2/apps/app_voicemail.c Thu Jan  4 11:45:16 2007
@@ -243,10 +243,10 @@
 struct vm_state {
 	char curbox[80];
 	char username[80];
-	char curdir[256];
-	char vmbox[256];
-	char fn[256];
-	char fn2[256];
+	char curdir[PATH_MAX];
+	char vmbox[PATH_MAX];
+	char fn[PATH_MAX];
+	char fn2[PATH_MAX];
 	int *deleted;
 	int *heard;
 	int curmsg;
@@ -639,7 +639,7 @@
 	int linenum=0;
 	char inbuf[256];
 	char orig[256];
-	char currcontext[256] ="";
+	char currcontext[256] = "";
 	char tmpin[AST_CONFIG_MAX_PATH];
 	char tmpout[AST_CONFIG_MAX_PATH];
 	struct stat statbuf;
@@ -839,7 +839,7 @@
 	void *fdm=NULL;
 	SQLSMALLINT colcount=0;
 	SQLHSTMT stmt;
-	char sql[256];
+	char sql[PATH_MAX];
 	char fmt[80]="";
 	char *c;
 	char coltitle[256];
@@ -850,8 +850,8 @@
 	SQLULEN colsize;
 	FILE *f=NULL;
 	char rowdata[80];
-	char fn[256];
-	char full_fn[256];
+	char fn[PATH_MAX];
+	char full_fn[PATH_MAX];
 	char msgnums[80];
 	
 	odbc_obj *obj;
@@ -986,8 +986,8 @@
 
 static int remove_file(char *dir, int msgnum)
 {
-	char fn[256];
-	char full_fn[256];
+	char fn[PATH_MAX];
+	char full_fn[PATH_MAX];
 	char msgnums[80];
 	
 	if (msgnum > -1) {
@@ -1006,7 +1006,7 @@
 	int x = 0;
 	int res;
 	SQLHSTMT stmt;
-	char sql[256];
+	char sql[PATH_MAX];
 	char rowdata[20];
 	
 	odbc_obj *obj;
@@ -1057,7 +1057,7 @@
 	int x = 0;
 	int res;
 	SQLHSTMT stmt;
-	char sql[256];
+	char sql[PATH_MAX];
 	char rowdata[20];
 	char msgnums[20];
 	
@@ -1115,7 +1115,7 @@
 {
 	int res;
 	SQLHSTMT stmt;
-	char sql[256];
+	char sql[PATH_MAX];
 	char msgnums[20];
 	
 	odbc_obj *obj;
@@ -1212,10 +1212,10 @@
 	size_t fdlen = -1;
 	SQLHSTMT stmt;
 	SQLINTEGER len;
-	char sql[256];
+	char sql[PATH_MAX];
 	char msgnums[20];
-	char fn[256];
-	char full_fn[256];
+	char fn[PATH_MAX];
+	char full_fn[PATH_MAX];
 	char fmt[80]="";
 	char *c;
 	char *context="", *macrocontext="", *callerid="", *origtime="", *duration="";
@@ -1331,7 +1331,7 @@
 {
 	int res;
 	SQLHSTMT stmt;
-	char sql[256];
+	char sql[PATH_MAX];
 	char msgnums[20];
 	char msgnumd[20];
 	odbc_obj *obj;
@@ -1408,8 +1408,8 @@
 
 static void rename_file(char *sfn, char *dfn)
 {
-	char stxt[256];
-	char dtxt[256];
+	char stxt[PATH_MAX];
+	char dtxt[PATH_MAX];
 	ast_filerename(sfn,dfn,NULL);
 	snprintf(stxt, sizeof(stxt), "%s.txt", sfn);
 	snprintf(dtxt, sizeof(dtxt), "%s.txt", dfn);
@@ -1468,7 +1468,7 @@
 
 static void copy_file(char *frompath, char *topath)
 {
-	char frompath2[256],topath2[256];
+	char frompath2[PATH_MAX], topath2[PATH_MAX];
 	ast_filecopy(frompath, topath, NULL);
 	snprintf(frompath2, sizeof(frompath2), "%s.txt", frompath);
 	snprintf(topath2, sizeof(topath2), "%s.txt", topath);
@@ -1481,7 +1481,7 @@
 static int last_message_index(struct ast_vm_user *vmu, char *dir)
 {
 	int x;
-	char fn[256];
+	char fn[PATH_MAX];
 
 	if (vm_lock_path(dir))
 		return ERROR_LOCK_PATH;
@@ -1660,10 +1660,10 @@
 	char host[MAXHOSTNAMELEN] = "";
 	char who[256];
 	char bound[256];
-	char fname[256];
-	char dur[256];
+	char fname[PATH_MAX];
+	char dur[PATH_MAX];
 	char tmp[80] = "/tmp/astmail-XXXXXX";
-	char tmp2[256];
+	char tmp2[PATH_MAX];
 	time_t t;
 	struct tm tm;
 	struct vm_zone *the_zone = NULL;
@@ -1819,11 +1819,11 @@
 	FILE *p=NULL;
 	int pfd;
 	char date[256];
-	char host[MAXHOSTNAMELEN]="";
+	char host[MAXHOSTNAMELEN] = "";
 	char who[256];
-	char dur[256];
+	char dur[PATH_MAX];
 	char tmp[80] = "/tmp/astmail-XXXXXX";
-	char tmp2[256];
+	char tmp2[PATH_MAX];
 	time_t t;
 	struct tm tm;
 	struct vm_zone *the_zone = NULL;
@@ -1942,12 +1942,12 @@
 static int invent_message(struct ast_channel *chan, char *context, char *ext, int busy, char *ecodes)
 {
 	int res;
-	char fn[256];
-	char dest[256];
+	char fn[PATH_MAX];
+	char dest[PATH_MAX];
 
 	snprintf(fn, sizeof(fn), "%s%s/%s/greet", VM_SPOOL_DIR, context, ext);
 
-	if (!(res = create_dirpath(dest,256,context,ext,"greet"))) {
+	if (!(res = create_dirpath(dest, sizeof(dest), context, ext, "greet"))) {
 		ast_log(LOG_WARNING, "Failed to make directory(%s)\n", fn);
 		return -1;
 	}
@@ -2032,9 +2032,9 @@
 	int x = -1;
 	int res;
 	SQLHSTMT stmt;
-	char sql[256];
+	char sql[PATH_MAX];
 	char rowdata[20];
-	char tmp[256]="";
+	char tmp[PATH_MAX] = "";
         char *context;
 
         if (newmsgs)
@@ -2136,9 +2136,9 @@
 	int nummsgs = 0;
         int res;
         SQLHSTMT stmt;
-        char sql[256];
+        char sql[PATH_MAX];
         char rowdata[20];
-        char tmp[256]="";
+        char tmp[PATH_MAX] = "";
         char *context;
 	if (!folder)
                 folder = "INBOX";
@@ -2206,8 +2206,8 @@
 {
 	DIR *dir;
 	struct dirent *de;
-	char fn[256];
-	char tmp[256]="";
+	char fn[PATH_MAX];
+	char tmp[PATH_MAX] = "";
 	char *mb, *cur;
 	char *context;
 	int ret;
@@ -2254,8 +2254,8 @@
 {
 	DIR *dir;
 	struct dirent *de;
-	char fn[256];
-	char tmp[256]="";
+	char fn[PATH_MAX];
+	char tmp[PATH_MAX] = "";
 	char *mb, *cur;
 	char *context;
 	int ret;
@@ -2327,7 +2327,7 @@
 
 static int copy_message(struct ast_channel *chan, struct ast_vm_user *vmu, int imbox, int msgnum, long duration, struct ast_vm_user *recip, char *fmt)
 {
-	char fromdir[256], todir[256], frompath[256], topath[256];
+	char fromdir[PATH_MAX], todir[PATH_MAX], frompath[PATH_MAX], topath[PATH_MAX];
 	char *frombox = mbox(imbox);
 	int recipmsgnum;
 
@@ -2388,7 +2388,7 @@
 
 static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_options *options)
 {
-	char txtfile[256], tmptxtfile[256];
+	char txtfile[PATH_MAX], tmptxtfile[PATH_MAX];
 	char callerid[256];
 	FILE *txt;
 	int res = 0, txtdes;
@@ -2398,11 +2398,11 @@
 	int ousemacro = 0;
 	int ouseexten = 0;
 	char date[256];
-	char dir[256], tmpdir[260];
-	char dest[256];
-	char fn[256];
-	char prefile[256]="";
-	char tempfile[256]="";
+	char dir[PATH_MAX], tmpdir[PATH_MAX];
+	char dest[PATH_MAX];
+	char fn[PATH_MAX];
+	char prefile[PATH_MAX] = "";
+	char tempfile[PATH_MAX] = "";
 	char ext_context[256] = "";
 	char fmt[80];
 	char *context;
@@ -2712,8 +2712,8 @@
 	/* we know max messages, so stop process when number is hit */
 
 	int x,dest;
-	char sfn[256];
-	char dfn[256];
+	char sfn[PATH_MAX];
+	char dfn[PATH_MAX];
 
 	if (vm_lock_path(dir))
 		return ERROR_LOCK_PATH;
@@ -2745,9 +2745,9 @@
 
 static int save_to_folder(struct ast_vm_user *vmu, char *dir, int msg, char *context, char *username, int box)
 {
-	char sfn[256];
-	char dfn[256];
-	char ddir[256];
+	char sfn[PATH_MAX];
+	char dfn[PATH_MAX];
+	char ddir[PATH_MAX];
 	char *dbox = mbox(box);
 	int x;
  	make_file(sfn, sizeof(sfn), dir, msg);
@@ -3009,7 +3009,7 @@
 	int bytes=0;
 	unsigned char buf[256]; 
 	char buf1[256], buf2[256];
-	char fn2[256];
+	char fn2[PATH_MAX];
 
 	char cid[256]="";
 	char *val;
@@ -3269,7 +3269,7 @@
 {
 	int x;
 	int d;
-	char fn[256];
+	char fn[PATH_MAX];
 	d = ast_play_and_wait(chan, "vm-press");	/* "Press" */
 	if (d)
 		return d;
@@ -3406,7 +3406,7 @@
 
 static int notify_new_message(struct ast_channel *chan, struct ast_vm_user *vmu, int msgnum, long duration, char *fmt, char *cidnum, char *cidname)
 {
-	char todir[256], fn[256], ext_context[256], *stringp;
+	char todir[PATH_MAX], fn[PATH_MAX], ext_context[PATH_MAX], *stringp;
 	int newmsgs = 0, oldmsgs = 0;
 
 	make_dir(todir, sizeof(todir), vmu->context, vmu->mailbox, "INBOX");
@@ -3718,7 +3718,7 @@
 	int res = 0;
 	int i;
 	char *callerid, *name;
-	char prefile[256]="";
+	char prefile[PATH_MAX] = "";
 	
 
 	/* If voicemail cid is not enabled, or we didn't get cid or context from the attribute file, leave now. */
@@ -3802,7 +3802,7 @@
 static int play_message(struct ast_channel *chan, struct ast_vm_user *vmu, struct vm_state *vms)
 {
 	int res = 0;
-	char filename[256],*origtime, *cid, *context, *duration;
+	char filename[PATH_MAX], *origtime, *cid, *context, *duration;
 	char *category;
 	struct ast_config *msg_cfg;
 
@@ -4633,7 +4633,7 @@
 	int tries = 0;
 	char newpassword[80] = "";
 	char newpassword2[80] = "";
-	char prefile[256]="";
+	char prefile[PATH_MAX] = "";
 	unsigned char buf[256];
 	int bytes=0;
 
@@ -4711,7 +4711,7 @@
 	int duration = 0;
 	char newpassword[80] = "";
 	char newpassword2[80] = "";
-	char prefile[256]="";
+	char prefile[PATH_MAX] = "";
 	unsigned char buf[256];
 	int bytes=0;
 
@@ -4807,10 +4807,10 @@
 	int cmd = 0;
 	int retries = 0;
 	int duration = 0;
-	char prefile[256]="";
+	char prefile[PATH_MAX] = "";
 	unsigned char buf[256];
-	char dest[256];
-	int bytes=0;
+	char dest[PATH_MAX];
+	int bytes = 0;
 
 	if (adsi_available(chan))
 	{
@@ -6440,7 +6440,7 @@
 			    int option, signed char record_gain)
 {
 	int res = 0;
-	char filename[256],*origtime, *cid, *context, *name, *num;
+	char filename[PATH_MAX], *origtime, *cid, *context, *name, *num;
 	struct ast_config *msg_cfg;
 	int retries = 0;
 



More information about the asterisk-commits mailing list