audacious.cc: print_audacious_filename(): fix always empty $audacious_filename #2038
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
print_audacious_filename()
always returns an empty (zero-length)$audacious_filename
, due to one of thestd::min()
operands always being 0. Removing thestd::min()
construct fixes the problem. Fixes #1175.Checklist
doc/
has been updated (N/A, I think 🤷♂️)Description
In
print_audacious_filename()
,obj->data.i
is always0
on my system (can't test anywhere else, I'm afraid), sostd::min((unsigned int)obj->data.i, p_max_size)
also evaluates to0
, resulting in a zero-length (ie. empty) string being returned for$audacious_filename
, even though the correct, full filename is being received overDBus
. Removing thestd::min()
construct fixes the problem, resulting in the correct value being assigned to$audacious_filename
.I first encountered this bug with
conky-1.12.2
,audaciuos-4.1
,libaudclient-3.5-rc2
,gcc-/g++-9.2.0
on 32bitSlackware-14.2
more then 2 years ago, and it's still present today withconky-1.21.7
,audacious-4.3
,libaudclient-3.5-rc2
,gcc-/g++-11.2.0
on 64bitSlackware-15.0
, so I doubt it's some sort of one-time "freak accident". 🙂