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.
(Note: This commit also modified text-freetype2)
Prevents issues from being able to update files that may not be using
the current system encoding on windows.
(Note: This commit also modified text-freetype2)
The implementation of get_modified_timestamp() did not check the return
value of stat(), so in case the check fails the values in the stats
structure can be any garbage on the stack and the value of
stats.st_mtime can change on every call. This can trigger a reload of
the image every second, even if the file was not actually modified.
Closesjp9000/obs-studio#520
Found via UBSan, actual (sample) error:
"plugins/text-freetype2/text-functionality.c:284:26: runtime error: left
shift of 194 by 24 places cannot be represented in type 'int'"
On windows, carriage return characters are used along with line feed
characters. When the carriage return is used, it's rendered as a space.
This removes carriage returns from strings before rendering them via
freetype.
Doing this in the expression will cause it to execute the function every
time the expression is evaluated, which is needless cycles wasted.
Instead, call wcslen before the loops begin.
Typedef pointers are unsafe. If you do:
typedef struct bla *bla_t;
then you cannot use it as a constant, such as: const bla_t, because
that constant will be to the pointer itself rather than to the
underlying data. I admit this was a fundamental mistake that must
be corrected.
All typedefs that were pointer types will now have their pointers
removed from the type itself, and the pointers will be used when they
are actually used as variables/parameters/returns instead.
This does not break ABI though, which is pretty nice.
GCC marks fread as a function that will throw a warning if you do not
use its return value. This is most likely done as a measure to ensure
code security.