Fixes V576 warning from PVS-Studio - in this case PVS is somewhat
pedantic, as it warns about printf'ing of malloc'ed memory and risk the
associated problems in OOM situations.
In this case it can be a problem, as LOG_MSG aka GFX_ShowMsg
allocates memory during printing in result an error message could cause
stack overflow, although it's extremely unlikely on modern OSes.
Avoid triggering this warning by using memory-safe container and using
C++11 data() accessor to vector internal buffer; in case of OOM
situation, stack will be unrolled and program should exit with nice
error message.
This is a small issue pointed out by Coverity; this variable might be
later used uninitialized in several places.
Making this change to test if Coverity updates report summary only after
the numbers actually changed (we just had fresh scan, but Coverity keeps
showing summary from few days ago).
Revisions 4314 and 4315 were reverted:
- r4314 introduced several technical issues; keeping it away from
the master branch until some improvements will land in SVN.
- r4315 touches code related to overlay, which was completely removed when
porting to SDL2; this revert makes future merge commit cleaner.
This function uses its boolean return code to indicate success
or failure, which all callers check prior to using any of the
referenced arguments. Therefore it's unecessary to zero-out
referenced arguments or use intermediate variables.
The specification says that legal track values range from 1 to 99,
where as the prior code would return 0 if any issue was encountered.
The spec has no allowance for issues in this function, and therefore
we're bound to simply return 1 instead.
For example, audio CD players will typically position themselves in
preparation to play the first audio track when "Play" is pushed.
This even occurs for mixed-mode CDs, where the player will start
playing at the first audio track. Therefore, we try to find the most
viable audio track and only fall back to defaults if needed.
(instead of "all zeros" like before).
With types refined, we can switch to cleaner integer
math and avoid casting (to float and back to ints), and also
avoid ceil((float) a / b) by using the pure-integer form
of (a + b - 1) / b
This is simplified by no longer retaining the read position,
which is unecessary because all read operations are offset
from an initial absolute position (so this was unecessary code).