]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Ensure that Asterisk builds with --enable-dev-mode, even on the latest gcc
authorTilghman Lesher <tilghman@meg.abyt.es>
Tue, 2 Dec 2008 00:25:16 +0000 (00:25 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Tue, 2 Dec 2008 00:25:16 +0000 (00:25 +0000)
and glibc.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@160207 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_voicemail.c
include/asterisk/stringfields.h
main/frame.c
main/pbx.c

index fdb848cec2955093c470e3925b39f0cf359d7677..8fdbd3696577af1ab5c01917e7c9e00f9631556c 100644 (file)
@@ -2287,7 +2287,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 {
                                SQLLEN ind;
index 97e65532da6bd2cf9c1f8fd803f81ff79f3b8830..ac9481156ddcf64ee89a516564bb29b9d462651c 100644 (file)
@@ -242,8 +242,10 @@ void __ast_string_field_index_build_va(struct ast_string_field_mgr *mgr,
       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)
index 6768d0a98858a986f3d198a776e98ea1b319ce1d..b73782096b91f66050628a423ebb896bc691d988 100644 (file)
@@ -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;
index 99ecee92b71b46ce36fecdef53cf2e951c183254..293705c0207aa9e8e357f2d9d6a73abb211f993a 100644 (file)
@@ -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);