diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-12-02 00:25:16 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-12-02 00:25:16 +0000 |
commit | 847b7a6236a517d52f4dbc673ef5adce6723eb36 (patch) | |
tree | 95d74d9cf050fbc9d2aeb9a473f27065fe72f0b3 /main | |
parent | 0b308eadda9bab5ec24952f15405cd60b3b9b62b (diff) |
Ensure that Asterisk builds with --enable-dev-mode, even on the latest gcc
and glibc.
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@160207 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r-- | main/frame.c | 5 | ||||
-rw-r--r-- | main/pbx.c | 9 |
2 files changed, 11 insertions, 3 deletions
diff --git a/main/frame.c b/main/frame.c index 6768d0a98..b73782096 100644 --- a/main/frame.c +++ b/main/frame.c @@ -490,9 +490,12 @@ struct ast_frame *ast_frdup(const struct ast_frame *f) 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; diff --git a/main/pbx.c b/main/pbx.c index 99ecee92b..293705c02 100644 --- a/main/pbx.c +++ b/main/pbx.c @@ -4494,14 +4494,19 @@ int ast_context_add_ignorepat2(struct ast_context *con, const char *value, const { 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); |