Andre Noll [Thu, 27 Sep 2007 15:47:46 +0000 (17:47 +0200)]
Implement pattern matching for com_touch().
Also, add -p and -v options and fix converting the last played
time which is a 64 bit intger, so strtol() will fail do it on 32
bit machines after 2039 ;)
To fix this, introduce para_atoi64() which calls strtoll() which
is 64 bit even on 32 bit machines and define para_atoi32() which
calls para_atoi64() and checks the boundaries.
Andre Noll [Thu, 27 Sep 2007 10:25:05 +0000 (12:25 +0200)]
Gerneralize for_each_matching_blob().
It's not only useful for blobs. For instance the rm and the touch
commands might also want to use something similar. So move it to
afs.c and call it for_each_matching_row().
Andre Noll [Wed, 26 Sep 2007 14:37:00 +0000 (16:37 +0200)]
Fix table init.
The previous patch introduced two instances of a bug which weren't noticed by
the compiler because attribute_table and score_table were declared as void *
pointers. Change that to struct osl_table *, and add the missing '&' operator.
Andre Noll [Wed, 26 Sep 2007 09:29:07 +0000 (11:29 +0200)]
addblob: Overwrite existing blobs.
Previously, an attempt to add a blob with a name of an already
existing blob failed (siltenly). Just replace the existing blob
with the new contents instead.
Andre Noll [Tue, 25 Sep 2007 12:16:14 +0000 (14:16 +0200)]
make get_playlist_data() generic.
Other blob types might use an analogous function as well, so introduce
blob_get_name_and_def_by_row() in blob.c, and use some preprocessor
magic to define such a function for each blob type.
Change all users of get_playlist_data() to use the new
pl_blob_get_name_and_def_by_row() and remove get_playlist_data().
Andre Noll [Tue, 25 Sep 2007 09:39:23 +0000 (11:39 +0200)]
More mood cleanups.
- Avoid use of global current_mood pointer where possible.
- Change name of non-static functions that use the current mood pointer:
mood_open() -> change_current_mood()
mood_close() -> close_current_mood()
mood_reload() -> reload_current_mood()
Andre Noll [Sun, 23 Sep 2007 20:38:54 +0000 (22:38 +0200)]
afs.c: Avoid noisy log message.
para_server regularly sends SIGUSR1 to all of its children. afs
just ignores that signal, so only print a log message if a signal
different from SIGUSR1 was caught.
Andre Noll [Sat, 22 Sep 2007 12:45:21 +0000 (14:45 +0200)]
Fix some bugs in blob handling.
- make fd2buf() decrypt the received data.
- stdin_command() has to read from the socket fd rather than from stdin.
Moreover, it must send the AWAITING_DATA_MSG to the client.
- com_catblob() really needs to use send_bin_buffer() rather than send_buffer().
- com_addblob() has to pass the socket fd to stdin_command().
Andre Noll [Sat, 15 Sep 2007 17:42:29 +0000 (19:42 +0200)]
replace para_connect() by PARA_CONNECT.
PARA_CONNECT is a macro which works for all three socket address types
used in paraslash (sockaddr_in, sockaddr, sockaddr_un) and which does
not need a length parameter.
Change all instances of connect() and para_connect() to use PARA_CONNECT().
Andre Noll [Sat, 15 Sep 2007 07:50:14 +0000 (09:50 +0200)]
Fix the privious assertion().
It's OK to ask for the name of an audio format id < 0, as id -1 is used for
"currently no audio file is open". So allow this case, and fix the upper bound
which was off by one while we're at it.
Andre Noll [Sat, 15 Sep 2007 07:39:18 +0000 (09:39 +0200)]
audio_format_name(): Add an assert().
The paraslash code should never request the name of an audio format
with invalid id. Introduce the ARRAY_SIZE macro to get the proper
upper bound for the number of supported audio formats.
Andre Noll [Fri, 14 Sep 2007 09:14:41 +0000 (11:14 +0200)]
rc4: Round up output buffer size.
valgrind indicated that RC4() writes beyond the end of the output buffer which
was was of the same size than the input buffer. Workaround this by rounding up
the output buffer size to a multiple of 8.
Andre Noll [Thu, 13 Sep 2007 19:55:46 +0000 (21:55 +0200)]
Fix com_add segfault.
We call free(obj.data) unconditionally on errors, but is is not set to NULL.
Also, return always success in add_one_audio_file() in order to continue the
loop.
Andre Noll [Thu, 13 Sep 2007 19:53:32 +0000 (21:53 +0200)]
ogg_afh.c: Fix a memory leak.
In an non-ogg file is passed to the ogg audio format handler, such that the
initial ogg_sync_pageout() fails, the old code leaked the memory which was
allocated for the stream_in and the stream_out pointers.
Andre Noll [Wed, 12 Sep 2007 21:43:16 +0000 (23:43 +0200)]
aft.c: Fix com_add().
callbacks shall return zero or negative, if no result is provided. So let
com_ls_callback() return zero if no match was found, or if the audio file table
does not contain any entries. Check for ret > 0 in com_add() instead of ret >=
0, i.e. don't use the result pointer if ret is zero.