From: Andre Noll Date: Fri, 23 Jan 2015 12:17:10 +0000 (+0100) Subject: Merge branch 'refs/heads/t/tarball-build-fix' X-Git-Tag: v0.5.4~2 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=56d75bd90d78cf44cd3984ce2a45627ef5646d38;hp=95287575857a96b049b5e7faeb03fd36c3a9df07 Merge branch 'refs/heads/t/tarball-build-fix' --- diff --git a/Makefile.real b/Makefile.real index 440220ce..6c7b38f2 100644 --- a/Makefile.real +++ b/Makefile.real @@ -188,7 +188,8 @@ error2.h: $(hostbin_dir)/error2 config.h $(object_dir)/%.o: %.c | $(object_dir) $(object_dir)/opus%.o $(dep_dir)/opus%.d: CPPFLAGS += $(opus_cppflags) -$(object_dir)/gui%.o $(dep_dir)/gui%.d: CPPFLAGS += $(curses_cppflags) +$(object_dir)/gui.o $(object_dir)/gui%.o $(dep_dir)/gui%.d \ +: CPPFLAGS += $(curses_cppflags) $(object_dir)/spx%.o $(dep_dir)/spx%.d: CPPFLAGS += $(speex_cppflags) $(object_dir)/flac%.o $(dep_dir)/flac%.d: CPPFLAGS += $(flac_cppflags) diff --git a/aft.c b/aft.c index c61d3820..727292c7 100644 --- a/aft.c +++ b/aft.c @@ -829,8 +829,8 @@ static int print_chunk_table(struct ls_data *d, struct para_buffer *b) ret = aft_get_row_of_hash(d->hash, &aft_row); if (ret < 0) return ret; - ret = osl_open_disk_object(audio_file_table, aft_row, - AFTCOL_CHUNKS, &chunk_table_obj); + ret = osl(osl_open_disk_object(audio_file_table, aft_row, + AFTCOL_CHUNKS, &chunk_table_obj)); if (ret < 0) return ret; ret = para_printf(b, "%s\n" @@ -1105,10 +1105,10 @@ int open_and_update_audio_file(struct osl_row *aft_row, long score, if (ret < 0) return ret; afd->afhi.chunk_table = NULL; - ret = osl_open_disk_object(audio_file_table, aft_row, - AFTCOL_CHUNKS, &chunk_table_obj); + ret = osl(osl_open_disk_object(audio_file_table, aft_row, + AFTCOL_CHUNKS, &chunk_table_obj)); if (ret < 0) - goto err; + return ret; ret = mmap_full_file(path, O_RDONLY, &map.data, &map.size, &afd->fd); if (ret < 0) goto err; @@ -1716,10 +1716,11 @@ static void com_add_callback(int fd, const struct osl_object *query) struct osl_object obj; if (pb) { /* hs trumps pb, remove pb */ if (flags & ADD_FLAG_VERBOSE) { - ret = para_printf(&msg, "removing path brother\n"); + ret = para_printf(&msg, "removing %s\n", path); if (ret < 0) goto out; } + afs_event(AUDIO_FILE_REMOVE, &msg, pb); ret = osl(osl_del_row(audio_file_table, pb)); if (ret < 0) goto out; diff --git a/blob.c b/blob.c index 3f7c48da..7aedf59b 100644 --- a/blob.c +++ b/blob.c @@ -645,7 +645,7 @@ static int blob_get_name_and_def_by_row(struct osl_table *table, static int table_name ## _create(const char *dir) \ { \ table_name ## _table_desc.dir = dir; \ - return osl_create_table(&table_name ## _table_desc); \ + return osl(osl_create_table(&table_name ## _table_desc)); \ } static int blob_open(struct osl_table **table, diff --git a/client_common.c b/client_common.c index f615bb72..b47364c9 100644 --- a/client_common.c +++ b/client_common.c @@ -159,7 +159,10 @@ again: } if (n == 0) return 0; - if (!sb_received(ct->sbc[0], n, result)) + ret = sb_received(ct->sbc[0], n, result); + if (ret < 0) + return ret; + if (ret == 0) goto again; ct->sbc[0] = NULL; return 1; diff --git a/command.c b/command.c index 43f85ca6..2ef9c5a8 100644 --- a/command.c +++ b/command.c @@ -419,6 +419,7 @@ static int com_version(struct command_context *cc) return send_sb(&cc->scc, msg, len, SBD_OUTPUT, false); } +/** These status items are cleared if no audio file is currently open. */ #define EMPTY_STATUS_ITEMS \ ITEM(PATH) \ ITEM(DIRECTORY) \ @@ -445,7 +446,11 @@ static int com_version(struct command_context *cc) ITEM(YEAR) \ ITEM(ALBUM) \ ITEM(COMMENT) \ - ITEM(AMPLIFICATION) + ITEM(MTIME) \ + ITEM(FILE_SIZE) \ + ITEM(CHUNK_TIME) \ + ITEM(NUM_CHUNKS) \ + ITEM(AMPLIFICATION) \ /** * Write a list of audio-file related status items with empty values. diff --git a/fd.c b/fd.c index 456476e5..ceff71f5 100644 --- a/fd.c +++ b/fd.c @@ -144,6 +144,7 @@ __printf_2_3 int write_va_buffer(int fd, const char *fmt, ...) va_start(ap, fmt); ret = xvasprintf(&msg, fmt, ap); + va_end(ap); ret = write_all(fd, msg, ret); free(msg); return ret; diff --git a/gui.c b/gui.c index 552b625b..370c731c 100644 --- a/gui.c +++ b/gui.c @@ -659,7 +659,8 @@ static int status_post_select(struct sched *s, void *context) ret2 = for_each_stat_item(st->buf, st->loaded, update_item); if (ret < 0 || ret2 < 0) { st->loaded = 0; - PARA_NOTICE_LOG("closing stat pipe: %s\n", para_strerror(-ret)); + PARA_NOTICE_LOG("closing stat pipe: %s\n", + para_strerror(ret < 0? -ret : -ret2)); close(st->fd); st->fd = -1; clear_all_items(); diff --git a/mood.c b/mood.c index dce72a7b..8d171bde 100644 --- a/mood.c +++ b/mood.c @@ -30,7 +30,7 @@ struct afs_statistics { int64_t num_played_sum; /** Sum of last played times over all admissible files. */ int64_t last_played_sum; - /** Quadratic deviation of num played time. */ + /** Quadratic deviation of num played count. */ int64_t num_played_qd; /** Quadratic deviation of last played time. */ int64_t last_played_qd; diff --git a/score.c b/score.c index 3c5e04f6..81b3ded0 100644 --- a/score.c +++ b/score.c @@ -71,7 +71,7 @@ static struct osl_column_description score_cols[] = { }, [SCORECOL_SCORE] = { .storage_type = OSL_NO_STORAGE, - .storage_flags = OSL_RBTREE | OSL_FIXED_SIZE, + .storage_flags = OSL_RBTREE | OSL_FIXED_SIZE | OSL_UNIQUE, .name = "score", .compare_function = score_compare, .data_size = sizeof(long) diff --git a/string.c b/string.c index 453a61c1..f8b64b77 100644 --- a/string.c +++ b/string.c @@ -31,8 +31,8 @@ * A wrapper for realloc(3). It calls \p exit(\p EXIT_FAILURE) on errors, * i.e. there is no need to check the return value in the caller. * - * \return A pointer to the newly allocated memory, which is suitably aligned - * for any kind of variable and may be different from \a p. + * \return A pointer to newly allocated memory which is suitably aligned for + * any kind of variable and may be different from \a p. * * \sa realloc(3). */ @@ -380,14 +380,13 @@ int for_each_line(unsigned flags, char *buf, size_t size, char *next_cr; next_cr = memchr(start, '\n', buf + size - start); - next_null = memchr(start, '\0', buf + size - start); + next_null = memchr(start, '\0', next_cr? + next_cr - start : buf + size - start); if (!next_cr && !next_null) break; - if (next_cr && next_null) { - end = next_cr < next_null? next_cr : next_null; - } else if (next_null) { + if (next_null) end = next_null; - } else + else end = next_cr; num_lines++; if (!(flags & FELF_DISCARD_FIRST) || start != buf) {