]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
Fix -Wdeclaration-after-statement warnings.
authorAndre Noll <maan@systemlinux.org>
Sat, 29 Nov 2008 21:20:47 +0000 (22:20 +0100)
committerAndre Noll <maan@systemlinux.org>
Sat, 29 Nov 2008 21:20:47 +0000 (22:20 +0100)
This option is new in gcc-4, so do not activate it by default.

Makefile.in
aacdec.c
aft.c
alsa_write.c
attribute.c
file_write.c
mp3dec.c
osl.c
rbtree.c
string.c

index 05af6da8e58588ef842cc3549e7d8bd8e67f7ca6..3831e1c461ca38be977ce7128376e4f6872161cc 100644 (file)
@@ -23,6 +23,7 @@ DEBUG_CPPFLAGS += -Wredundant-decls
 # invalid option for gcc-3.3.3
 # DEBUG_CPPFLAGS += -Wextra
 # DEBUG_CPPFLAGS += -Wold-style-definition
+# DEBUG_CPPFLAGS += -Wdeclaration-after-statement
 
 # many warnings about trivial stuff
 # CPPFLAGS += -Wconversion
index 235b292d33168d74150bb8534f03caa0a365ce64..4c256946cca74ab5719b4b245cb886940ba4eea0 100644 (file)
--- a/aacdec.c
+++ b/aacdec.c
@@ -157,9 +157,9 @@ out:
 
 static void aacdec_open(struct filter_node *fn)
 {
-       fn->private_data = para_calloc(sizeof(struct private_aacdec_data));
-       struct private_aacdec_data *padd = fn->private_data;
+       struct private_aacdec_data *padd = para_calloc(sizeof(*padd));
 
+       fn->private_data = padd;
        fn->bufsize = AAC_OUTBUF_SIZE;
        fn->buf = para_calloc(fn->bufsize);
        padd->handle = aac_open();
diff --git a/aft.c b/aft.c
index 2d40c235df8cf51fab7c2134e6bce1499769c9bf..90989284df90cac401a056b7af1d6d7c05c2a27f 100644 (file)
--- a/aft.c
+++ b/aft.c
@@ -588,8 +588,6 @@ int get_afhi_of_row(const struct osl_row *row, struct afh_info *afhi)
 static int save_afd(struct audio_file_data *afd)
 {
        size_t size = sizeof(*afd) + sizeof_chunk_table(&afd->afhi);
-
-       PARA_DEBUG_LOG("size: %zu\n", size);
        int shmid, ret = shm_new(size);
        void *shm_afd;
        char *buf;
@@ -1599,6 +1597,7 @@ static void com_add_callback(int fd, const struct osl_object *query)
        struct afs_info default_afsi = {.last_played = 0};
        struct para_buffer msg = {.max_size = SHMMAX,
                .max_size_handler = pass_buffer_as_shm, .private_data = &fd};
+       uint16_t afhi_offset, chunks_offset;
 
        hash = (HASH_TYPE *)buf + CAB_HASH_OFFSET;
        hash_to_asc(hash, asc);;
@@ -1653,8 +1652,8 @@ static void com_add_callback(int fd, const struct osl_object *query)
                        goto out;
        }
        /* no hs or force mode, child must have sent afhi */
-       uint16_t afhi_offset = read_u16(buf + CAB_AFHI_OFFSET_POS);
-       uint16_t chunks_offset = read_u16(buf + CAB_CHUNKS_OFFSET_POS);
+       afhi_offset = read_u16(buf + CAB_AFHI_OFFSET_POS);
+       chunks_offset = read_u16(buf + CAB_CHUNKS_OFFSET_POS);
 
        objs[AFTCOL_AFHI].data = buf + afhi_offset;
        objs[AFTCOL_AFHI].size = chunks_offset - afhi_offset;
@@ -2304,10 +2303,6 @@ static void com_cpsi_callback(int fd, const struct osl_object *query)
        };
        int ret;
        char *source_path = (char *)query->data + sizeof(cad.flags);
-
-       ret = get_afsi_of_path(source_path, &cad.source_afsi);
-       if (ret < 0)
-               goto out;
        struct pattern_match_data pmd = {
                .table = audio_file_table,
                .loop_col_num = AFTCOL_HASH,
@@ -2318,6 +2313,10 @@ static void com_cpsi_callback(int fd, const struct osl_object *query)
                .data = &cad,
                .action = copy_selector_info
        };
+
+       ret = get_afsi_of_path(source_path, &cad.source_afsi);
+       if (ret < 0)
+               goto out;
        ret = for_each_matching_row(&pmd);
 out:
        if (ret < 0)
index cfae4fb9e20b322e36764d92806ba9f842ed1b0a..89d1995caccc24ecc8f988dff8d5862c56ad0b69 100644 (file)
@@ -212,10 +212,12 @@ static void alsa_close(struct writer_node *wn)
 
 __malloc static void *alsa_parse_config(const char *options)
 {
+       int ret;
        struct alsa_write_args_info *conf
                = para_calloc(sizeof(struct alsa_write_args_info));
+
        PARA_INFO_LOG("options: %s, %zd\n", options, strcspn(options, " \t"));
-       int ret = alsa_cmdline_parser_string(options, conf, "alsa_write");
+       ret = alsa_cmdline_parser_string(options, conf, "alsa_write");
        if (ret)
                goto err_out;
        PARA_INFO_LOG("help given: %d\n", conf->help_given);
index e7fba9021d29fc19fcc7ad0d09534c65914d3a56..24a3826d3e051c4cdee6675d01466c12fd9d3d1b 100644 (file)
@@ -301,9 +301,9 @@ static void com_addatt_callback(int fd, const struct osl_object *query)
                struct osl_object objs[NUM_ATT_COLUMNS];
                struct osl_row *row;
                unsigned char bitnum;
-               len = strlen(p);
                struct addatt_event_data aed;
 
+               len = strlen(p);
                if (!len || p[len - 1] == '-' || p[len - 1] == '+') {
                        ret2 = para_printf(&pb, "invalid attribute name: %s\n", p);
                        if (ret2 < 0)
index d7cea2f9efd8aa1d0922b4a9442d2126462dd1e8..839515f88ada154bcabc9d89b4a0f274d5911a94 100644 (file)
@@ -95,10 +95,10 @@ static void file_write_close(struct writer_node *wn)
 
 __malloc static void *file_write_parse_config(const char *options)
 {
-       PARA_INFO_LOG("options: %s\n", options);
        struct file_write_args_info *conf
                = para_calloc(sizeof(struct file_write_args_info));
        int ret = file_cmdline_parser_string(options, conf, "file_write");
+
        PARA_INFO_LOG("conf->filename_given: %d\n", conf->filename_given);
        if (!ret)
                return conf;
index 615a06400a58f34408ffef12a7b0be436b51a026..0006a181aa29676cc7ae5aaf00238b99da6c3768 100644 (file)
--- a/mp3dec.c
+++ b/mp3dec.c
@@ -108,9 +108,9 @@ static void mp3dec_close(struct filter_node *fn)
 
 static void mp3dec_open(struct filter_node *fn)
 {
-       fn->private_data = para_calloc(sizeof(struct private_mp3dec_data));
-       struct private_mp3dec_data *pmd = fn->private_data;
+       struct private_mp3dec_data *pmd = para_calloc(sizeof(*pmd));
 
+       fn->private_data = pmd;
        mad_stream_init(&pmd->stream);
        mad_frame_init(&pmd->frame);
        mad_synth_init(&pmd->synth);
diff --git a/osl.c b/osl.c
index f06d4ba3fafa061a4e49e5d34c32648949282ff3..2aee5b6aa6e1b9e9f9361bb920933c305e0e9b5a 100644 (file)
--- a/osl.c
+++ b/osl.c
@@ -31,8 +31,9 @@
  */
 int para_lseek(int fd, off_t *offset, int whence)
 {
-       *offset = lseek(fd, *offset, whence);
        int ret = -E_LSEEK;
+
+       *offset = lseek(fd, *offset, whence);
        if (*offset == -1)
                return ret;
        return 1;
@@ -1447,8 +1448,10 @@ int osl_add_and_get_row(struct osl_table *t, struct osl_object *objects,
        goto out;
 rollback: /* rollback all changes made, ignore further errors */
        for (i--; i >= 0; i--) {
+               enum osl_storage_type st;
+
                cd = get_column_description(t->desc, i);
-               enum osl_storage_type st = cd->storage_type;
+               st = cd->storage_type;
                if (st == OSL_NO_STORAGE)
                        continue;
 
index 5d24aeb5063a788215eca93a73698f50a68b0bc2..95bcee398d7d04b869479529f8b1c3b5eb72c516 100644 (file)
--- a/rbtree.c
+++ b/rbtree.c
@@ -438,9 +438,9 @@ struct rb_node *rb_nth(struct rb_node *node, unsigned n)
  */
 int rb_rank(struct rb_node *node, unsigned *rank)
 {
-       *rank = 1;
        struct rb_node *parent;
 
+       *rank = 1;
        if (!node)
                return -1;
        if (node->rb_left)
index 752fb8f945d1a381b7b7af4e65ed56b646df8d47..d23e43c1eecb1d34e4eaefda77423da076ab412a 100644 (file)
--- a/string.c
+++ b/string.c
@@ -59,9 +59,10 @@ __must_check __malloc void *para_realloc(void *p, size_t size)
  */
 __must_check __malloc void *para_malloc(size_t size)
 {
-       assert(size);
-       void *p = malloc(size);
+       void *p;
 
+       assert(size);
+       p = malloc(size);
        if (!p) {
                PARA_EMERG_LOG("malloc failed (size = %zu),  aborting\n",
                        size);