From: Andre Noll Date: Sat, 6 Aug 2011 12:32:30 +0000 (+0200) Subject: Merge branch 't/osx_overhaul' X-Git-Tag: v0.4.8~22 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=8a61aff04fa2e8860f7fd3969d58d77c0292155a;hp=df75e667de863db0a3ff9bbc546562721718f511 Merge branch 't/osx_overhaul' --- diff --git a/Makefile.in b/Makefile.in index 7e6287e0..5016b065 100644 --- a/Makefile.in +++ b/Makefile.in @@ -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 57ef197b..5105798f 100644 --- 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 a27e67ee..f4080233 100644 --- 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; } diff --git a/alsa_write.c b/alsa_write.c index 1c168e7b..6850221a 100644 --- a/alsa_write.c +++ b/alsa_write.c @@ -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: diff --git a/audiod.c b/audiod.c index eff58fda..c7998cdb 100644 --- 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(); diff --git a/audiod_command.c b/audiod_command.c index a0d0229d..1c22f58b 100644 --- a/audiod_command.c +++ b/audiod_command.c @@ -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) diff --git a/client_common.c b/client_common.c index 865a1797..eb9f9e1f 100644 --- a/client_common.c +++ b/client_common.c @@ -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; } diff --git a/command.c b/command.c index d82bd5d7..69bbbb74 100644 --- 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(¤t_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); diff --git a/fecdec_filter.c b/fecdec_filter.c index fb2dba02..09a2fabd 100644 --- a/fecdec_filter.c +++ b/fecdec_filter.c @@ -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 2f720b10..ae596e5a 100644 --- 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; diff --git a/web/manual.m4 b/web/manual.m4 index 2af59f53..3d5bc2ee 100644 --- a/web/manual.m4 +++ b/web/manual.m4 @@ -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