[svn-commits] tilghman: branch 1.4 r160207 - in /branches/1.4: apps/ include/asterisk/ main/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Dec 1 18:25:16 CST 2008


Author: tilghman
Date: Mon Dec  1 18:25:16 2008
New Revision: 160207

URL: http://svn.digium.com/view/asterisk?view=rev&rev=160207
Log:
Ensure that Asterisk builds with --enable-dev-mode, even on the latest gcc
and glibc.

Modified:
    branches/1.4/apps/app_voicemail.c
    branches/1.4/include/asterisk/stringfields.h
    branches/1.4/main/frame.c
    branches/1.4/main/pbx.c

Modified: branches/1.4/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/apps/app_voicemail.c?view=diff&rev=160207&r1=160206&r2=160207
==============================================================================
--- branches/1.4/apps/app_voicemail.c (original)
+++ branches/1.4/apps/app_voicemail.c Mon Dec  1 18:25:16 2008
@@ -2287,7 +2287,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.4/include/asterisk/stringfields.h
URL: http://svn.digium.com/view/asterisk/branches/1.4/include/asterisk/stringfields.h?view=diff&rev=160207&r1=160206&r2=160207
==============================================================================
--- branches/1.4/include/asterisk/stringfields.h (original)
+++ branches/1.4/include/asterisk/stringfields.h Mon Dec  1 18:25:16 2008
@@ -242,8 +242,10 @@
       if ((__zz__[0] != 0) && (__dlen__ <= (strlen(__zz__) + 1))) { \
         memcpy(__zz__, data, __dlen__); \
       } else { \
-        if (((x)->__begin_field[index] = __ast_string_field_alloc_space(&(x)->__field_mgr, __dlen__, &(x)->__begin_field[0], ast_string_field_count(x)))) \
-          memcpy((char*) (x)->__begin_field[index], data, __dlen__); \
+        if (((x)->__begin_field[index] = __ast_string_field_alloc_space(&(x)->__field_mgr, __dlen__, &(x)->__begin_field[0], ast_string_field_count(x)))) { \
+          char *__yy__ = (char *) (x)->__begin_field[index]; \
+          memcpy(__yy__, data, __dlen__); \
+        } \
       } \
      } \
    } while (0)

Modified: branches/1.4/main/frame.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/frame.c?view=diff&rev=160207&r1=160206&r2=160207
==============================================================================
--- branches/1.4/main/frame.c (original)
+++ branches/1.4/main/frame.c Mon Dec  1 18:25:16 2008
@@ -490,9 +490,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.4/main/pbx.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/pbx.c?view=diff&rev=160207&r1=160206&r2=160207
==============================================================================
--- branches/1.4/main/pbx.c (original)
+++ branches/1.4/main/pbx.c Mon Dec  1 18:25:16 2008
@@ -4494,14 +4494,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_mutex_lock(&con->lock);




More information about the svn-commits mailing list