This is nullptr in all the cases that audio is disabled, and non-nullptr
in all the cases where it is enabled. Use it instead of a separate flag
variable.
This allows the compiler to see and perform basic checks on the call
even in builds with `DXX_WORDS_NEED_ALIGNMENT == 0`.
Also, fix a missing address-of operator in one invocation of
`align_polygon_model_data`.
Reported-by: Brunnis <https://github.com/dxx-rebirth/dxx-rebirth/issues/687> (missing address-of operator)
Fixes: 43e1c841f0 ("Pass polymodel& to polymodel_read")
This is initial setup to enabling use of zip() on sentinel based ranges.
Store the range's type in the zip signature, and store the types of
std::begin/std::end for the iterators, rather than assuming that
std::begin and std::end return the same type.
Allow the caller to pick which sequences can terminate the zip iterator.
For compatibility and performance, default to the historical behavior of
examining only the first sequence. The zip iteration terminates when
any of the examined sequences reaches its end, even if other sequences
have not reached their respective end.
The standard type imposes some additional requirements that are not
necessary here, but using this concept allows standard containers to be
classified correctly without specific overrides.
Any integer type can convert to match this signature, but the diagnostic
will only report that this deleted function was matched. Switch to a
template function so that the diagnostic can report the unconverted
integer type.
Switch from using a macro to capture __FILE__,__LINE__ to using
__builtin_FILE(),__builtin_LINE(). Make the event an explicit argument,
instead of assuming it is a variable named `event`. Move the
implementation out of line.
The global variables that control it configure the callback to do
nothing, but SDL_mixer would still call it and still acquire the SDL
mutex that protects the call. Such calls are a waste, so disable them.
This should also fix
<https://github.com/dxx-rebirth/dxx-rebirth/issues/684>, which appears
to be caused by the MVE mixer callback being run during gameplay, and
the callback not returning immediately. This is suspected to be because
a race condition between MVE_rmEndMovie and the callback caused the
global variables not to be placed in a state that causes the callback to
return immediately.
When building with -D_GLIBCXX_DEBUG, gcc-11 warns:
```
In file included from /usr/include/string.h:535,
from similar/main/net_udp.cpp:14:
In function 'void* memcpy(void*, const void*, size_t)',
inlined from 'virtual void d2x::multi::udp::dispatch_table::send_data_direct(std::span<const unsigned char>, dcx::playernum_t, int) const' at similar/main/net_udp.cpp:5731:8:
/usr/include/bits/string_fortified.h:29:33: error: 'void* __builtin_memcpy(void*, const void*, long unsigned int)' specified bound 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Werror=stringop-overflow=]
29 | return __builtin___memcpy_chk (__dest, __src, __len,
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
30 | __glibc_objsize0 (__dest));
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
```
The warning is invalid: the destination buffer is not PTRDIFF_MAX bytes
long, and the requested length is not SIZE_MAX bytes. Both claimed
lengths are the result of excessively cautious value range tracking.
Eliminate the warning by adding a `cf_assert` to assure gcc that
`data.size() != std::dynamic_extent`.