Commit Graph

237 Commits (81adb13f590dc1e5235d5f1cd0a4949d9fb1774c)

Author SHA1 Message Date
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
jp9000 9e17f41caf libobs/util: Don't perform memalign trick of pointer null 2015-11-18 18:46:21 -08:00
jp9000 52d5a9b0b4 libobs/util: Breakpoint crash on "out of memory"
This forces proper crash handling to generate a stack trace.
2015-11-18 12:42:15 -08:00
jp9000 fa5c477826 libobs/util: Add os_breakpoint function 2015-11-18 12:42:15 -08:00
jp9000 598ae383bc libobs/util: Add atomic bool load functions 2015-11-18 12:42:14 -08:00
jp9000 1e1f442a61 libobs/util: Remove unnecessary allocations (win32)
Removes unnecessary allocations for the os_event_* and os_sem_*
thread functions
2015-11-11 16:52:48 -08:00
Richard Stanway 94b5bc222b libobs: Rename create_proccess to create_process 2015-11-06 18:25:53 +01:00
Richard Stanway 3671153a4f libobs: Don't use SPI_SETSCREENSAVEACTIVE on Windows
SetThreadExecutionState with ES_DISPLAY_REQUIRED has the same effect of preventing the screensaver from activating. Using SPI_SETSCREENSAVEACTIVE leaves the screensaver disabled system-wide if OBS crashes before it can re-enable it.
2015-11-05 03:58:26 +01:00
jp9000 a914bb24fa libobs/util: Add atomic functions for bool values 2015-11-03 15:03:39 -08:00
adray e354a433c7 libobs/util: Add function to get free space
Meant as a part of solving mantis issue 105 ("Disk space usage monitor
when recording").

From pull request: jp9000/obs-studio#374
Relevant mantis issue: https://obsproject.com/mantis/view.php?id=105
2015-10-15 01:43:23 -07:00
adray 3e6db990fc libobs/util: Add function to get file size
From pull request: jp9000/obs-studio#374
2015-10-15 01:41:37 -07:00
jp9000 d542663478 libobs/util: Add os_get_abs_path(_ptr) functions
These functions resolve the absolute path from a relative path.
2015-10-15 01:35:18 -07:00
jp9000 1bcbaf8e75 libobs: Use byte sequence for non-breaking spaces
Use explicit UTF-8 byte sequence for the "no-break space" character.

Prevents issues with certain editors, and fixes the following compiler
warning on Visual C++:

warning C4819: The file contains a character that cannot be represented
in the current code page (X). Save the file in Unicode format to prevent
data loss
2015-10-15 01:31:07 -07:00
jp9000 8a0a28bf27 libobs/util: Add get_dll_ver function (windows)
Used to get the version of a dynamic link library on windows.
2015-10-04 21:16:28 -07:00
jp9000 48550b9691 libobs/util: Add function to calculate CRC32 2015-10-04 21:16:27 -07:00
jp9000 05748195a8 libobs/util: Save filename in config_create
Fixes a bug where config_save could not save the file due to the fact
that it did not store the path of the file as it was supposed to.
2015-10-04 21:16:26 -07:00
jp9000 b3d6d9e49d libobs: Add file serializers 2015-10-04 21:16:25 -07:00
jp9000 8c1fb99e99 libobs/util: Use int64_t as return for serializer
Intended as a means of expressing an error occurred (-1) when performing
a seek or getting a position.
2015-10-04 21:16:24 -07:00
jp9000 0a228d0740 libobs/util: Use gzopen* instead of gzdopen
Using gzdopen will not work properly if the C standard library used to
get the descriptor is not the same library as the one that was compiled
with zlib.  When this is the case, it causes zlib to fail to write a
file, and would report a C standard library error.  Use gzopen and
gzopen_w instead to ensure that the file is opened and closed by zlib
itself, ensuring that zlib and the libobs do not have to share the C
standard library between each other.
2015-09-21 00:01:19 -07:00
jp9000 d78d0072a0 libobs/util: Add functions to inhibit sleep
These fucntions prevent the computer from going to sleep, hibernating,
or starting up a screen saver.

On linux, it will also attempt to use DBus to prevent gnome/kde/etc
sleep, but it's not necessarily required in order to compile the
library.  Otherwise, it will simply call "xdg-screensaver reset" once
every 30 seconds to reset the screensaver timer.
2015-09-12 22:08:05 -07:00
Palana b2714fa353 libobs/util: Restore original code point
This was broken in cd222f8ce0 which had a
horrible commit message that makes replicating the issue impossible if
there weren't others who reported similar visual studio issues when
using a Japanese locale
2015-09-08 11:36:19 +02:00
jp9000 46101b6d5b libobs: Fix various string format warnings
GCC 5.1+ seems to be more aggressive about spotting potentially
non-matching printf format specifiers.
2015-08-30 23:41:09 -07:00
jp9000 f29431d8db libobs/util: Add config_save_safe function
This safely saves a configuration file, optionally with a backup.
2015-08-21 17:42:24 -07:00
jp9000 3a77ac3516 libobs/util: Add os_quick_write_utf8_file_safe
This helper function saves to a temporary file first, (optionally) backs
up the original file, then renames the temporary file to the actual file
name.  This helps reduce the chance of file corruption under various
circumstances (such as shutdown or crash while the file is being written
to disk).
2015-08-21 17:31:23 -07:00
jp9000 cd222f8ce0 libobs/util: Fix character encoding issue
Manually specifies the UTF-8 character codes used by the file rather
than relying on the compiler to determine what the codes are manually.
I was getting compile errors due to the fact that my current code page
is not at the default code page; so visual c++ tried to use my current
code page rather than UTF-8 and it would cause an error on the file.
2015-08-19 11:56:17 -07:00
Palana 13b2469d61 libobs/util: Extend profiler csv export data
The id and parent_id fields should now allow better recovery of the
actual call trees, though they aren't compatible between different data
dumps in a single profiler session anymore; for that reason the new
fields name_id and parent_name_id are introduced, they hold the old id
and parent_id values respectively
2015-08-13 11:57:42 +02:00
Palana 91ea844333 libobs/util: Add compressed profiler snapshot saving 2015-08-12 15:30:30 +02:00
Palana d9cf5c668b libobs/util: Add profiler 2015-08-12 15:30:28 +02:00
jp9000 0fb79a4733 libobs: Use get_win_ver (not GetVersionEx) 2015-08-01 14:51:22 -07:00