Code submissions have continually suffered from formatting
inconsistencies that constantly have to be addressed. Using
clang-format simplifies this by making code formatting more consistent,
and allows automation of the code formatting so that maintainers can
focus more on the code itself instead of code formatting.
Ensures that functions loaded by `os_dlsym()` come only from the
specified library that was loaded with `os_dlopen()` rather than the set
of libraries loaded by the specified library.
We can't compare addresses of ComPtr for self-reference directly because
the address-of operator is overloaded, causing a compiler error. This
fix more or less matches the WRL implementation.
Returns the current version number of windows. The lowest byte is the
minor version number, then the next lowest byte is the major version
number. E.g. 0x601 for Windows 7, 0x602 for Windows 8, 0x603 for
Windows 8.1, and 0xA00 for Windows 10.
Certain windows functions may allow 0 as a valid handle value, therefore
INVALID_HANDLE_VALUE is a more appropriate initialization value.
Closesobsproject/obs-studio#1519
The pthread_setname_np manpage states:
The thread name is a meaningful C language string, whose length is
restricted to 16 characters, including the terminating null byte ('\0').
If a config file value is set to a blank value, the value would not be
set and the default value would be used. This fixes a bug where the
user would try to remove the replay buffer prefix, only to have the
prefix be added again next time they start the program.
Caches the frequency of the performance counter. It was supposed to be
caching it already, but it seems that code was unintentionally not
included.
Closesjp9000/obs-studio#1185
When splitting a string in to a string list via stringlist_split, it
would previously allocate memory for each sub-string and again for the
list itself. This optimizes that function to use a single contiguous
chunk of memory for the sake of access optimization and memory
allocation efficiency.
Adds circlebuf_push_front_zero and circlebuf_push_back_zero to
conveniently push zeroed data to the front/back of the buffer without
having to create an intermediary buffer to accomplish the same thing.
Follow-up to 47aa56b (PR #620). Windows 10 revision detection broke in
Build 15036 (Creators Update) after Revision 296. This aims to further
fix revision detection on Windows 10.
Certain PSAPI functions moved to KERNEL32 after Vista, setting
PSAPI_VERSION 1 uses the old PSAPI exports for compatibility. Vista
support was unintentionally broken by a6318ff.
If size is 0 after popping data from the front or back, set the
start/end points to 0 as well to ensure that any subsequent buffer
pushes start from the beginning of the buffer rather than the middle of
the buffer. Reduces potential unnecessary operations in that case.
Additionally, this fixes a bug with circulebuf_pop_back where if start
position was 0, and all the data was popped off the buffer (equal to the
capacity), the end position would be equal to the original size. As an
example to replicate the bug, push 5, pop 5, then push 10. The
start/end points will be invalid.
Closesjp9000/obs-studio#954
Make sure the target file exists before attempting to create a backup.
This will allow for the function to work correctly if the target does
not yet exist.
Allows safely/atomically replacing a file and creating a backup of the
original. The reason for adding this function is because Microsoft
provides a ReplaceFile function which does this in a single call.