jp9000
b8355c656c
libobs/util: Also remove CR/LF from dstr_depad
...
Prevents newline characters from being included in things like stream
keys
2017-05-20 11:15:00 -07:00
jp9000
9e466a4697
libobs/util: Add function to get free disk space
2017-05-13 01:21:14 -07:00
fryshorts
0527cb5c15
libobs: Fix os_safe_replace not working linux
...
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.
2017-05-08 19:24:02 +02:00
jp9000
6fc74d69a9
libobs: Add functions to get logical/physical cores
2017-05-06 11:29:27 -07:00
jp9000
2537f9a5e2
libobs/util: Use MoveFileEx with MOVEFILE_REPLACE_EXISTING
...
Ensures that it will replace an old file if it exists.
2017-05-04 18:44:15 -07:00
jp9000
ac2f792d50
libobs/util: Flush text files when writing
...
Helps prevent the possibility of an empty file from being written.
2017-05-04 18:24:00 -07:00
jp9000
6d3777129d
libobs/util: Use os_safe_replace in safe file writes
2017-05-04 18:23:23 -07:00
jp9000
651d80c0df
libobs/util: Add os_safe_replace function
...
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.
2017-05-04 18:21:51 -07:00
jp9000
82d72803d6
libobs/util: Add Get function to BPtr<>
2017-05-04 05:46:29 -07:00
Ryan Foster
be98cee2a0
Fix various typos across multiple modules
2017-04-25 22:39:42 -04:00
jp9000
7fba736df9
libobs/util: Use a mutex with config files
2017-02-21 23:03:18 -08:00
jp9000
5868133587
libobs/util: Fix C++ compilation issue
...
When the C header circlebuf.h is used from a C++ source file, this
implicit cast from void to uint8_t* will cause an error unless changed
to an explicit cast.
2016-12-23 10:37:03 -08:00
jp9000
eb6d8e10fa
libobs/util: Do not ignore deprecation on windows
...
On MSVC, deprecated types/functions were being completely ignored by the
compiler due to this pragma. Any plugins/programs that depended on this
would also have this warning disabled due to it being in this file.
This pragma was most likely originally done due to the MSVC warnings for
C-standard functions, which are now ignored via _CRT_SECURE_NO_WARNINGS
on all projects instead.
2016-12-08 03:27:38 -08:00
jp9000
b29d8a44d1
libobs: Fix deprecated macro
...
There's no need to have two separate macros to declare something as
deprecated.
2016-12-08 03:27:37 -08:00
jp9000
b277000f97
libobs/util: Add function to generate formatted filenames
...
(Note: This commit also modifies the UI)
Being able to generate file names based upon a specification is useful
for more than just the UI; it can also be useful for things such as the
replay buffer where file names need to be generated on the fly.
2016-12-08 03:27:34 -08:00
jp9000
3aa6b50fbe
libobs/util: Add function to get circlebuf data offset
...
Allows getting pointer to an offset at a specific index within the
circlebuf data. Useful for iterating through circlebuf data.
2016-12-08 03:27:33 -08:00
Ryan Foster and jp9000
788a1e22b7
libobs: Refactor check for Windows bitness/arch
...
Commit aa899c2 (PR #603 ) added logging for Windows bitness/arch, but it
was a bit incomplete/short-sighted. It only added that information to
the regular logs. This commit makes it easier to retrieve that
information for other purposes, like the crash handler.
2016-11-09 12:41:07 -08:00
jp9000
39a91d749c
libobs/util: Add Get() function to CoTaskMemPtr
2016-10-23 09:20:54 -07:00
Jim and GitHub
ad2550e060
Merge pull request #628 from RytoEX/master
...
libobs/util: Fix get_dll_ver not reporting DLL name
2016-10-09 19:46:21 -07:00
jp9000
8b877f7c36
libobs/util: Fix fread_utf8 not working with files < 3 bytes
...
When it was checking for the BOM at the beginning of the file, it would
just return out of the function if it didn't read at least 3 bytes.
This would particularly affect text sources.
2016-09-28 02:01:30 -07:00
Ryan Foster
87f4d586b0
libobs/util: Fix get_dll_ver not reporting DLL name
...
Follow-up to commit 2cf5c5f .
2016-09-24 14:14:53 -04:00
jp9000
2cf5c5f7f7
libobs/util: Fix get_dll_ver always getting kernel32 info
2016-09-19 17:52:20 -07:00
Ryan Foster and jp9000
47aa56b3e9
libobs/util: Fix Windows 10 revision detection
...
Sometimes the revision number isn't put in to the kernel32.dll version
information. It's best to use the registry in this case.
2016-09-19 17:52:19 -07:00
jp9000
6b2862fe1e
Revert "libobs/util: Add index operator to BPtr"
...
This reverts commit 7224e8d36e .
This change was unnecessary due to the fact that indexing is already
performed automatically via the cast operator.
2016-09-14 16:59:47 -07:00
jp9000
7224e8d36e
libobs/util: Add index operator to BPtr
2016-09-06 04:43:52 -07:00
Colin Edwards and jp9000
0c0f6031e2
libobs/util: Use FormatMessage on error when LoadLibrary fails
...
Outputting a human-readable error message on library load failure makes
it a little bit easier for plugin developers to determine why a plugin
library may have failed to load (such as missing dependency), rather
than having to look up the error code each time.
Closes jp9000/obs-studio#596
2016-08-19 17:04:44 -07:00
jp9000
a576439f22
libobs/util: Fix possible null pointer dereference
...
Never checks to see whether the source dstr is empty before copying, and
will crash if empty.
2016-08-08 04:56:26 -07:00
jp9000
4f4d7cde7e
libobs/util: Add os_get_program_data_path* functions
...
Allows getting the system-local program data path. Typically:
Windows: C:\ProgramData
Mac: /Library/Application Support
Linux: /usr/local/share
2016-07-06 03:47:50 -07:00
jp9000
d5e2cdf4d3
libobs/util: Add func to go to next CF token and copy it
...
Adds a function to the C-family parser to go to the next token and
create a string copy of it. Useful for when you want to get a copy of
the next token regardless of what type it is.
2016-06-28 02:46:35 -07:00
jp9000
9948eee6c2
libobs/util: Add function to get path extension
2016-06-15 16:18:56 -07:00
jp9000
695278dd42
libobs/util: Do not append .so w/ .dylibs on OSX
2016-06-06 23:46:55 -07:00
jp9000
1c37200549
libobs/util: Check for null pointer before calling dlclose
...
Apparently dlclose can crash if you use it with a null pointer.
2016-05-30 16:03:01 -07:00
jp9000
8b2173f591
libobs/util: Add double-quote escape value for text lookup
2016-04-10 02:11:03 -07:00
jp9000
ac23ec8359
libobs/util: Fix warning (data type size mismatch)
...
Fixes warning on Visual Studio 2013:
'initializing' : conversion from 'size_t' to 'int', possible loss of
data
2016-04-09 18:15:47 -07:00
jp9000
81ac57cd6c
libobs/util: Add os_stat function (win32 compatibility)
...
Windows needs filenames to be processed as wide, while libobs operates
on UTF-8, so a windows-specific function is needed here.
2016-04-03 18:02:45 -07:00
jp9000
e9a814740b
libobs/util: Fix copy sizes in dstr_insert_* functions
...
These functions would copy the wrong amount of data, resulting in
writing to memory that may not be allocated.
2016-03-21 21:22:26 -07:00
jp9000
ae8b4bc538
libobs/util: Make sure to set capacity in dstr_ncopy* funcs
2016-03-21 21:22:25 -07:00
jp9000
45a2fa0e1a
libobs/util: Make sure includes are from current file dir
...
When the #include directive in in the C lexer preprocessor is
encountered, the files being included need to be relative to the
directory of the file that the include was used in.
2016-03-21 21:22:25 -07:00
jp9000
38f368aa80
libobs/util: Make all atomic funcs inline and use intrinsics
...
Needless function calls here for what should be intrinsic calls
2016-01-23 07:17:44 -08:00
jp9000
4543cd168d
libobs/util: Add long load/store atomic funcs
2015-12-28 05:49:55 -08:00
jp9000
9f9a4bc3f3
libobs/util: Add uint128 structure/functions
...
Allows some limited 128bit integer math functions, primarily for the
sake of performing calculations on nanosecond-based intervals of time
2015-12-22 06:18:17 -08:00
jp9000
7a81d3d6d7
libobs/util: Add circlebuf pop_back/peek_back functions
2015-12-22 06:18:16 -08:00
jp9000
c2168cf9e8
libobs/util: Don't perform calculation until data checked
2015-12-22 06:18:15 -08:00
jp9000
c6914fda45
libobs/util: Add circlebuf_push_front function
2015-12-22 06:18:14 -08:00
jp9000
091706920f
libobs/util: Use malloc/free for temp darray allocations
2015-12-15 01:11:09 -08:00
jp9000
69ab209fdd
libobs/util: Use correct dereferenced size with da_swap
2015-12-15 01:11:09 -08:00
jp9000
e23a20874b
libobs/util: Rename da_swap_item to da_swap
...
The name was inconsistent with the darray_swap function that it's a
macro for.
2015-12-15 01:11:07 -08:00
jp9000
4e55cf1125
libobs/util: Add function deprecation defines
2015-12-11 16:45:31 -08:00
Palana
1cd98ae008
libobs/util: Fix config value line break unescaping
...
Given a config file with some value "foo=\\n" querying the value of foo
would return {'\\', '\n', 0}, instead of {'\\', 'n', 0}
2015-11-27 15:48:30 +01:00
jp9000
d1cbb2742e
libobs/util: Use SIGTRAP for os_breakpoint
...
SIGTRAP is the correct value to use to specify a breakpoint.
2015-11-18 18:59:54 -08:00