[asterisk-commits] tilghman: branch 1.6.0 r160228 - in /branches/1.6.0: ./ apps/ channels/ inclu...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Dec 1 18:57:32 CST 2008


Author: tilghman
Date: Mon Dec  1 18:57:31 2008
New Revision: 160228

URL: http://svn.digium.com/view/asterisk?view=rev&rev=160228
Log:
Merged revisions 160208 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
  r160208 | tilghman | 2008-12-01 18:37:21 -0600 (Mon, 01 Dec 2008) | 10 lines
  
  Merged revisions 160207 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.4
  
  ........
    r160207 | tilghman | 2008-12-01 18:25:16 -0600 (Mon, 01 Dec 2008) | 3 lines
    
    Ensure that Asterisk builds with --enable-dev-mode, even on the latest gcc
    and glibc.
  ........
................

Modified:
    branches/1.6.0/   (props changed)
    branches/1.6.0/apps/app_voicemail.c
    branches/1.6.0/channels/chan_features.c
    branches/1.6.0/include/asterisk/stringfields.h
    branches/1.6.0/main/cli.c
    branches/1.6.0/main/frame.c
    branches/1.6.0/main/pbx.c

Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.0/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/apps/app_voicemail.c?view=diff&rev=160228&r1=160227&r2=160228
==============================================================================
--- branches/1.6.0/apps/app_voicemail.c (original)
+++ branches/1.6.0/apps/app_voicemail.c Mon Dec  1 18:57:31 2008
@@ -2524,7 +2524,9 @@
 							}
 						}
 					}
-					truncate(full_fn, fdlen);
+					if (truncate(full_fn, fdlen) < 0) {
+						ast_log(LOG_WARNING, "Unable to truncate '%s': %s\n", full_fn, strerror(errno));
+					}
 				}
 			} else {
 				SQLLEN ind;

Modified: branches/1.6.0/channels/chan_features.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/channels/chan_features.c?view=diff&rev=160228&r1=160227&r2=160228
==============================================================================
--- branches/1.6.0/channels/chan_features.c (original)
+++ branches/1.6.0/channels/chan_features.c Mon Dec  1 18:57:31 2008
@@ -451,7 +451,11 @@
 	for (x=1;x<4;x++) {
 		if (b2)
 			ast_free(b2);
-		asprintf(&b2, "%s/%s-%d", p->tech, p->dest, x);
+		if (asprintf(&b2, "%s/%s-%d", p->tech, p->dest, x) < 0) {
+			ast_log(LOG_WARNING, "Unable to create channel name: %s\n", strerror(errno));
+			b2 = NULL;
+			continue;
+		}
 		for (y=0;y<3;y++) {
 			if (y == index)
 				continue;

Modified: branches/1.6.0/include/asterisk/stringfields.h
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/include/asterisk/stringfields.h?view=diff&rev=160228&r1=160227&r2=160228
==============================================================================
--- branches/1.6.0/include/asterisk/stringfields.h (original)
+++ branches/1.6.0/include/asterisk/stringfields.h Mon Dec  1 18:57:31 2008
@@ -255,12 +255,16 @@
 	const char *__d__ = (data);				\
 	size_t __dlen__ = (__d__) ? strlen(__d__) + 1 : 1;	\
 	const char **__p__ = (const char **) (ptr);		\
+	char *__q__; \
 	if (__dlen__ == 1)					\
 		*__p__ = __ast_string_field_empty;		\
-	else if (!__ast_string_field_ptr_grow(&(x)->__field_mgr, __dlen__, ptr)) \
-		memcpy((char *) *__p__, __d__, __dlen__);	\
-	else if ((*__p__ = __ast_string_field_alloc_space(&(x)->__field_mgr, &(x)->__field_mgr_pool, __dlen__))) \
-		memcpy((char *) *__p__, __d__, __dlen__);	\
+	else if (!__ast_string_field_ptr_grow(&(x)->__field_mgr, __dlen__, ptr)) { \
+		__q__ = (char *) *__p__; \
+		memcpy(__q__, __d__, __dlen__);	\
+	} else if ((*__p__ = __ast_string_field_alloc_space(&(x)->__field_mgr, &(x)->__field_mgr_pool, __dlen__))) { \
+		__q__ = (char *) *__p__; \
+		memcpy(__q__, __d__, __dlen__);	\
+	} \
 	} while (0)
 
 /*!

Modified: branches/1.6.0/main/cli.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/main/cli.c?view=diff&rev=160228&r1=160227&r2=160228
==============================================================================
--- branches/1.6.0/main/cli.c (original)
+++ branches/1.6.0/main/cli.c Mon Dec  1 18:57:31 2008
@@ -1426,7 +1426,8 @@
 		e->_full_cmd = NULL;
 		if (e->handler) {
 			/* this is a new-style entry. Reset fields and free memory. */
-			memset((char **)(e->cmda), '\0', sizeof(e->cmda));
+			char *cmda = (char *) e->cmda;
+			memset(cmda, '\0', sizeof(e->cmda));
 			ast_free(e->command);
 			e->command = NULL;
 			e->usage = NULL;

Modified: branches/1.6.0/main/frame.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/main/frame.c?view=diff&rev=160228&r1=160227&r2=160228
==============================================================================
--- branches/1.6.0/main/frame.c (original)
+++ branches/1.6.0/main/frame.c Mon Dec  1 18:57:31 2008
@@ -474,9 +474,12 @@
 		memcpy(out->data, f->data, out->datalen);	
 	}
 	if (srclen > 0) {
+		/* This may seem a little strange, but it's to avoid a gcc (4.2.4) compiler warning */
+		char *src;
 		out->src = buf + sizeof(*out) + AST_FRIENDLY_OFFSET + f->datalen;
+		src = (char *) out->src;
 		/* Must have space since we allocated for it */
-		strcpy((char *)out->src, f->src);
+		strcpy(src, f->src);
 	}
 	ast_copy_flags(out, f, AST_FRFLAG_HAS_TIMING_INFO);
 	out->ts = f->ts;

Modified: branches/1.6.0/main/pbx.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/main/pbx.c?view=diff&rev=160228&r1=160227&r2=160228
==============================================================================
--- branches/1.6.0/main/pbx.c (original)
+++ branches/1.6.0/main/pbx.c Mon Dec  1 18:57:31 2008
@@ -6347,14 +6347,19 @@
 {
 	struct ast_ignorepat *ignorepat, *ignorepatc, *ignorepatl = NULL;
 	int length;
+	char *pattern;
 	length = sizeof(struct ast_ignorepat);
 	length += strlen(value) + 1;
 	if (!(ignorepat = ast_calloc(1, length)))
 		return -1;
 	/* The cast to char * is because we need to write the initial value.
-	 * The field is not supposed to be modified otherwise
+	 * The field is not supposed to be modified otherwise.  Also, gcc 4.2
+	 * sees the cast as dereferencing a type-punned pointer and warns about
+	 * it.  This is the workaround (we're telling gcc, yes, that's really
+	 * what we wanted to do).
 	 */
-	strcpy((char *)ignorepat->pattern, value);
+	pattern = (char *) ignorepat->pattern;
+	strcpy(pattern, value);
 	ignorepat->next = NULL;
 	ignorepat->registrar = registrar;
 	ast_wrlock_context(con);




More information about the asterisk-commits mailing list