Commit Graph

3580 Commits

Author SHA1 Message Date
LibretroAdmin
288b2da13e Create separate file compat_strldup.c since compat_strl.c is not
getting built-in for Apple targets at all
2022-08-25 16:50:12 +02:00
LibretroAdmin
575e331fd1 If we already know the length of the string, use strldup instead.
Avoids the internal strlen call inside strdup, and strdup is a deprecated
function starting from MSVC2005 anyways.

NOTE: Do NOT pass STRLEN_CONST as n parameter to strldup, it needs to
be at least +1 character higher than the strlen return value of the same
string
2022-08-25 16:31:54 +02:00
LibretroAdmin
da13fb0f48 Don't include errno.h in files that don't justify its use 2022-08-25 05:19:30 +02:00
Cthulhu-throwaway
e45958b25a
(Network) Get rid of the timeout_enable parameter for socket_connect (#14351) 2022-08-25 04:40:19 +02:00
LibretroAdmin
9aef0eff90 Resync 2022-08-24 16:41:21 +02:00
LibretroAdmin
6b9a382f2e Resync 2022-08-24 15:09:51 +02:00
LibretroAdmin
6894600d41 (stdstring) word_wrap - use strlcpy instead of strcpy 2022-08-24 15:06:03 +02:00
LibretroAdmin
e769436876 (word wrap functions in stdstring.c) Avoid implicit strlens, caller
should pass the 'length' to the function instead
2022-08-23 17:06:01 +02:00
Jamiras
85c44f9245
more thread-awareness in task callbacks (#14337)
* more thread-awareness in task callbacks
2022-08-23 15:11:11 +02:00
LibretroAdmin
6f738d4fbd Gradually get rid of strcpy_literal
Reasons:
1 - Just a macro for strcpy
1.2 - doesn't have a return type unlike strlcpy, can't be used
for string concatenation
1.3 - unsafe compared to strlcpy

Do either manual string assignment per character or strlcpy, no
inbetween by resorting to strcpy
2022-08-23 15:04:47 +02:00
LibretroAdmin
a96d12e8bc Put back property locking in threaded_gather_internal - without this,
core updater tasks would crash/segfault - heap corruption
2022-08-22 03:41:17 +02:00
Cthulhu-throwaway
e1a139ec0f
(Network Stream) Add function netstream_eof (#14335) 2022-08-21 21:52:57 +02:00
Cthulhu-throwaway
f27c8c0c1d
(Network Stream) Add string functions (#14333) 2022-08-20 16:36:13 +02:00
Jamiras
e0a065d20e
don't hold property_lock while gathering tasks (#14328) 2022-08-18 04:28:40 +02:00
Filipe Azevedo
e8668a5c71
rzipstream_tell: Fix missing tell for non compressed files (#14313)
The tell call would always return the compressed stream position.
2022-08-15 17:48:09 +02:00
Filipe Azevedo
d62b866237
rzipstream_gets: Fix missing eol (#14311)
The eol was always stripped from the data, leading to behavior
differences with filestream_gets and general read line implementations.
2022-08-11 23:17:00 +02:00
Cthulhu-throwaway
d3f3c58e61
(Network) Fix getnameinfo_retro's port value for HAVE_SOCKET_LEGACY platforms (#14303) 2022-08-08 15:28:42 +02:00
Cthulhu-throwaway
078f712b34
(WiiU) Attempt fix (#14302) 2022-08-07 20:32:27 +02:00
LibretroAdmin
c7786a45e1 Create path_get_extension_mutable and use it in menu_explore function
for trivial extension replacement in string
2022-08-06 19:06:31 +02:00
Cthulhu-throwaway
a7c93eb9ed
(PS3) Silence Warnings (#14287) 2022-08-05 12:45:35 +02:00
Cthulhu-throwaway
b04cb4b1e5
(PS3) Buildfix (#14285) 2022-08-05 04:19:28 +02:00
Cthulhu-throwaway
add4a1e8a0
(Network) Define inet_ntop and inet_pton for older Windows versions (#14284) 2022-08-05 02:23:35 +02:00
Cthulhu-throwaway
c6b99a5df0
(Network) Always have getaddrinfo and getnameinfo flags defined (#14283) 2022-08-04 23:06:28 +02:00
LibretroAdmin
2e5df6a973 fill_str_dated_filename: add size_t return value 2022-08-04 17:18:32 +02:00
LibretroAdmin
0c21a92581 * fill_pathname_expand_special will NULL-terminate string so not
necessary to NULL terminate passed string
* fill_pathname - add size_t return value
* Some general cleanups
2022-08-04 17:10:51 +02:00
LibretroAdmin
9ae46d2648 (file_path.c)
- file_path_expand_special - cut down on code duplication
- file_path_expand_special - add size_t return value
- fill_pathname_abbreviate_special - add size_t return value
2022-08-04 16:53:53 +02:00
LibretroAdmin
5172fe2ba6 fill_pathname_abbreviated_or_relative - add return value 2022-08-04 16:44:01 +02:00
LibretroAdmin
b2634ea588 * Create fill_pathname_join_special - and specify fill_pathname_join
as deprecated.
* Use fill_pathname_join_special in the vast majority of cases where
we can ensure out_path is a new empty string
* Get rid of some extension concatenation with strlcat where encountered
* Some general cleanups with NULL termination of strings that get immediately
passed to strlcpy/strlcpy-adjacent functions
2022-08-04 14:19:38 +02:00
Cthulhu-throwaway
3aa1811ca9
(Network) Add getnameinfo_retro (#14278) 2022-08-04 13:22:49 +02:00
LibretroAdmin
e7f3432e48 Replace some trivial strlcat usage - use return value of preceding
strlcpy then simply append the extension to it at this location
2022-08-04 03:45:09 +02:00
LibretroAdmin
f4c22cb236 (file_path.c) fill_pathname_join - do away with one less strlcat 2022-08-03 23:54:10 +02:00
LibretroAdmin
c240340c91 (vfs_implementation.c) We need to include stdstring.h for string_is_empty 2022-08-03 19:49:02 +02:00
LibretroAdmin
53d2fdbd97 net_http_urlencode - avoid one strlen call by clever use of strlcpy
return value and some subtraction arithmetic
2022-08-03 15:53:12 +02:00
LibretroAdmin
8e6369ef33 (vfs_implementation.c) An unnecessary repeated conditional removed 2022-08-03 15:19:54 +02:00
LibretroAdmin
7871e9fbc1 retro_vfs_file_open_impl - bunch of inefficiencies here:
- was doing a strlen first on path to calculate the length
- stored at least three local variables for string constants
- did another memcmp check after doing the length comparison conditional first
Simplify all this into a simple string comparison checking if the
path starts with the string 'vfsonly://' and/or 'cdrom://' -
avoid both strlen and memcmp cost. Also removed the need for
stdstring.h header include - just translated STRLEN_CONST into
(sizeof(x)-1) - no header file dependency for the only usage of stdstring.h
in this file
2022-08-03 15:07:02 +02:00
LibretroAdmin
33c9f56df0 (RPNG) PNG decoder - proper namespacing of functions, general cleanups 2022-08-02 15:55:26 +02:00
LibretroAdmin
342d3da620 (RPNG optimizations)
- Use memcpy to inflate_buf into array
- Some miscellaneous tweaks
2022-08-02 15:17:37 +02:00
LibretroAdmin
e6f3a387b2 png_reverse_filter_copy_line - optimization - paeth would always return
'b' input value (and input is unsigned, so abs would have no effect), so
get rid of the paeth function call for the first loop iteration
2022-08-02 13:22:13 +02:00
LibretroAdmin
78f4e0abda C89_BUILD buildfix 2022-08-02 11:34:41 +02:00
LibretroAdmin
a974cef001 (sinc resampler) Simplifications - call besseli0 directly instead of
through kaiser_window_function wrapper function - get rid of some unnecessary
sqrtf calls and such, some other small opts
2022-08-02 11:29:05 +02:00
LibretroAdmin
605c4608d9 Optimize fill_pathname_join - avoid the call to fill_pathname_slash()
which would have an implicit strlen cost
2022-08-01 22:14:26 +02:00
LibretroAdmin
e4bff7c12c Move rjsonwriter helper inline functions over to separate file rjson_helpers.h 2022-08-01 17:41:34 +02:00
LibretroAdmin
f79875536a (libretro-common) Move file_crc32 out of encoding_crc32.c - we don't want file I/O
code in encodings/encoding_crc32.c
2022-08-01 14:04:01 +02:00
LibretroAdmin
ec6f4c1f55 (libretro-common) refinements to documentation 2022-08-01 13:06:35 +02:00
LibretroAdmin
107c69ab9e (libretro-common) More documentation refinement 2022-08-01 11:03:58 +02:00
LibretroAdmin
c7a1d83675 (libretro-common) Start documenting leaf functon calls in function documentation
(libretro-common) docs - document when string has to be non-NULL or else UB (undefined behavior)
(libretro-common) stdstring.c - string_hex_to_unsigned - make strlen call unneeded
2022-08-01 09:52:39 +02:00
LibretroAdmin
fca6015011 (file_path) path_basedir - remove unnecessary strlcpy - add return value comment
to another function
2022-07-31 12:45:14 +02:00
LibretroAdmin
88bdaffa87 path_basedir_wrapper - get rid of unnecessary strlcpy 2022-07-31 12:42:50 +02:00
LibretroAdmin
36edb15c5b path_parent_dir - don't do implicit strlen inside 2022-07-31 12:31:55 +02:00
Cthulhu-throwaway
9b10579a54
(Network) Fix getaddrinfo_retro (#14261) 2022-07-31 11:22:28 +02:00