Merge branch 'maint' Two fixes for gcc-12 warnings, and another fix for a benign but embarrassing braino in gcrypt.c. * maint: gcrypt: Fix return value of apc_get_pubkey(). error.h: Be more careful with error code masking. mp3_afh: Drop unused fields from struct mp3header.
error.h: Be more careful with error code masking. It should never happen that two or more of the three special high bits (osl, lopsub, system) are set in an integer that stores a paraslash error value, but gcc-12 can't prove this and complains as follows: error.h:304:28: warning: array subscript 268435456 is above array bounds of 'const char * const[220]' [-Warray-bounds] 304 | return para_errlist[num]; | ~~~~~~~~~~~~^~~~~ Avoid this warning by always clearing all three special bits.
Consolidate EOF error codes. Currently we have ~15 error codes which indicate an EOF condition. One should suffice, so drop all codes except the generic E_EOF and use that everywhere.
server: Improve error diagnostics of com_select(). The attempt to select a non-existing mood or playlist currently results in remote: key not found in rbtree This is a bit cryptic, so be a bit more user-friendy and provide a paraslash error code for this case.
Merge topic branch t/afs-cleanups into master A fair number of patches which clean up all parts of the audio file selector. The most visible change is probably that error messages from afs callbacks are sent with a proper sideband designator so that they are written to stderr on the client side. * refs/heads/t/afs-cleanups: (30 commits) Introduce afs_error(). afs.c: Move com_select() and its callback down. Rename mood_switch(), mood_close(), playlist_{open/close}. Assume that score_open() and score_clear() always succeed. playlist.c: Rename playlist_info -> playlist_instance. mood.c: Rename struct mood to mood_instance. afs.c: Rename ->handler of struct callback_query to ->cb. Simplify and improve activate_mood_or_playlist(). afs: Replace ->init of afs tables by table operations. Merge load_playlist() into playlist_open() and simplify. Simplify row_belongs_to_score_table(). Remove mood.h. Clean up and rename change_current_mood(). mood.c: Simplify and rename load_mood(). mood.c: Move struct statistics into struct mood. afs.c: Improve activate_mood_or_playlist(). Improve playlist_open(). blob.c: Don't initialize table pointer in table->init(). blob: Constify name argument of blob_get_def_by_name(). Rename admissible_file_loop() -> score_loop(). ...
Exclude status items and error list from doxygen. These lists are rather long and make the doxygen source code documentation harder to read without providing a real benefit.
Merge load_playlist() into playlist_open() and simplify. They are reasonably small. Remove the weird calling convention with the PLAYLIST_LOADED error code and the pointless check for the dummy row because they only obfuscate the code. Moreover, the comment of load_playlist() is actively misleading because this function is not a loop callback. Extend the documentation of the combined public playlist_open() while at it. The code can be simplified by calling pl_get_def_by_name() rather than osl_get_row() followed by pl_get_name_and_def_by_row().
Remove E_NO_MOOD, row_is_admissible() is never called with a NULL mood pointer.
Open-code find_arg(). There is only one caller in client_common.c, so open-code the logic there and get rid of the public function and the unused error code.
Remove unused error code MOOD_SYNTAX. The error code became unused when version 1 moods were removed. Fixes: 184ea897a9b446611a9d02315160b6d77c0926fe
Merge branch 'refs/heads/t/ll' Two little cleanups related to the logging facility and two commits which add the ll command to para_server and para_audiod. The merge resulted in a conflict in afs.c due to the earlier merge of the poll topic branch which replaced all calls to select() by calls to poll(). The implementation of the ll server command introduced a new caller of select(), afs_select(), which needs to be replaced by afs_poll() to resolve the conflict. * refs/heads/t/ll: New server command: ll to change the log level at runtime. New audiod command: ll to change the log level at runtime. daemon: Kill get_loglevel_by_name(). server/audiod: Don't parse loglevel argument unnecessarily.
daemon: Kill get_loglevel_by_name(). Open-code the logic in daemon_set_log_color_or_die() and get the values from the new SEVERTIES macro rather than duplicating the severity list in get_loglevel_by_name(). The SEVERTIES macro will turn out to be handy for the ll subcommands of para_server and para_audiod which are introduced in subsequent commits.
mp4: Remove E_MP4_BAD_CHANNEL_COUNT. If the mp4 file does not contain an m4a atom, the channel count stays at zero and open_file() returns -E_MP4_TRACK in this case. So the check in aac_afh.c for a non-positive return value from mp4_get_channel_count() can never trigger. Replace the check by an assertion and remove the error code. Also, let mp4_get_channel_count() return uint16_t as the number of channels is stored as an unsigned 16 bit number in the mp4 file.
mp4: Provide proper error codes for all errors. This changes the few remaining places where we return -1 to indicate failure by proper error codes which can be turned into a meaningful error message.
mp4: Implement error checking for the write path. Although the ->write callback has a return value, it is of unsigned type and is never checked. Fix this by changing the prototype to match that of the write(2) system call, check the return value of the callback in the write_data() wrapper of mp4.c and propagate paraslash error codes back to aac_afh.c via the public mp4_meta_update(). While at it, handle short writes and EINTR properly, and fix the indentation of the callback structure in mp4.h.
mp4: Assume udta, meta and ilst are always present. Under normal circumstances these atoms exist or can at least be created by other means (e.g., by running mp4tags -a foo bar.m4a). This patch makes mp4_open_meta() fail early if at least one of the three atoms is missing. This allows to remove the (never tested hence probably buggy) code which creates these atoms.
mp4: Introduce mp4_get_meta(). Simplify the API by returning a pointer to the metadata structure stored inside struct mp4. This is easier than having two accessor functions.
mp4: Replace mp4ff prefix by mp4. The additional "ff" does not convey any useful information. This patch was produced by running sed -i 's/mp4ff/mp4/g' mp4.c mp4.h aac_afh.c followed by sed -i 's/MP4FF/MP4/g' aac_afh.c error.h and the manual removal of the "ff" suffix in the error strings.
Remove E_PERM. There is only one user which may as well use the standard error code.
com_ls(): Drop "audio file table syntax error" messsage. This error message is printed if ls is called with an invalid argument for the listing mode or sort order. That's not a syntax error, so use the standard EINVAL error code instead.