[Asterisk-cvs] asterisk file.c,1.51,1.52 say.c,1.42,1.43

markster at lists.digium.com markster at lists.digium.com
Sat Nov 13 11:12:12 CST 2004


Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv16605

Modified Files:
	file.c say.c 
Log Message:
Updates from char * to const char * + german syntax + enumeration (bug #2780)


Index: file.c
===================================================================
RCS file: /usr/cvsroot/asterisk/file.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -d -r1.51 -r1.52
--- file.c	20 Sep 2004 23:15:49 -0000	1.51
+++ file.c	13 Nov 2004 16:13:07 -0000	1.52
@@ -46,7 +46,7 @@
 	/* Open an input stream, and start playback */
 	struct ast_filestream * (*open)(int fd);
 	/* Open an output stream, of a given file descriptor and comment it appropriately if applicable */
-	struct ast_filestream * (*rewrite)(int fd, char *comment);
+	struct ast_filestream * (*rewrite)(int fd, const char *comment);
 	/* Write a frame to a channel */
 	int (*write)(struct ast_filestream *, struct ast_frame *);
 	/* seek num samples into file, whence(think normal seek) */
@@ -87,9 +87,9 @@
 
 static struct ast_format *formats = NULL;
 
-int ast_format_register(char *name, char *exts, int format,
+int ast_format_register(const char *name, const char *exts, int format,
 						struct ast_filestream * (*open)(int fd),
-						struct ast_filestream * (*rewrite)(int fd, char *comment),
+						struct ast_filestream * (*rewrite)(int fd, const char *comment),
 						int (*write)(struct ast_filestream *, struct ast_frame *),
 						int (*seek)(struct ast_filestream *, long sample_offset, int whence),
 						int (*trunc)(struct ast_filestream *),
@@ -138,7 +138,7 @@
 	return 0;
 }
 
-int ast_format_unregister(char *name)
+int ast_format_unregister(const char *name)
 {
 	struct ast_format *tmp, *tmpl = NULL;
 	if (ast_mutex_lock(&formatlock)) {
@@ -188,7 +188,7 @@
 			/* This is the audio portion.  Call the video one... */
 			if (!fs->vfs && fs->filename) {
 				/* XXX Support other video formats XXX */
-				char *type = "h263";
+				const char *type = "h263";
 				fs->vfs = ast_writefile(fs->filename, type, NULL, fs->flags, 0, fs->mode);
 				ast_log(LOG_DEBUG, "Opened video output file\n");
 			}
@@ -238,7 +238,7 @@
 	}
 }
 
-static int copy(char *infile, char *outfile)
+static int copy(const char *infile, const char *outfile)
 {
 	int ifd;
 	int ofd;
@@ -278,7 +278,7 @@
 	return 0;
 }
 
-static char *build_filename(char *filename, char *ext)
+static char *build_filename(const const char *filename, const char *ext)
 {
 	char *fn;
 	int fnsize = 0;
@@ -297,7 +297,7 @@
 	
 }
 
-static int exts_compare(char *exts, char *type)
+static int exts_compare(const char *exts, const const char *type)
 {
 	char *stringp = NULL, *ext;
 	char tmp[256];
@@ -319,7 +319,7 @@
 #define ACTION_OPEN   4
 #define ACTION_COPY   5
 
-static int ast_filehelper(char *filename, char *filename2, char *fmt, int action)
+static int ast_filehelper(const char *filename, const char *filename2, const char *fmt, int action)
 {
 	struct stat st;
 	struct ast_format *f;
@@ -432,7 +432,7 @@
 	return res;
 }
 
-struct ast_filestream *ast_openstream(struct ast_channel *chan, char *filename, char *preflang)
+struct ast_filestream *ast_openstream(struct ast_channel *chan, const char *filename, const char *preflang)
 {
 	/* This is a fairly complex routine.  Essentially we should do 
 	   the following:
@@ -485,7 +485,7 @@
 	return NULL;
 }
 
-struct ast_filestream *ast_openvstream(struct ast_channel *chan, char *filename, char *preflang)
+struct ast_filestream *ast_openvstream(struct ast_channel *chan, const char *filename, const char *preflang)
 {
 	/* This is a fairly complex routine.  Essentially we should do 
 	   the following:
@@ -697,7 +697,7 @@
 }
 
 
-int ast_fileexists(char *filename, char *fmt, char *preflang)
+int ast_fileexists(const char *filename, const char *fmt, const char *preflang)
 {
 	char filename2[256];
 	char tmp[256];
@@ -737,22 +737,22 @@
 	return res;
 }
 
-int ast_filedelete(char *filename, char *fmt)
+int ast_filedelete(const char *filename, const char *fmt)
 {
 	return ast_filehelper(filename, NULL, fmt, ACTION_DELETE);
 }
 
-int ast_filerename(char *filename, char *filename2, char *fmt)
+int ast_filerename(const char *filename, const char *filename2, const char *fmt)
 {
 	return ast_filehelper(filename, filename2, fmt, ACTION_RENAME);
 }
 
-int ast_filecopy(char *filename, char *filename2, char *fmt)
+int ast_filecopy(const char *filename, const char *filename2, const char *fmt)
 {
 	return ast_filehelper(filename, filename2, fmt, ACTION_COPY);
 }
 
-int ast_streamfile(struct ast_channel *chan, char *filename, char *preflang)
+int ast_streamfile(struct ast_channel *chan, const char *filename, const char *preflang)
 {
 	struct ast_filestream *fs;
 	struct ast_filestream *vfs;
@@ -780,7 +780,7 @@
 	return -1;
 }
 
-struct ast_filestream *ast_readfile(char *filename, char *type, char *comment, int flags, int check, mode_t mode)
+struct ast_filestream *ast_readfile(const char *filename, const char *type, const char *comment, int flags, int check, mode_t mode)
 {
 	int fd,myflags = 0;
 	struct ast_format *f;
@@ -829,7 +829,7 @@
 	return fs;
 }
 
-struct ast_filestream *ast_writefile(char *filename, char *type, char *comment, int flags, int check, mode_t mode)
+struct ast_filestream *ast_writefile(const char *filename, const char *type, const char *comment, int flags, int check, mode_t mode)
 {
 	int fd,myflags = 0;
 	struct ast_format *f;
@@ -920,7 +920,7 @@
 	return fs;
 }
 
-char ast_waitstream(struct ast_channel *c, char *breakon)
+char ast_waitstream(struct ast_channel *c, const char *breakon)
 {
 	/* XXX Maybe I should just front-end ast_waitstream_full ? XXX */
 	int res;
@@ -976,7 +976,7 @@
 	return (c->_softhangup ? -1 : 0);
 }
 
-char ast_waitstream_fr(struct ast_channel *c, char *breakon, char *forward, char *rewind, int ms)
+char ast_waitstream_fr(struct ast_channel *c, const char *breakon, const char *forward, const char *rewind, int ms)
 {
 	int res;
 	struct ast_frame *fr;
@@ -1037,7 +1037,7 @@
 	return (c->_softhangup ? -1 : 0);
 }
 
-char ast_waitstream_full(struct ast_channel *c, char *breakon, int audiofd, int cmdfd)
+char ast_waitstream_full(struct ast_channel *c, const char *breakon, int audiofd, int cmdfd)
 {
 	int res;
 	int ms;

Index: say.c
===================================================================
RCS file: /usr/cvsroot/asterisk/say.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- say.c	12 Nov 2004 01:32:45 -0000	1.42
+++ say.c	13 Nov 2004 16:13:07 -0000	1.43
@@ -30,9 +30,9 @@
 
 
 /* Forward declaration */
-static int wait_file(struct ast_channel *chan, char *ints, char *file, char *lang);
+static int wait_file(struct ast_channel *chan, const char *ints, const char *file, const char *lang);
 
-int ast_say_digit_str(struct ast_channel *chan, char *fn2, char *ints, char *lang)
+int ast_say_digit_str(struct ast_channel *chan, const char *fn2, const char *ints, const char *lang)
 {
 	/* XXX Merge with full version? XXX */
 	char fn[256] = "";
[...3262 lines suppressed...]
-		if (!res) {
-			snprintf(fn, sizeof(fn), "digits/day-%d", tm.tm_wday);
-			res = ast_streamfile(chan, fn, lang);
-			if (!res)
-				res = ast_waitstream(chan, ints);
-		}
-	} /* Otherwise, it was today */
+		snprintf(fn, sizeof(fn), "digits/day-%d", tm.tm_wday);
+		if (!res)
+			res = wait_file(chan, ints, fn, lang);
+	}	/* Otherwise, it was today */
+	snprintf(fn, sizeof(fn), "digits/pt-ah");
+	if (!res)
+		res = wait_file(chan, ints, fn, lang);
+	if (tm.tm_hour != 1)
+	if (!res)
+		res = wait_file(chan, ints, "digits/pt-sss", lang);
 	if (!res)
 		res = ast_say_time(chan, t, ints, lang);
 	return res;




More information about the svn-commits mailing list