]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
Merge branch 't/osx_overhaul'
authorAndre Noll <maan@systemlinux.org>
Sat, 6 Aug 2011 12:32:30 +0000 (14:32 +0200)
committerAndre Noll <maan@systemlinux.org>
Sat, 6 Aug 2011 12:35:29 +0000 (14:35 +0200)
Makefile.in
NEWS
aft.c
alsa_write.c
audiod.c
audiod_command.c
client_common.c
command.c
fecdec_filter.c
net.c
web/manual.m4

index 7e6287e0d0ff72e1e6842535d8f665db70068e0b..5016b065b85d9c36dccff605b4d8e8519a745610 100644 (file)
@@ -19,9 +19,9 @@ codename := nested assignment
 
 GIT_VERSION := $(shell ./GIT-VERSION-GEN git-version.h)
 
-DEBUG_CPPFLAGS += -Wno-sign-compare -g -Wunused -Wundef -W
+DEBUG_CPPFLAGS += -g -Wunused -Wundef -W
 DEBUG_CPPFLAGS += -Wredundant-decls
-DEBUG_CPPFLAGS += -Wall
+DEBUG_CPPFLAGS += -Wall -Wno-sign-compare -Wno-unknown-pragmas
 DEBUG_CPPFLAGS += -Wformat-security
 DEBUG_CPPFLAGS += -Wmissing-format-attribute
 # produces false positives
diff --git a/NEWS b/NEWS
index 57ef197ba3e9dbba332ec208c43d90f48cfd5040..5105798f57fabc447fdc2c3630cb8363a6c7486b 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,8 @@
          writers is now treated as a regular expression. This allows
          to replace 5 lines in the config file (one for each audio
          format) by one single line. See the manual for details.
+       - Compiles cleanly also with llvm/clang.
+       - Rewrite of the osx writer (output plugin for Mac OS).
 
 --------------------------------------
 0.4.7 (2011-06-01) "infinite rollback"
diff --git a/aft.c b/aft.c
index a27e67eeb7b438546573c254d76c4ed15cdf3750..f4080233855009be5423b3bc9325b861d5f20b0c 100644 (file)
--- a/aft.c
+++ b/aft.c
@@ -1823,7 +1823,7 @@ static void hash_sister_callback(int fd, const struct osl_object *query)
 static int get_row_pointer_from_result(struct osl_object *result, void *private)
 {
        struct osl_row **row = private;
-       *row = result->data;
+       *row = *(struct osl_row **)(result->data);
        return 1;
 }
 
index 1c168e7b4b037f8e8853681e02254879f0912640..6850221a83d861e04cfcd8254d3114f837013a2e 100644 (file)
@@ -253,7 +253,9 @@ again:
        }
        frames = bytes / pad->bytes_per_frame;
        frames = snd_pcm_writei(pad->handle, data, frames);
-       if (frames >= 0) {
+       if (frames == 0 || frames == -EAGAIN)
+               return;
+       if (frames > 0) {
                btr_consume(btrn, frames * pad->bytes_per_frame);
                goto again;
        }
@@ -262,8 +264,6 @@ again:
                snd_pcm_prepare(pad->handle);
                return;
        }
-       if (frames == -EAGAIN)
-               return;
        PARA_WARNING_LOG("%s\n", snd_strerror(-frames));
        ret = -E_ALSA_WRITE;
 err:
index eff58fda1b7ead6c327594afb60165a1bfde4fb1..c7998cdb7d02259b4e4da84353a2fdade8ec5584 100644 (file)
--- a/audiod.c
+++ b/audiod.c
@@ -1048,7 +1048,6 @@ static void close_stat_pipe(void)
 {
        if (!stat_task->ct)
                return;
-       btr_free_node(stat_task->ct->btrn);
        client_close(stat_task->ct);
        stat_task->ct = NULL;
        clear_and_dump_items();
index a0d0229d6973566296f0fc18b1aa987aacfd4c98..1c22f58b3eea76d91d89af50196c0fbed7c8ab31 100644 (file)
@@ -120,24 +120,22 @@ void stat_client_write_item(int item_num)
        struct para_buffer pb = {.flags = 0};
        struct para_buffer pfpb = {.flags = PBF_SIZE_PREFIX};
        const uint64_t one = 1;
+       char *msg = stat_item_values[item_num];
+       struct para_buffer *b;
 
        list_for_each_entry_safe(sc, tmp, &client_list, node) {
                int fd = sc->fd, ret;
 
                if (!((one << item_num) & sc->item_mask))
                        continue;
-               if (write_ok(fd) > 0) {
-                       struct para_buffer *b =
-                               (sc->flags & SCF_PARSER_FRIENDLY)? &pfpb : &pb;
-                       char *msg = stat_item_values[item_num];
-                       if (!b->buf)
-                               WRITE_STATUS_ITEM(b, item_num, "%s\n",
-                                       msg? msg : "");
-                       ret = write(fd, b->buf, b->offset);
-                       if (ret == b->offset)
-                               continue;
-               }
-               /* write error or fd not ready for writing */
+               b = (sc->flags & SCF_PARSER_FRIENDLY)? &pfpb : &pb;
+               if (!b->buf)
+                       (void)WRITE_STATUS_ITEM(b, item_num, "%s\n",
+                               msg? msg : "");
+               ret = write(fd, b->buf, b->offset);
+               if (ret == b->offset)
+                       continue;
+               /* write error or short write */
                close(fd);
                num_clients--;
                PARA_INFO_LOG("deleting client on fd %d\n", fd);
@@ -147,8 +145,6 @@ void stat_client_write_item(int item_num)
        }
        free(pb.buf);
        free(pfpb.buf);
-//     if (num_clients)
-//             PARA_DEBUG_LOG("%d client(s)\n", num_clients);
 }
 
 /**
@@ -307,6 +303,9 @@ int com_stat(int fd, int argc, char **argv)
        const uint64_t one = 1;
        struct para_buffer b = {.flags = 0};
 
+       ret = mark_fd_nonblocking(fd);
+       if (ret < 0)
+               return ret;
        for (i = 1; i < argc; i++) {
                const char *arg = argv[i];
                if (arg[0] != '-')
@@ -334,7 +333,7 @@ int com_stat(int fd, int argc, char **argv)
                char *item = stat_item_values[i];
                if (!((one << i) & mask))
                        continue;
-               WRITE_STATUS_ITEM(&b, i, "%s\n", item? item : "");
+               (void)WRITE_STATUS_ITEM(&b, i, "%s\n", item? item : "");
        }
        ret = client_write(fd, b.buf);
        if (ret >= 0)
index 865a1797bd81bbd7e6308278c08249890c1bf241..eb9f9e1fcda2a49ba960582ba67be9c882897a20 100644 (file)
@@ -44,6 +44,7 @@ void client_close(struct client_task *ct)
        free(ct->user);
        free(ct->config_file);
        free(ct->key_file);
+       btr_free_node(ct->btrn);
        client_cmdline_parser_free(&ct->conf);
        free(ct);
 }
@@ -418,7 +419,6 @@ out:
        if (ret < 0) {
                PARA_ERROR_LOG("%s\n", para_strerror(-ret));
                btr_remove_node(ct->btrn);
-               btr_free_node(ct->btrn);
                client_close(ct);
                *ct_ptr = NULL;
        }
index d82bd5d71ca3ed6bf2fa40777c5a5b1231fd897f..69bbbb74dd2831791e0f24378d7a4c4451bb6524 100644 (file)
--- a/command.c
+++ b/command.c
@@ -122,16 +122,22 @@ static char *get_status(struct misc_meta_data *nmmd, int parser_friendly)
                strftime(mtime, 29, "%b %d %Y", &mtime_tm);
        }
        gettimeofday(&current_time, NULL);
-       WRITE_STATUS_ITEM(&b, SI_FILE_SIZE, "%zu\n", nmmd->size / 1024);
-       WRITE_STATUS_ITEM(&b, SI_MTIME, "%s\n", mtime);
-       WRITE_STATUS_ITEM(&b, SI_STATUS, "%s\n", status);
-       WRITE_STATUS_ITEM(&b, SI_STATUS_FLAGS, "%s\n", flags);
-       WRITE_STATUS_ITEM(&b, SI_OFFSET, "%li\n", offset);
-       WRITE_STATUS_ITEM(&b, SI_AFS_MODE, "%s\n", mmd->afs_mode_string);
-       WRITE_STATUS_ITEM(&b, SI_STREAM_START, "%lu.%lu\n",
+       /*
+        * The calls to WRITE_STATUS_ITEM() below never fail because
+        * b->max_size is zero (unlimited), see para_printf(). However, clang
+        * is not smart enough to prove this and complains nevertheless.
+        * Casting the return value to void silences solves this.
+        */
+       (void)WRITE_STATUS_ITEM(&b, SI_FILE_SIZE, "%zu\n", nmmd->size / 1024);
+       (void)WRITE_STATUS_ITEM(&b, SI_MTIME, "%s\n", mtime);
+       (void)WRITE_STATUS_ITEM(&b, SI_STATUS, "%s\n", status);
+       (void)WRITE_STATUS_ITEM(&b, SI_STATUS_FLAGS, "%s\n", flags);
+       (void)WRITE_STATUS_ITEM(&b, SI_OFFSET, "%li\n", offset);
+       (void)WRITE_STATUS_ITEM(&b, SI_AFS_MODE, "%s\n", mmd->afs_mode_string);
+       (void)WRITE_STATUS_ITEM(&b, SI_STREAM_START, "%lu.%lu\n",
                (long unsigned)nmmd->stream_start.tv_sec,
                (long unsigned)nmmd->stream_start.tv_usec);
-       WRITE_STATUS_ITEM(&b, SI_CURRENT_TIME, "%lu.%lu\n",
+       (void)WRITE_STATUS_ITEM(&b, SI_CURRENT_TIME, "%lu.%lu\n",
                (long unsigned)current_time.tv_sec,
                (long unsigned)current_time.tv_usec);
        free(flags);
index fb2dba025d37806b2b70bd8f8002cae09e3e4db8..09a2fabd7bb418d7e94f8bea2cac4fb5d9826bfa 100644 (file)
@@ -291,7 +291,7 @@ static int decode_group(struct fecdec_group *fg, struct filter_node *fn)
        size_t written, need;
        struct private_fecdec_data *pfd = fn->private_data;
        enum fec_group_usability u = group_is_usable(fg, pfd);
-       char *buf = NULL, *p;
+       char *buf = NULL;
 
        if (u == FEC_GROUP_UNUSABLE) {
                PARA_INFO_LOG("dropping unusable group %d\n", fg->h.group_num);
@@ -315,7 +315,6 @@ static int decode_group(struct fecdec_group *fg, struct filter_node *fn)
        if (need > btr_pool_unused(pfd->btrp))
                return -E_FECDEC_OVERRUN;
        btr_pool_get_buffer(pfd->btrp, &buf);
-       p = buf;
        if (u == FEC_GROUP_USABLE_WITH_HEADER) {
                PARA_INFO_LOG("writing audio file header\n");
                written = 0;
@@ -328,7 +327,6 @@ static int decode_group(struct fecdec_group *fg, struct filter_node *fn)
                        btr_copy(fg->data[i], n, pfd->btrp, fn->btrn);
                        written += n;
                }
-               p += written;
        }
        written = 0;
        for (; i < fg->h.data_slices_per_group; i++) {
@@ -338,7 +336,6 @@ static int decode_group(struct fecdec_group *fg, struct filter_node *fn)
                btr_copy(fg->data[i], n, pfd->btrp, fn->btrn);
                written += n;
        }
-       p += written;
        return 0;
 }
 
diff --git a/net.c b/net.c
index 2f720b10477aee8214cac5a5223ca4378b29bd5f..ae596e5a7007260dd3a2954932f3927e88ea3bdd 100644 (file)
--- a/net.c
+++ b/net.c
@@ -607,8 +607,7 @@ int generic_max_transport_msg_size(int sockfd)
  * \sa getsockname(2), getpeername(2), parse_url(), getnameinfo(3),
  * services(5), nsswitch.conf(5).
  */
-static char *__get_sock_name(int fd, int (*getname)(int, struct sockaddr*,
-               socklen_t *))
+static char *__get_sock_name(int fd, typeof(getsockname) getname)
 {
        struct sockaddr_storage ss;
        const struct sockaddr *sa;
index 2af59f5376b4ecfadc6ce12a38b5781698b276ce..3d5bc2ee6327f754b2da031c928c091d8fa049d3 100644 (file)
@@ -202,9 +202,10 @@ In any case you'll need
 
        git clone git://git.tuebingen.mpg.de/osl
 
-       - XREFERENCE(ftp://ftp.gnu.org/pub/gnu/gcc, gcc). The
-       EMPH(gnu compiler collection) is usually shipped with the
-       distro. gcc-3.3 or newer is required.
+       - XREFERENCE(ftp://ftp.gnu.org/pub/gnu/gcc, gcc) or
+       XREFERENCE(http://clang.llvm.org, clang). All gcc versions
+       >= 3.3 are currently supported. Clang version 1.1 or newer
+       should work as well.
 
        - XREFERENCE(ftp://ftp.gnu.org/pub/gnu/make, gnu make) is
        also shipped with the disto. On BSD systems the gnu make