We continued looping while maxlen > 0, but maxlen was unsigned, so an overflow
would make it a large number instead of negative. Fixed.
Some snprintf() implementations might return a negative value if there isn't
enough space, and we now check for that.
Don't overrun the SDL error message buffer, if snprintf() returned the number
of chars it wanted to write instead of the number it did.
snprintf is a portability mess, we should just never use the C runtime for it.
Fixes Bugzilla #2049.
This extension allows the user to specify whether a full flush is performed when making a context not current.
The only way to set this currently is at context creation, so this patch provides that functionality.
Defualt behaviour is set at FLUSH, as per the spec.
This patch does not contain the changes to WGL, appleGL or other platforms as I do not have access to GL 4.5 hardware on those platforms.
Full details on the use of KHR_context_flush_control can be found here:
https://www.opengl.org/registry/specs/KHR/context_flush_control.txt
The data produced by the callback is just thrown away and the audio thread
delays as if it's waiting for the hardware to drain.
This lets apps that rely on their audio callback firing regularly continue
to make progress to function as properly as possible in the face of disaster.
Apps that want to know that the device is really gone and deal with that
scenario can use the new hotplug functionality.
Device enumeration now happens at startup and then is managed exclusively
through hotplugging instead of full redetection. The device name list now has
a unique "handle" associated with each item and SDL will pass this to the
backend so they don't have to figure out how a human readable name maps to
real hardware for a second time.
Other cleanups, fixes, improvements, plus all the audio backends updated to
the new interface...largely untested at this point, though.
This fills in the core pieces and fully implements it for Mac OS X.
Most other platforms, at the moment, will report a disconnected device if
it fails to write audio, but don't notice if the system's device list changed
at all.