[asterisk-commits] russell: trunk r75163 - /trunk/funcs/func_iconv.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Jul 15 21:44:49 CDT 2007


Author: russell
Date: Sun Jul 15 21:44:49 2007
New Revision: 75163

URL: http://svn.digium.com/view/asterisk?view=rev&rev=75163
Log:
Cast the 2nd argument to iconv() to a void *, as some systems define it as a
(const char *), while others define it as (char *).  This is done to suppress
compiler warnings about it.

Modified:
    trunk/funcs/func_iconv.c

Modified: trunk/funcs/func_iconv.c
URL: http://svn.digium.com/view/asterisk/trunk/funcs/func_iconv.c?view=diff&rev=75163&r1=75162&r2=75163
==============================================================================
--- trunk/funcs/func_iconv.c (original)
+++ trunk/funcs/func_iconv.c Sun Jul 15 21:44:49 2007
@@ -47,6 +47,13 @@
 #include "asterisk/app.h"
 #include "asterisk/options.h"
 
+/*! 
+ * Some systems define the second arg to iconv() as (const char *),
+ * while others define it as (char *).  Cast it to a (void *) to 
+ * suppress compiler warnings about it. 
+ */
+#define AST_ICONV_CAST void *
+
 static int iconv_read(struct ast_channel *chan, const char *cmd, char *arguments, char *buf, size_t len)
 {
 	AST_DECLARE_APP_ARGS(args,
@@ -82,7 +89,7 @@
 		return -1;
 	}
 
-	if (iconv(cd, &args.text, &incount, &buf, &outcount) == (size_t) -1) {
+	if (iconv(cd, (AST_ICONV_CAST) &args.text, &incount, &buf, &outcount) == (size_t) -1) {
 		if (errno == E2BIG)
 			ast_log(LOG_WARNING, "Iconv: output buffer too small.\n");
 		else if (errno == EILSEQ)




More information about the asterisk-commits mailing list