paraslash.git
7 years agoplay.c: Check whether filter ->close() is NULL.
Andre Noll [Sun, 28 Jun 2015 14:21:23 +0000 (16:21 +0200)]
play.c: Check whether filter ->close() is NULL.

While audiod.c and filter.c test whether ->close is NULL
before they attempt to call the function, play.c calls ->close()
unconditionally. This does not matter because all filters provide the
close method. But it is documented in filter.h that ->close may be
NULL. To avoid future surprises and to be consistent with para_audiod
and para_filter, let's change play.c to check for NULL as well.

7 years agoafh: Make ->suffixes array const.
Andre Noll [Sun, 7 Feb 2016 22:22:52 +0000 (23:22 +0100)]
afh: Make ->suffixes array const.

Not only the individual strings are constant, but also the array itself.

7 years agoblob_get_name_by_id(): Treat id of dummy row as invalid.
Andre Noll [Sat, 26 Mar 2016 22:28:27 +0000 (22:28 +0000)]
blob_get_name_by_id(): Treat id of dummy row as invalid.

If the given id equals the id of the dummy row, the function currently
returns an empty object. This is unfortunate, since blob table users
should not know about the dummy row implementation detail. This patch
makes the function return -E_DUMMY_ROW instead.

In error.h, the E_DUMMY_ROW error code was defined in the section
for mood.c because this file contains the only user of the error
code. With another user in blob.c it seems appropriate to move it to
the blob section instead.

8 years agoMerge branch 'refs/heads/t/markdown'
Andre Noll [Sun, 17 Apr 2016 12:32:53 +0000 (14:32 +0200)]
Merge branch 'refs/heads/t/markdown'

The topich branch was started on 2015-12-13, and has been cooking
in next since 2016-01-30. The merge resulted in conflicts for both
files which were easy to resolve.

* refs/heads/t/markdown:
  Convert manual and NEWS from grutatxt to markdown.

8 years agodoc: Remove systemlinux links from documentation.
Andre Noll [Sun, 6 Mar 2016 18:21:19 +0000 (19:21 +0100)]
doc: Remove systemlinux links from documentation.

The systemlinux.org server is still up, but the paraslash web page
just redirects to people.tuebingen.mpg.de, so only mention the latter
in the documentation.

8 years agomanual: Bump required gcc version to 4.1.
Andre Noll [Sun, 6 Mar 2016 15:43:05 +0000 (16:43 +0100)]
manual: Bump required gcc version to 4.1.

gcc-3 is not good enough any more since it has no support for weak
references, which were introduced half a year ago in commit 9bf6dc2e
(error.h: Never call (para_)strerror() on osl errors).

gcc-3.3 was released in 2003, gcc-4.2 in 2007. It should be OK to
require gcc-4.2 from now on.

8 years agoMake dates in ls output align nicely again.
Andre Noll [Mon, 4 Apr 2016 22:23:30 +0000 (00:23 +0200)]
Make dates in ls output align nicely again.

Commit 3c978d34 "fixed" a whitespace issue by replacing two consecutive
space characters in a format string by a single space. However,
the duplicated space character actually had a purpose. This commit
re-adds the additional space character and explains through a comment
why it is needed.

8 years agoafs: Remove incorrect log message.
Andre Noll [Sat, 2 Apr 2016 15:22:00 +0000 (17:22 +0200)]
afs: Remove incorrect log message.

This was introduced in f8ed713d (com_select() callback: Return negative
on errors.) last year. It is incorrect for two reasons. First, arg
may well be NULL, and second, we might be about to open a mood rather
than a playlist.

8 years agoMerge branch 'refs/heads/t/attribute_fix'
Andre Noll [Sun, 10 Apr 2016 21:46:02 +0000 (23:46 +0200)]
Merge branch 'refs/heads/t/attribute_fix'

com_setatt() was broken if more than 32 attributes are defined. The
branch merged in this commit contains a fix for this bug, and a new
test that exercises the code related to attributes.

Was cooking in next for six weeks.

* refs/heads/t/attribute_fix:
  manual: Add realpath to list of packages.
  Add test that exercises attribute code.
  test-lib: Canonicalize test_dir.
  attribute: Avoid shifting 32 bit integers.

8 years agoudp_send.c: Send EOF packet only once.
Andre Noll [Tue, 22 Dec 2015 23:52:18 +0000 (23:52 +0000)]
udp_send.c: Send EOF packet only once.

Currently this can be sent many times, which is pointless and might
confuse clients. This patch adds a bool member to struct udp_target
to keep track whether the EOF packet has been sent.

8 years agoNEWS: Re-add download link for current master.
Andre Noll [Sat, 2 Apr 2016 00:18:36 +0000 (02:18 +0200)]
NEWS: Re-add download link for current master.

This link on the main page got lost when paraslash-0.5.5 was
released. As explained on the download page, the master branch is
the version people should use, so we should really put back the link.

8 years agoMerge branch 'refs/heads/t/image_id_mm'
Andre Noll [Fri, 1 Apr 2016 23:59:11 +0000 (01:59 +0200)]
Merge branch 'refs/heads/t/image_id_mm'

A single commit that was cooking for several months.

* refs/heads/t/image_id_mm:
  server: Add mood methods image_id and lyrics_id.

8 years agoMerge branch 'maint'
Andre Noll [Fri, 1 Apr 2016 23:33:47 +0000 (01:33 +0200)]
Merge branch 'maint'

A couple of overflow bugs and a aslignment issue, all detected by ubsan. Plus
two unrelated old bugs.

* maint:
  client: Fix lsatt completer.
  playlist: Do not update score if no playlist is open.
  Avoid member access within misaligned address for ancillary data buffer.
  mood.c: Avoid overflow in update_quadratic_deviation().
  mood.c: Avoid integer underflow.
  mood.c: Avoid integer overflow.

8 years agoclient: Fix lsatt completer.
Andre Noll [Tue, 29 Mar 2016 16:16:33 +0000 (16:16 +0000)]
client: Fix lsatt completer.

The lsatt command does not take any non-option arguments. So it is wrong
to complete on the available attributes.

8 years agoopus_afh.c: Trivial whitespace fix.
Andre Noll [Mon, 14 Mar 2016 08:01:11 +0000 (09:01 +0100)]
opus_afh.c: Trivial whitespace fix.

Just an overlong line.

8 years agoopus_common.c: Fix trival whitespace issue.
Andre Noll [Sun, 7 Feb 2016 21:47:10 +0000 (22:47 +0100)]
opus_common.c: Fix trival whitespace issue.

8 years agoplaylist: Do not update score if no playlist is open.
Andre Noll [Mon, 21 Mar 2016 19:51:08 +0000 (19:51 +0000)]
playlist: Do not update score if no playlist is open.

This bug caused the score of the current audio file to be updated
twice in mood mode since both the mood event handler and playlist
event handler honor afs events and update the score.

We fix the bug by moving the check whether a playlist is open to the
top of the playlist event handler, similar to the check in the mood
event handler of mood.c. If no playlist is open, we now return early
from the playlist event handler, ignoring all afs events.

8 years agoAvoid member access within misaligned address for ancillary data buffer.
Andre Noll [Wed, 16 Mar 2016 22:05:56 +0000 (23:05 +0100)]
Avoid member access within misaligned address for ancillary data buffer.

For glibc-2.23, the CMSG_FIRSTHDR macro is defined as

#define CMSG_FIRSTHDR(mhdr) \
  ((size_t) (mhdr)->msg_controllen >= sizeof (struct cmsghdr)                 \
   ? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) 0)

In recv_cred_buffer(), pass_afd() and dispose_fds() the on-stack
ancillary data buffer is not necessarily aligned. The pointer is
cast to struct cmsghdr *, then dereferenced, resulting in undefined
behaviour due to the lack of alignment.

This patch asks the compiler to align the ancillary data buffers.

8 years agomood.c: Avoid overflow in update_quadratic_deviation().
Andre Noll [Wed, 16 Mar 2016 21:48:54 +0000 (22:48 +0100)]
mood.c: Avoid overflow in update_quadratic_deviation().

The last multiplication of the expression returned can overflow. This
patch replaces the expression by an equivalent one which avoids to
multiply large numbers.

8 years agoi9e: Remove pointless call to rl_set_keymap() in i9e_open().
Andre Noll [Tue, 8 Mar 2016 07:48:27 +0000 (08:48 +0100)]
i9e: Remove pointless call to rl_set_keymap() in i9e_open().

The call to rl_set_keymap() can be removed since i9e_attach_to_stdout()
already activates the bare key map.

8 years agoi9e: Remove stale comment for dispatch_key().
Andre Noll [Tue, 8 Mar 2016 07:46:52 +0000 (08:46 +0100)]
i9e: Remove stale comment for dispatch_key().

Should have been removed when we switched to key sequences.

8 years agoi9e: Remove stale comment for i9e_signal_dispatch().
Andre Noll [Tue, 8 Mar 2016 07:45:30 +0000 (08:45 +0100)]
i9e: Remove stale comment for i9e_signal_dispatch().

The function also cares about SIGWINCH.

8 years agoi9e: Remove unused member of struct i9e_private.
Andre Noll [Tue, 8 Mar 2016 07:44:52 +0000 (08:44 +0100)]
i9e: Remove unused member of struct i9e_private.

8 years agobuild: Let man pages depend on git-version.h.
Andre Noll [Thu, 9 Apr 2015 13:27:16 +0000 (13:27 +0000)]
build: Let man pages depend on git-version.h.

This is necessary to always include the correct version number in
the man pages. For example, if the work tree becomes dirty because
an unrelated file has been modified, the version string changes and
we need to regenerate the man pages.

8 years agomood.c: Avoid integer underflow.
Andre Noll [Tue, 15 Mar 2016 19:48:12 +0000 (20:48 +0100)]
mood.c: Avoid integer underflow.

The three variables x, s, n are all of unsigned type, and the
subtraction x - s / n may underflow, resulting in a very large positive
value. This should not matter since we square the difference, but on
the other hand, the underflow can easily be avoided. This patch uses
a temporary variable to do so.

8 years agomood.c: Avoid integer overflow.
Andre Noll [Tue, 15 Mar 2016 19:41:37 +0000 (20:41 +0100)]
mood.c: Avoid integer overflow.

The quadratic deviation qd can be very large, causing the
multiplication n * qd to overflow. The new code avoids the
multiplication at the cost of two calls to int_sqrt() instead of one.

8 years agomanual: Add realpath to list of packages.
Andre Noll [Sun, 13 Mar 2016 17:43:04 +0000 (18:43 +0100)]
manual: Add realpath to list of packages.

It's a pity that this useful utility seems not to be installed by
default on Ubuntu systems.

8 years agostring.c: Alloc space for terminating null wide character.
Andre Noll [Mon, 29 Feb 2016 18:26:09 +0000 (19:26 +0100)]
string.c: Alloc space for terminating null wide character.

Should not matter since we already know the number of wide characters
and never look past the allocated buffer. But let's be conservative
here and allocate space for the terminating null wide character.

8 years agogui.c: Remove condition which is always true.
Andre Noll [Sat, 5 Mar 2016 20:30:31 +0000 (21:30 +0100)]
gui.c: Remove condition which is always true.

If top.win is NULL, curses_active() is false so we return early.

8 years agogui: Remove pointless special casing in align_str().
Andre Noll [Sun, 28 Feb 2016 21:04:33 +0000 (22:04 +0100)]
gui: Remove pointless special casing in align_str().

Regardless of whether str[0] is the null byte, passing str is correct
(and done for left and right alignment).

8 years agoMerge branch 'refs/heads/t/com_sender'
Andre Noll [Sun, 6 Mar 2016 20:36:21 +0000 (21:36 +0100)]
Merge branch 'refs/heads/t/com_sender'

A single commit which was cooking in next for several months.

* refs/heads/t/com_sender:
  Avoid duplication of sender subcommands.

8 years agoRemove unused error code E_NO_AUDIO_TRACK.
Andre Noll [Thu, 26 Nov 2015 07:51:54 +0000 (08:51 +0100)]
Remove unused error code E_NO_AUDIO_TRACK.

It was introduced last year in commit 741c19c2 (The mp4 tagger)
and has always been unused.

8 years agoclient: Add completer for version command.
Andre Noll [Sat, 2 Jan 2016 17:41:37 +0000 (17:41 +0000)]
client: Add completer for version command.

This command gained the -v flag but the commit that introduced it
last year (26dc18b2, Unify version command handlers) missed to provide
the corresponding completer for para_client.

8 years agoAdd test that exercises attribute code.
Andre Noll [Sun, 7 Feb 2016 16:01:12 +0000 (17:01 +0100)]
Add test that exercises attribute code.

This test would fail without the previous fix that changed the
shifted integers to 64 bit.

8 years agotest-lib: Canonicalize test_dir.
Andre Noll [Sun, 7 Feb 2016 15:59:38 +0000 (16:59 +0100)]
test-lib: Canonicalize test_dir.

This makes it easier to write tests. The realpath command is
available at least on Linux and *BSD.

8 years agoattribute: Avoid shifting 32 bit integers.
Andre Noll [Sun, 7 Feb 2016 16:37:00 +0000 (17:37 +0100)]
attribute: Avoid shifting 32 bit integers.

att_logical_or() is called from com_check() to set up a bitmask where
a bit is set if and only if it corresponds to an existing attribute.
Doing "1 << i" is wrong in this context because the constant "1" is a
(signed) 32 bit quantity and we need to be able to shift by more than
31 bits for the attribute mask.

Fix this by using an uint64_t variable instead.

8 years agoMerge branch 'maint'
Andre Noll [Sun, 21 Feb 2016 10:58:39 +0000 (11:58 +0100)]
Merge branch 'maint'

A single fix that avoids to shift 32 bit integers for attribute
bitmasks where 64 bit quantities are necessary.

8 years agoattribute: Avoid shifting 32 bit integers.
Andre Noll [Sun, 7 Feb 2016 16:33:15 +0000 (17:33 +0100)]
attribute: Avoid shifting 32 bit integers.

Doing "1UL << i" is wrong here, because the constant "1UL" is 32 bit
on 32 bit systems and we definitely need 64 bit quantities for the
attribute mask.

Fix this by using an uint64_t variable instead.

8 years agospxdec: Check frame sizes.
Andre Noll [Sat, 20 Jun 2015 21:32:13 +0000 (23:32 +0200)]
spxdec: Check frame sizes.

We pass a buffer of fixed size MAX_FRAME_SIZE (defined to 2000)
to the speex decoder. This sanity check makes sure we never overrun
the buffer. Although this adds one function call per output frame,
the overhead is in the noise.

Also document MAX_FRAME_SIZE while at it.

8 years agoConvert manual and NEWS from grutatxt to markdown.
Andre Noll [Sun, 13 Dec 2015 14:16:27 +0000 (15:16 +0100)]
Convert manual and NEWS from grutatxt to markdown.

Grutatext still works but the project seems to be dead, so we have
to switch to something else eventually.

This patch converts the two grutatext documents in the tree to the
markdown language, getting rid of the dependency on grutatext at
the expense of a new dependency on the markdown executable. Only the
discount markdown converter has been tested and is known to work.

The commit also changes the "Tools" section of the manual to list
discount instead of grutatext.

8 years agoMerge branch 'refs/heads/t/para_play_fixes'
Andre Noll [Sat, 30 Jan 2016 12:07:11 +0000 (13:07 +0100)]
Merge branch 'refs/heads/t/para_play_fixes'

Was cooking in next since 2015-10-25.

* refs/heads/t/para_play_fixes:
  i9e: Avoid key binding macros.
  play: Fix off-by-one in jmp 100.

8 years agopara.h: Fix typo in comment.
Andre Noll [Tue, 26 Jan 2016 13:33:05 +0000 (14:33 +0100)]
para.h: Fix typo in comment.

The option is called --sample-format rather than --format.

8 years agostring.c: Handle invalid loglevels gracefully.
Andre Noll [Sun, 27 Dec 2015 23:03:38 +0000 (23:03 +0000)]
string.c: Handle invalid loglevels gracefully.

Public functions should always return a proper error code on
failure. Returning -1 is asking for trouble.

8 years agot0005: Split audiod man page tests.
Andre Noll [Sun, 18 Oct 2015 09:27:26 +0000 (11:27 +0200)]
t0005: Split audiod man page tests.

This makes it easier to diagnose potential problems due to missing
man page sections.

8 years agoConstify struct filter access and introduce filter_get().
Andre Noll [Tue, 6 Oct 2015 02:32:31 +0000 (02:32 +0000)]
Constify struct filter access and introduce filter_get().

This modifies all users of the filter API to not access the filter
array directly. Instead all callers now obtain a const pointer to
the filter structure through the new filter_get() accessor function.

However, the filter array can not be made constant yet because the
->init methods modify the filter structure. This requires some casts
in filter_common.c unfortunately.

8 years agoDeactivate implicit make rules.
Andre Noll [Sat, 3 Oct 2015 01:58:43 +0000 (01:58 +0000)]
Deactivate implicit make rules.

Without this, make might execute commands defined by implicit
rules. This can cause subtle build errors that are hard to debug.

To make this work we need to define CC though, and RM must not be
defined through the =? operator.

8 years agoMake FOR_EACH_SUPPORTED_FILTER() local to filter_common.c.
Andre Noll [Tue, 6 Oct 2015 01:54:02 +0000 (01:54 +0000)]
Make FOR_EACH_SUPPORTED_FILTER() local to filter_common.c.

The macro is only used in this .c file, so it should not be
public. This patch moves the macro from filter.h to filter_common.c.

8 years agoFix documentation of check_receiver_arg().
Andre Noll [Wed, 30 Sep 2015 01:09:24 +0000 (01:09 +0000)]
Fix documentation of check_receiver_arg().

Receiver name and options are NOT separated by a colon. Also, all three
receivers (http, udp, dccp) are always supported, so it's pointless
to talk about supported paraslash receivers. This patch simplifies
the comment accordingly.

8 years agoplay.c: Remove bogus __a_unused attribute for session_open().
Andre Noll [Sun, 4 Oct 2015 00:06:34 +0000 (00:06 +0000)]
play.c: Remove bogus __a_unused attribute for session_open().

The play task pointer IS used in this function.

8 years agot0004: Switch to new syntax for ls command.
Andre Noll [Sun, 27 Dec 2015 22:04:58 +0000 (22:04 +0000)]
t0004: Switch to new syntax for ls command.

The old way of specifying ls options is deprecated and should no
longer be used.

8 years agobuild: Remove arch_cppflags.
Andre Noll [Sun, 20 Sep 2015 21:33:45 +0000 (23:33 +0200)]
build: Remove arch_cppflags.

This workaround for Solaris is no longer needed as Solaris is
unsupported for years.

8 years agocommand.c: Open-code mmd_dup().
Andre Noll [Mon, 28 Dec 2015 17:47:46 +0000 (17:47 +0000)]
command.c: Open-code mmd_dup().

This function is short and has only a single caller. The code becomes
clearer by open-coding it in the caller.

8 years agocommand.c: Improve documentation of vss_status_tohuman().
Andre Noll [Mon, 28 Dec 2015 17:48:06 +0000 (17:48 +0000)]
command.c: Improve documentation of vss_status_tohuman().

At the time the function is called, we already took a copy of the
mmd struct.

8 years agofilter.h: Improve documentation of ->pre_select().
Andre Noll [Sat, 17 Oct 2015 17:22:07 +0000 (19:22 +0200)]
filter.h: Improve documentation of ->pre_select().

Fix a grammar issue ("it only allowed") and explain the purpose of
the fd sets.

8 years agoafh_recv: Improve documentation of --begin-chunk.
Andre Noll [Wed, 9 Sep 2015 18:30:24 +0000 (20:30 +0200)]
afh_recv: Improve documentation of --begin-chunk.

The help text referred to --info, which was removed four years ago
in commit 06f33ca1. This patch also inlucdes a couple of minor other
improvements to the same paragraph.

8 years agoafs.c: Improve documentation of afs_socket_cookie.
Andre Noll [Sun, 6 Sep 2015 19:55:13 +0000 (21:55 +0200)]
afs.c: Improve documentation of afs_socket_cookie.

The old text had a few language issues and did not mention the fact
that the socket cookie is written to the afs socket.

8 years agoclient_common.c: Fix typo in comment.
Andre Noll [Thu, 24 Dec 2015 23:26:36 +0000 (23:26 +0000)]
client_common.c: Fix typo in comment.

8 years agoudp_send.c: Remove pointless function.
Andre Noll [Tue, 22 Dec 2015 23:40:36 +0000 (23:40 +0000)]
udp_send.c: Remove pointless function.

udp_init_session() has only one caller in the same file.

8 years agoaft.c: Check for osl errors in com_add_callback().
Andre Noll [Tue, 22 Dec 2015 15:36:45 +0000 (15:36 +0000)]
aft.c: Check for osl errors in com_add_callback().

We only want to issue the afs event if the row was successfully added
to the audio file table.

8 years agoaac_afh.c: Do not open-code aac_read_int32().
Andre Noll [Mon, 16 Dec 2013 20:58:32 +0000 (21:58 +0100)]
aac_afh.c: Do not open-code aac_read_int32().

We have this helper, so use it.

8 years agoaac_afh.c: Simplify atom_cmp().
Andre Noll [Mon, 16 Dec 2013 17:44:12 +0000 (18:44 +0100)]
aac_afh.c: Simplify atom_cmp().

It's pointless to compare the buffer byte by byte. Just use memcmp(3)
instead.

8 years agoafh: Make ->chunks_total and ->seconds_total fixed-size.
Andre Noll [Sat, 4 Oct 2014 23:52:50 +0000 (23:52 +0000)]
afh: Make ->chunks_total and ->seconds_total fixed-size.

These members of struct afh_info are stored as 4-byte quantities in
the serialized afhi blob created by save_afhi(), so the structure
should declare them as uint32_t rather than unsigned long.

Fortunately, this bug is benign since save_afhi() uses the write_u32()
helper from portable_io.h which does the right thing, regardless of
the type of the variable passed.

8 years agobuild: Compute CC version, build date and uname string only once.
Andre Noll [Wed, 1 Apr 2015 12:32:50 +0000 (12:32 +0000)]
build: Compute CC version, build date and uname string only once.

This should speed up the build somewhat, and it gets rid of a pointless
duplication in the Makefile.

8 years agoMerge branch 'refs/heads/t/priority'
Andre Noll [Sun, 13 Dec 2015 11:21:44 +0000 (12:21 +0100)]
Merge branch 'refs/heads/t/priority'

A single commit which was cooking in next for two months.

* refs/heads/t/priority:
  daemon: New option --priority for server and audiod.

8 years agoweb: Deactivate search engine.
Andre Noll [Mon, 26 Oct 2015 13:54:39 +0000 (14:54 +0100)]
web: Deactivate search engine.

It hasn't worked for years and the recent upgrade to doxygen-1.8.6
did not fix it. Just deactivate the feature for now.

8 years agomanual: Improve section on Doxygen.
Andre Noll [Tue, 1 Sep 2015 17:28:19 +0000 (19:28 +0200)]
manual: Improve section on Doxygen.

It was longer than necessary and a bit clumsy to read. The new
formulation is shorter and more to the point.

8 years agot0005: Remove pointless assignment to regex,
Andre Noll [Wed, 14 Oct 2015 22:48:00 +0000 (00:48 +0200)]
t0005: Remove pointless assignment to regex,

This assignment at the end of the script has no effect.

8 years agoafs.h: Do not include regex.h.
Andre Noll [Sun, 6 Sep 2015 19:08:59 +0000 (21:08 +0200)]
afs.h: Do not include regex.h.

This is unnecessary as all source files which include afs.h included
regex.h before.

8 years agoaft.c: Prefer localtime() over localtime_r().
Andre Noll [Sat, 5 Sep 2015 19:49:16 +0000 (21:49 +0200)]
aft.c: Prefer localtime() over localtime_r().

While localtime(3) is required to behave as though tzset(3) was
called, localtime_r(3) does not have this requirement, and portable
code should thus call tzset(3) before localtime_r(3). This is not
the case for get_local_time() of aft.c.

As we are single-threaded here, we don't need the thread-safe version,
so it is easiest to switch to localtime(3).

8 years agoImprove lastplayed time format for ls and stat output.
Andre Noll [Sat, 5 Sep 2015 17:51:28 +0000 (19:51 +0200)]
Improve lastplayed time format for ls and stat output.

It is possible that the lastplayed time happens to be in the future.

Fix a whitespace issue while at it.

8 years agoMerge branch 'refs/heads/t/strerror'
Andre Noll [Tue, 8 Dec 2015 06:39:04 +0000 (07:39 +0100)]
Merge branch 'refs/heads/t/strerror'

Was cooking in next since 2015-09-27.

* refs/heads/t/strerror:
  error.h: Never call (para_)strerror() on osl errors.
  Clarify para_strerror().
  error.h: Remove is_errno().

8 years agoserver: Add mood methods image_id and lyrics_id.
Andre Noll [Sun, 28 Jun 2015 18:05:13 +0000 (20:05 +0200)]
server: Add mood methods image_id and lyrics_id.

This rather simple patch allows to easily define a mood that selects
all files of an album through the image ID, or all versions of a song
(including cover and Live versions) through the lyrics ID.

The documentation is updated to list the two new mood methods.

8 years agoAvoid duplication of sender subcommands.
Andre Noll [Mon, 28 Sep 2015 17:43:39 +0000 (17:43 +0000)]
Avoid duplication of sender subcommands.

The list of sender subcommands (add, delete, allow, deny, on, off)
is defined as an enumeration in send.h. This list is duplicated in
check_sender_args() of command.c which contains the six subcommands
as C-strings to be matched against the first word of the sender
command line.

For the code to work properly it is essential that the two subcommand
lists are identical, which is a bad design that is quite error
prone. Fortunately it is easy to avoid the duplication with a little
preprocessor fu.

Since the subcommands are spelled in lower case and there is no
toupper function in CPP, we need to change the subcommand part of the
enumeration constants to lower case. The bulk of the patch consists
in trivial changes of all the users of these constants.

8 years agobuild: Fix audiod_command.c dependency.
Andre Noll [Sun, 4 Oct 2015 20:25:06 +0000 (20:25 +0000)]
build: Fix audiod_command.c dependency.

The effect of these typos is that the dependencies are effectively
ignored. That is, changes to audiod_command.c do not cause a rebuild
of the command_list files.

The fix is trivial.

8 years agoplay: Handle empty arguments to --key-map gracefully.
Andre Noll [Sat, 3 Oct 2015 22:48:38 +0000 (22:48 +0000)]
play: Handle empty arguments to --key-map gracefully.

Executing para_play with an empty argument to --key-map results in
a read which starts one byte past the allocated buffer:

==24163== Invalid read of size 1
==24163==    at 0x402A1DA: index (mc_replace_strmem.c:223)
==24163==    by 0x804DA22: main (play.c:187)
==24163==  Address 0x498e331 is 0 bytes after a block of size 1 alloc'd

This patch fixes the issue by rejecting empty arguments as invalid.

8 years agoi9e: Avoid key binding macros.
Andre Noll [Sat, 3 Oct 2015 17:51:38 +0000 (17:51 +0000)]
i9e: Avoid key binding macros.

The key binding code of interactive.c is quite an ugly hack which is
marked with a FIXME comment since forever. We bind each key sequence
given in the ->bound_keyseqs array of struct i9e_client_info to a
key code which is then mapped to a command handler provoded by the
application. The bindings started at key 64 with an arbitrary limit
of 32 possible mappings.

Besides being ugly, the problem with this mapping scheme is that
upper case keys are also in this range and are hence also mapped to
the specified commands.

This commit takes another approach. We now bind key sequences to a
function instead of a macro, passing ISFUNC as the first parameter to
libreadline's rl_generic_bind(). All key sequences are bound to the
same function, dispatch_key(), which calls the application-defined
key handler.

This is still not optimal because we need to look up the key sequence
again in dispatch_key(). But since this is not a fast path anyway,
it should be OK.

8 years agoplay: Fix off-by-one in jmp 100.
Andre Noll [Sat, 3 Oct 2015 17:52:12 +0000 (17:52 +0000)]
play: Fix off-by-one in jmp 100.

The command "jmp 100" did not work as expected (switch to the next
file) but caused the following error

repos failed: Invalid argument

The problem was that ->start_chunk was set to pt->num_chunks which
exceeds the maximal valid chunk number by one.

This commit special cases the value 100 to make "jmp 100" equivalent to
"next".

8 years agoMerge branch 'refs/heads/t/command_handler_cleanups'
Andre Noll [Sun, 25 Oct 2015 15:06:43 +0000 (16:06 +0100)]
Merge branch 'refs/heads/t/command_handler_cleanups'

Cooking for about two months.

* refs/heads/t/command_handler_cleanups: (39 commits)
  com_addatt(): Return negative on errors
  com_rm(): In force mode, don't complain if no paths matched.
  aft: Unify handling of hash and path duplicates.
  afs: Provide pbout para_buffer for each callback.
  afs: Make afs callbacks more flexible.
  afs: Rename callback_function to afs_callback.
  com_check(): Add attribute checking.
  Let afs_event() return int.
  playlist_check_callback(): Return negative on errors
  mood_check_callback(): Return negative on errors
  com_mvblob(): Return negative on errors
  com_addblob(): Return negative on errors
  com_rmblob(): Return negative on errors, cleanup
  com_catblob(): Return negative on errors
  com_lsblob(): Return negative on errors
  rmatt: Cleanup callback.
  com_rmatt(): Return negative on errors
  com_mvatt(): Return negative on errors
  com_lsatt(): Return negative on errors
  com_init(): Return negative on errors
  ...

8 years agoaft.c: Clean up aft_hash_compare().
Andre Noll [Thu, 9 Apr 2015 13:57:45 +0000 (13:57 +0000)]
aft.c: Clean up aft_hash_compare().

This function is static and hence does not need doxygen comments. Also
break two overlong lines.

8 years agobuild: Fix m4 dependencies for BSD m4.
Andre Noll [Sat, 17 Oct 2015 14:47:01 +0000 (16:47 +0200)]
build: Fix m4 dependencies for BSD m4.

FreeBSD and NetBSD ship an m4 version which does not understand
the --debug=i option which we use to generate the .m4d dependency
files. This results in empty dependency files on those systems.

This was broken since m4 dependencies were introduced two years ago
in commit e249d105 (Generate ggo dependencies automatically). The
bug went unnoticed for so long because the problematic m4 command
is the first command of a pipeline (hence the exit code is lost),
and because the command redirects stderr, so the error message is
not printed to the terminal.

This commit fixes the bug by using the  (portable) -s option of
m4 rather than --debug. The -s option outputs line synchronization
directives which include the file name, so it is equally well suited
for generating the dependency files.

8 years agofade: Add missing line break for log message.
Andre Noll [Sat, 3 Oct 2015 21:38:08 +0000 (21:38 +0000)]
fade: Add missing line break for log message.

Fixes broken log output which looked like this:

21:33:48 21:33:48 sweet_dreams: waketime: 6:33client_cmd: /usr/local/bin/para_client stop

8 years agodaemon: New option --priority for server and audiod.
Andre Noll [Thu, 8 Oct 2015 16:25:06 +0000 (16:25 +0000)]
daemon: New option --priority for server and audiod.

On slow hardware it is useful to set the priority of the para_audiod
process to avoid sound artefacts due to buffer underruns.

This patch adds an option for this purpose which is available for
para_server and para_audiod.

8 years agoweb: Clear DOT_FONTNAME in Doxyfile.
Andre Noll [Tue, 9 Jun 2015 17:42:31 +0000 (19:42 +0200)]
web: Clear DOT_FONTNAME in Doxyfile.

Doxygen-1.8.6. warns about DOT_FONTNAME being set:

Warning: doxygen no longer ships with the FreeSans font.
You may want to clear or change DOT_FONTNAME.
Otherwise you run the risk that the wrong font is being used for dot generated graphs.

The warning is harmless because the DOT_FONTNAME option has no effect
in our setup because HAVE_DOT is set to "NO". Setting DOT_FONTNAME
to the empty string, as recommended in the explanatory text after
the warning, silences the warning.

8 years agoweb: Update Doxyfile to doxygen-1.8.6.
Andre Noll [Tue, 9 Jun 2015 17:23:13 +0000 (19:23 +0200)]
web: Update Doxyfile to doxygen-1.8.6.

The system on which the public web pages are generated is now running
on Ubuntu-14.04 which ships doxygen-1.8.6. This version prints a
couple of warnings about obsolete tags in Doxyfile:

Warning: Tag `SYMBOL_CACHE_SIZE' at line 289 of file - has become obsolete.
To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
Warning: Tag `SHOW_DIRECTORIES' at line 483 of file - has become obsolete.
To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
Warning: Tag `HTML_ALIGN_MEMBERS' at line 820 of file - has become obsolete.
To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
Warning: Tag `USE_INLINE_TREES' at line 989 of file - has become obsolete.
To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"

This patch is the result of running doxygen -u. With the patch applied,
the above warnings go away.

There is no need to be backwards compatible here because the web pages
are not created during a normal build.

8 years agoerror.h: Never call (para_)strerror() on osl errors.
Andre Noll [Wed, 12 Aug 2015 17:24:50 +0000 (19:24 +0200)]
error.h: Never call (para_)strerror() on osl errors.

In the (inlined) function para_strerror() of error.h we compile in
the call to osl_strerror() if and only if osl.h has been included
(in which case the preprocessor macro _OSL_H is defined). This is
wrong because an osl error code might well be passed to a function
defined in a compilation unit which does not include osl.h. If this
function calls para_strerror(), we will segfault or worse.

We need to check at link time whether osl_strerror is a defined
symbol rather than checking a preprocessor macro at compile time.
Fortunately, a little linker fu helps us out here. This patch
introduces a weak reference to osl_strerror to tell whether
osl_strerror is defined.

8 years agoClarify para_strerror().
Andre Noll [Mon, 10 Aug 2015 18:00:49 +0000 (20:00 +0200)]
Clarify para_strerror().

para_strerror() needs to distinguish three kinds of errors: paraslash
errors, errors from the osl library, and system (libc) errors. This
is achieved through dedicated bits in the error code which are
set for errors from osl and libc function calls. These bits tell
para_strerror() which function to call in order to obtain the text
that corresponds to the error code.

If such a dedicated bit is set, para_strerror() first clears the bit,
then calls the library strerror() function that corresponds to the
bit. The code to clear the bit is

num & ((1 << OSL_ERROR_BIT) - 1))

and similar for libc errors. However, this expression clears *all*
high bits, not only bit number OSL_ERROR_BIT. This is not a problem
since the higher bits are not set under normal circumstances, but it
is better to fix this anyway. The new code is

num & ~(1U << OSL_ERROR_BIT),

which turns off the osl error bit only.

8 years agoerror.h: Remove is_errno().
Andre Noll [Mon, 10 Aug 2015 17:34:45 +0000 (19:34 +0200)]
error.h: Remove is_errno().

There is only one caller of is_errno() which is converted to use
ERRNO_TO_PARA_ERROR() in this patch.

8 years agoMerge branch 'refs/heads/t/taggers'
Andre Noll [Sun, 27 Sep 2015 12:35:05 +0000 (12:35 +0000)]
Merge branch 'refs/heads/t/taggers'

Cooking in next since 2015-04-26.

* refs/heads/t/taggers:
  aac: Fix compilation without libmp4v2.
  The mp4 tagger.
  The mp3 tagger.
  The flac tagger.
  The ogg/speex tagger.
  The ogg/vorbis tagger.
  The ogg/opus tagger.
  The wma tagger.

8 years agobuild: maintainer-clean: Kill web_sync remove command.
Andre Noll [Mon, 7 Sep 2015 22:39:40 +0000 (00:39 +0200)]
build: maintainer-clean: Kill web_sync remove command.

This directory was used by a private script, but these days the script
creates its temporary files elsewhere. Hence it is no longer neccessary
to remove the directory in the receipe of the maintainer-clean target.

8 years agostring.c: Kill E_STRTOLL.
Andre Noll [Sat, 5 Sep 2015 11:01:18 +0000 (13:01 +0200)]
string.c: Kill E_STRTOLL.

This error code is unnecessary because para_atoi64() returns it only
if strtoll(3) did not perform any conversion and we have already a
more descriptive error code for this case: E_ATOI_NO_DIGITS.

Two new comments to para_atoi64() explain this in detail.

8 years agobuild: Completion headers no longer depend .c file.
Andre Noll [Wed, 2 Sep 2015 22:26:06 +0000 (00:26 +0200)]
build: Completion headers no longer depend .c file.

Due to commit 6aea41e6 (command_util.bash: Kill make_proto()) this
dependency can be dropped.

8 years agoattribute.c: Remove pointless condition in attribute_open().
Andre Noll [Sat, 29 Aug 2015 10:35:42 +0000 (12:35 +0200)]
attribute.c: Remove pointless condition in attribute_open().

ret is known to be negative at this point.

8 years agobitstream.c: Convert GET_DATA macro to inline function.
Andre Noll [Wed, 1 Apr 2015 02:55:50 +0000 (02:55 +0000)]
bitstream.c: Convert GET_DATA macro to inline function.

There is no benefit from defining this as a macro. With the inline
function we get type safety for free, and the new version is better
readable.

8 years agoparaslash 0.5.5 v0.5.5
Andre Noll [Sun, 20 Sep 2015 09:22:40 +0000 (11:22 +0200)]
paraslash 0.5.5

8 years agoMerge branch 'refs/heads/t/com_ls_compat'
Andre Noll [Thu, 17 Sep 2015 18:07:02 +0000 (20:07 +0200)]
Merge branch 'refs/heads/t/com_ls_compat'

A single commit which adds support for the new syntax for the -l and -s options
of the ls command. These options should now be specified as -l=v rather than
-lv, for example. The old syntax still works, but support will be dropped in
v0.6.0.

* fdb039 Introduce new syntax for com_ls().

8 years agobuild: Avoid bashism in configure.ac.
Andre Noll [Mon, 14 Sep 2015 18:14:25 +0000 (20:14 +0200)]
build: Avoid bashism in configure.ac.

'==' is not portable. In fact, NetBSD's /bin/sh complains about
this. The fix is trivial.

8 years agobuild: Include flac afh only if libogg is available.
Andre Noll [Mon, 14 Sep 2015 18:08:19 +0000 (20:08 +0200)]
build: Include flac afh only if libogg is available.

In configure.ac we have

AC_DEFUN([NEED_FLAC_OBJECTS], [{
test "$HAVE_OGG" = 'yes' -a "$HAVE_FLAC" = 'yes'
}])

In particular, we do not include the flac audio format handler on
systems where libflac is installed but libogg is not. In afh_common.c,
however, we only check for HAVE_FLAC. This results in a build failure
on those systems.

Fix this by modifying the check in afh_common.c to match the check
in configure.ac.

8 years agocom_add(): Allow paths and afhi to exceed 64K.
Andre Noll [Sun, 6 Sep 2015 13:05:30 +0000 (15:05 +0200)]
com_add(): Allow paths and afhi to exceed 64K.

The add command has the unnecessary limitation that for each audio
file to be added, the length of the path plus the size of serialized
audio format handler info structure (afhi) must not exceed 64K.

An afhi bigger than that is quite possible, given that it contains
the meta information of the file, for example an ID3v2 tag which can
contain almost unlimited amounts of data. If the 64K limit is exceeded,
all kinds of bad things may happen. So this issue definitely needs
to be addressed.

Specifically, save_add_callback_buffer() must be fixed. In this
function we serialize the data to be passed from the add command
handler to its callback. This includes path, afhi and the chunk table,
which are all variable in size. To cope with variable sizes, the
start of the buffer contains fields in which the offsets are stored
at which afhi and chunk table are located, relative to the start of
the serialized buffer. The problem is that the offset fields are only
16 bit wide, allowing for a maximal size of 64K.

This commit makes the offsets 32 bit wide and reorders them a
bit. Also, the CAB_AUDIO_FORMAT_OFFSET identifier is renamed to
CAB_AUDIO_FORMAT_ID_OFFSET.

8 years agoMerge branch 'maint'
Andre Noll [Sun, 6 Sep 2015 14:07:43 +0000 (16:07 +0200)]
Merge branch 'maint'

8 years agoserver.h: Improve documentation of mmd struct.
Andre Noll [Wed, 1 Apr 2015 00:25:04 +0000 (00:25 +0000)]
server.h: Improve documentation of mmd struct.

This adds a sentence to the description of the structure which explains
how the misc_meta_data structure is used for communication betweeen
the server process and the command handlers. The patch also contains
some minor language improvements.