From: Andre Noll Date: Fri, 8 Apr 2011 09:12:46 +0000 (+0200) Subject: Merge branch 't/gvf' X-Git-Tag: v0.4.7~20 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=65a0002eb560b7248cbb0b4f143d00053b66bccc;hp=-c;ds=sidebyside Merge branch 't/gvf' --- 65a0002eb560b7248cbb0b4f143d00053b66bccc diff --combined Makefile.in index 8963adad,06c86eb6..8b33aaac --- a/Makefile.in +++ b/Makefile.in @@@ -9,19 -9,17 +9,21 @@@ PACKAGE_VERSION := @PACKAGE_VERSION PACKAGE_STRING := @PACKAGE_STRING@ install_sh := @install_sh@ cmdline_dir := @cmdline_dir@ +executables := @executables@ build_date := $(shell date) uname_s := $(shell uname -s 2>/dev/null || echo "UNKNOWN_OS") uname_rs := $(shell uname -rs) cc_version := $(shell $(CC) --version | head -n 1) -codename := deterministic entropy +codename := infinite rollback + GIT_VERSION := $(shell ./GIT-VERSION-GEN git-version.h) + DEBUG_CPPFLAGS += -Wno-sign-compare -g -Wunused -Wundef -W DEBUG_CPPFLAGS += -Wredundant-decls +DEBUG_CPPFLAGS += -Wall +DEBUG_CPPFLAGS += -Wformat-security +DEBUG_CPPFLAGS += -Wmissing-format-attribute # produces false positives # DEBUG_CPPFLAGS += -Wunreachable-code # DEBUG_CPPFLAGS += -Wwrite-strings @@@ -41,25 -39,28 +43,24 @@@ ifeq ($(uname_s),Linux CPPFLAGS += -Wshadow endif CPPFLAGS += -Os -CPPFLAGS += -Wall CPPFLAGS += -Wuninitialized CPPFLAGS += -Wchar-subscripts -CPPFLAGS += -Wformat-security CPPFLAGS += -DBINDIR='"$(BINDIR)"' CPPFLAGS += -DBUILD_DATE='"$(build_date)"' CPPFLAGS += -DUNAME_RS='"$(uname_rs)"' CPPFLAGS += -DCODENAME='"$(codename)"' CPPFLAGS += -DCC_VERSION='"$(cc_version)"' CPPFLAGS += -Werror-implicit-function-declaration -CPPFLAGS += -Wmissing-format-attribute CPPFLAGS += -Wmissing-noreturn CPPFLAGS += -Wunused-macros CPPFLAGS += -Wbad-function-cast CPPFLAGS += -fno-strict-aliasing CPPFLAGS += -DMAIN_INPUT_FILE_IS_$(*F) CPPFLAGS += @SSL_CPPFLAGS@ -CPPFLAGS += @ncurses_cppflags@ CPPFLAGS += @arch_cppflags@ CPPFLAGS += -I/usr/local/include CPPFLAGS += -I$(cmdline_dir) CPPFLAGS += @osl_cppflags@ - CPPFLAGS += -DGIT_VERSION='"$(GIT_VERSION)"' man_pages := $(patsubst %, man/man1/%.1, @executables@) man_pages_in := $(patsubst %, web/%.man.in.html, @executables@) @@@ -67,7 -68,6 +68,7 @@@ ggo_dir := ggo object_dir := objects man_dir := man/man1 +test_dir := t m4_ggos := afh audioc audiod client filter gui recv server write all_ggos := $(m4_ggos) dccp_recv alsa_write oss_write fade http_recv \ @@@ -94,24 -94,18 +95,18 @@@ endi ifndef BUILD_VERBOSE BUILD_VERBOSE = 0 endif -ifeq ($(BUILD_VERBOSE),1) - Q = -else +ifeq ($(BUILD_VERBOSE),0) Q = @ +else + Q = endif - .PHONY: dep all clean distclean maintainer-clean install man tarball\ - .FORCE-GIT-VERSION-FILE + .PHONY: dep all clean distclean maintainer-clean install man tarball all: dep @executables@ $(man_pages) dep: $(deps) man: $(man_pages) tarball: $(tarball) - GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE - @./GIT-VERSION-GEN GIT-VERSION-FILE - -include GIT-VERSION-FILE - @executables@: GIT-VERSION-FILE - -include $(ggo_dir)/makefile %_command_list.c: %.cmd @@@ -195,10 -189,6 +190,10 @@@ $(object_dir)/aac_afh.o: aac_afh.c | $( @[ -z "$(Q)" ] || echo 'CC $<' $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $< +$(object_dir)/gui%.o: gui%.c | $(object_dir) + @[ -z "$(Q)" ] || echo 'CC $<' + $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) @curses_cppflags@ $< + $(object_dir)/%.cmdline.o: $(cmdline_dir)/%.cmdline.c $(cmdline_dir)/%.cmdline.h | $(object_dir) @[ -z "$(Q)" ] || echo 'CC $<' $(Q) $(CC) -c $(CPPFLAGS) -Wno-unused-function -o $@ $< @@@ -215,7 -205,6 +210,7 @@@ $(object_dir)/%.d: %.c | $(object_dir @[ -z "$(Q)" ] || echo 'DEP $<' $(Q) ./depend.sh $(object_dir) $(cmdline_dir) $(CPPFLAGS) $< > $@ + recv_objs := $(addprefix $(object_dir)/, @recv_objs@) filter_objs := $(addprefix $(object_dir)/, @filter_objs@) client_objs := $(addprefix $(object_dir)/, @client_objs@) @@@ -251,7 -240,7 +246,7 @@@ para_client: $(client_objs para_gui: $(gui_objs) @[ -z "$(Q)" ] || echo 'LD $@' - $(Q) $(CC) $(LDFLAGS) -o $@ $(gui_objs) -lncurses + $(Q) $(CC) $(LDFLAGS) -o $@ $(gui_objs) -lcurses para_audiod: audiod_command_list.c audiod_command_list.h $(audiod_objs) @[ -z "$(Q)" ] || echo 'LD $@' @@@ -286,7 -275,7 +281,7 @@@ clean2: clea $(Q) rm -rf man $(object_dir) $(Q) rm -f *_command_list.* -distclean: clean2 +distclean: clean2 test-clean @[ -z "$(Q)" ] || echo 'DISTCLEAN' $(Q) rm -f Makefile autoscan.log config.status config.log $(Q) rm -rf autom4te.cache aclocal.m4 @@@ -309,7 -298,7 +304,7 @@@ $(tarball): $(cmdline_generated git archive --format=tar --prefix=$(tarball_pfx)/ HEAD \ | tar --delete $(tarball_delete) > $(tarball_pfx).tar mkdir -p $(tarball_pfx)/$(cmdline_dir) - echo $(GIT_VERSION) > $(tarball_pfx)/VERSION + ./GIT-VERSION-GEN > $(tarball_pfx)/VERSION cp -r $(autocrap) $(tarball_pfx) cp -r $(cmdline_generated) $(tarball_pfx)/$(cmdline_dir) tar rf $(tarball_pfx).tar $(tarball_pfx)/* @@@ -322,4 -311,3 +317,4 @@@ %.pdf: %.ps ps2pdf - - < $< > $@ +include $(test_dir)/makefile.test diff --combined audiod.c index e5db0cd2,8dd69c60..5bc22c81 --- a/audiod.c +++ b/audiod.c @@@ -33,6 -33,7 +33,7 @@@ #include "write.h" #include "write_common.h" #include "signal.h" + #include "version.h" /** define the array of error lists needed by para_audiod */ INIT_AUDIOD_ERRLISTS; @@@ -167,7 -168,7 +168,7 @@@ struct command_task * \return The audio format number on success, -E_UNSUPPORTED_AUDIO_FORMAT if * \a name is not a supported audio format. */ -int get_audio_format_num(const char *name) +static int get_audio_format_num(const char *name) { int i; @@@ -469,6 -470,20 +470,6 @@@ static int get_empty_slot(void return -E_NO_MORE_SLOTS; } -/** - * get the number of filters - * - * \param audio_format_num the number identifying the audio format - * - * \return the number of filters for the given audio format - * - * \sa struct filter; - */ -int num_filters(int audio_format_num) -{ - return afi[audio_format_num].num_filters; -} - static void open_filters(struct slot_info *s) { struct audio_format_info *a = afi + s->format; @@@ -1083,17 -1098,17 +1084,17 @@@ static void try_to_close_slot(int slot_ if (s->format < 0) return; - if (s->receiver_node && s->receiver_node->task.error != -E_TASK_UNREGISTERED) + if (s->receiver_node && s->receiver_node->task.error >= 0) return; for (i = 0; i < a->num_filters; i++) - if (s->fns && s->fns[i].task.error != -E_TASK_UNREGISTERED) + if (s->fns && s->fns[i].task.error >= 0) return; if (a->num_writers > 0) { for (i = 0; i < a->num_writers; i++) - if (s->wns && s->wns[i].task.error != -E_TASK_UNREGISTERED) + if (s->wns && s->wns[i].task.error >= 0) return; } else { - if (s->wns && s->wns[0].task.error != -E_TASK_UNREGISTERED) + if (s->wns && s->wns[0].task.error >= 0) return; } PARA_INFO_LOG("closing slot %d\n", slot_num); @@@ -1174,7 -1189,7 +1175,7 @@@ static void status_post_select(__a_unus kill_btrn(st->ct->btrn, &st->ct->task, -E_AUDIOD_OFF); goto out; } - if (st->ct->task.error != -E_TASK_UNREGISTERED) + if (st->ct->task.error >= 0) goto out; close_stat_pipe(); st->clock_diff_count = conf.clock_diff_count_arg; @@@ -1185,7 -1200,7 +1186,7 @@@ size_t sz; int ret; if (st->ct->task.error < 0) { - if (st->ct->task.error != -E_TASK_UNREGISTERED) + if (st->ct->task.error >= 0) goto out; close_stat_pipe(); goto out; diff --combined command.c index 5217f9b4,029e2890..24ddf789 --- a/command.c +++ b/command.c @@@ -37,6 -37,7 +37,7 @@@ #include "afs_command_list.h" #include "sched.h" #include "signal.h" + #include "version.h" /** Commands including options must be shorter than this. */ #define MAX_COMMAND_LEN 32768 @@@ -255,8 -256,7 +256,8 @@@ int com_si(struct rc4_context *rc4c, in free(info); } ut = uptime_str(); - ret = rc4_send_va_buffer(rc4c, "up: %s\nplayed: %u\n" + ret = rc4_send_va_buffer(rc4c, "version: " GIT_VERSION "\n" + "up: %s\nplayed: %u\n" "server_pid: %d\n" "afs_pid: %d\n" "connections (active/accepted/total): %u/%u/%u\n" diff --combined fade.c index 5fbd0dd4,8affd69d..41b4a6d7 --- a/fade.c +++ b/fade.c @@@ -23,6 -23,7 +23,7 @@@ #include "fd.h" #include "string.h" #include "error.h" + #include "version.h" INIT_FADE_ERRLISTS; static struct fade_args_info conf; @@@ -125,7 -126,6 +126,7 @@@ static void fixup_mixer_channel_arg(voi case mixer_channel_arg_reclev: val = SOUND_MIXER_RECLEV; break; case mixer_channel_arg_igain: val = SOUND_MIXER_IGAIN; break; case mixer_channel_arg_ogain: val = SOUND_MIXER_OGAIN; break; + default: break; } conf.mixer_channel_arg = val; } @@@ -345,15 -345,15 +346,15 @@@ int main(int argc, char *argv[] } fixup_mixer_channel_arg(); switch (conf.mode_arg) { - case mode_arg_sleep: - ret = sweet_dreams(); - break; case mode_arg_fade: ret = fade(conf.fade_vol_arg, conf.fade_time_arg); break; case mode_arg_snooze: ret = snooze(); break; + default: /* sleep mode */ + ret = sweet_dreams(); + break; } if (ret < 0) PARA_EMERG_LOG("%s\n", para_strerror(-ret)); diff --combined gui.c index 3c1889ca,4be81f74..578eeed0 --- a/gui.c +++ b/gui.c @@@ -22,6 -22,7 +22,7 @@@ #include "list.h" #include "sched.h" #include "signal.h" + #include "version.h" /** define the array of error lists needed by para_gui */ INIT_GUI_ERRLISTS; @@@ -33,10 -34,10 +34,10 @@@ static int signal_pipe static struct win_data { WINDOW *win; - NCURSES_SIZE_T begx; - NCURSES_SIZE_T begy; - NCURSES_SIZE_T cols; - NCURSES_SIZE_T lines; + size_t begx; + size_t begy; + size_t cols; + size_t lines; } top, bot, sb, in, sep; #define RINGBUFFER_SIZE 512 diff --combined para.h index 08eb0ee6,3121850f..7217486d --- a/para.h +++ b/para.h @@@ -67,22 -67,6 +67,6 @@@ va_end(argp); \ } - /** Version text used by various commands if -V switch was given. */ - #define VERSION_TEXT(prefix) "para_" prefix " " PACKAGE_VERSION \ - " (" GIT_VERSION ": " CODENAME ")" "\n" \ - "Copyright (C) 2011 Andre Noll\n" \ - "This is free software with ABSOLUTELY NO WARRANTY." \ - " See COPYING for details.\n" \ - "Written by Andre Noll.\n" \ - "Report bugs to .\n" - - /** Print out \p VERSION_TEXT and exit if version flag was given. */ - #define HANDLE_VERSION_FLAG(_prefix, _args_info_struct) \ - if (_args_info_struct.version_given) { \ - printf("%s", VERSION_TEXT(_prefix)); \ - exit(EXIT_SUCCESS); \ - } - /** Sent by para_client to initiate the authentication procedure. */ #define AUTH_REQUEST_MSG "auth rsa " /** Sent by para_server for commands that expect a data file. */ @@@ -221,9 -205,6 +205,9 @@@ _static_inline_ long int para_random(un /** Used to avoid a shortcoming in vim's syntax highlighting. */ #define EMBRACE(...) { __VA_ARGS__} +/** A nice cup of STFU for Mr gcc. */ +#define do_nothing do {/* nothing */} while (0) + /** * The sample formats supported by paraslash. * diff --combined write.c index b3824a08,cf48922a..571dc4ed --- a/write.c +++ b/write.c @@@ -23,6 -23,7 +23,7 @@@ #include "write_common.h" #include "fd.h" #include "error.h" + #include "version.h" INIT_WRITE_ERRLISTS; @@@ -209,20 -210,6 +210,20 @@@ static int main_btr(struct sched *s s->default_timeout.tv_sec = 10; s->default_timeout.tv_usec = 50000; ret = schedule(s); + if (ret >= 0) { + int j; + for (j = 0; j < i; j++) { + struct task *t = &wns[j].task; + assert(t->error < 0); + if (t->error != -E_WRITE_COMMON_EOF + && t->error != -E_BTR_EOF) { + PARA_ERROR_LOG("%s: %s\n", t->status, + para_strerror(-t->error)); + if (ret >= 0) + ret = t->error; + } + } + } out: for (i--; i >= 0; i--) { struct writer_node *wn = wns + i;