aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2008-12-02 00:58:43 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2008-12-02 00:58:43 +0000
commit3b31fc37af23c0e21791a6c9b813a3aa7a10072b (patch)
treef28aa4e6b7b5ea3cb18081165df37c7bd0ef9c16
parentb6affabc9ef8c64b3f5a542507f2df2f71e9625a (diff)
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. ........ ................ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.1@160234 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--apps/app_voicemail.c4
-rw-r--r--channels/chan_features.c6
-rw-r--r--include/asterisk/stringfields.h12
-rw-r--r--main/cli.c3
-rw-r--r--main/frame.c5
-rw-r--r--main/pbx.c9
6 files changed, 29 insertions, 10 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index b43406ddf..5a33a4a6e 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -2844,7 +2844,9 @@ static int retrieve_file(char *dir, int msgnum)
}
}
}
- 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 {
res = SQLGetData(stmt, x + 1, SQL_CHAR, rowdata, sizeof(rowdata), NULL);
diff --git a/channels/chan_features.c b/channels/chan_features.c
index 3c41eb73e..991cccf5f 100644
--- a/channels/chan_features.c
+++ b/channels/chan_features.c
@@ -449,7 +449,11 @@ static struct ast_channel *features_new(struct feature_pvt *p, int state, int id
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 == idx)
continue;
diff --git a/include/asterisk/stringfields.h b/include/asterisk/stringfields.h
index 4b1847415..20597a591 100644
--- a/include/asterisk/stringfields.h
+++ b/include/asterisk/stringfields.h
@@ -255,12 +255,16 @@ int __ast_string_field_init(struct ast_string_field_mgr *mgr,
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)
/*!
diff --git a/main/cli.c b/main/cli.c
index f0a089068..f6982ad68 100644
--- a/main/cli.c
+++ b/main/cli.c
@@ -1426,7 +1426,8 @@ static int __ast_cli_unregister(struct ast_cli_entry *e, struct ast_cli_entry *e
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;
diff --git a/main/frame.c b/main/frame.c
index 35bb47fff..8c0982b8c 100644
--- a/main/frame.c
+++ b/main/frame.c
@@ -478,9 +478,12 @@ struct ast_frame *ast_frdup(const struct ast_frame *f)
memcpy(out->data.ptr, f->data.ptr, 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 34771d1ea..6ff14b3ea 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -6557,14 +6557,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_wrlock_context(con);