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
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.
--------------------------------------
0.4.7 (2011-06-01) "infinite rollback"
}
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;
}
snd_pcm_prepare(pad->handle);
return;
}
- if (frames == -EAGAIN)
- return;
PARA_WARNING_LOG("%s\n", snd_strerror(-frames));
ret = -E_ALSA_WRITE;
err:
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);
}
free(pb.buf);
free(pfpb.buf);
-// if (num_clients)
-// PARA_DEBUG_LOG("%d client(s)\n", num_clients);
}
/**
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] != '-')
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)
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);
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);
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;
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++) {
btr_copy(fg->data[i], n, pfd->btrp, fn->btrn);
written += n;
}
- p += written;
return 0;
}
* \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;