Skip to content

Commit 668749a

Browse files
committed
Resync
1 parent e9a4ccc commit 668749a

23 files changed

+268
-242
lines changed

file/config_file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,7 @@ config_file_t *config_file_new_from_path_to_string(const char *path)
841841
{
842842
if (path_is_valid(path))
843843
{
844-
uint8_t *ret_buf = NULL;
844+
uint8_t *ret_buf = NULL;
845845
int64_t length = 0;
846846
if (filestream_read_file(path, (void**)&ret_buf, &length))
847847
{

file/file_path.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ void path_linked_list_add_path(struct path_linked_list *in_path_llist,
146146
in_path_llist->path = strdup(path);
147147
else
148148
{
149-
struct path_linked_list *node = (struct path_linked_list*) malloc(sizeof(*node));
149+
struct path_linked_list *node = (struct path_linked_list*)malloc(sizeof(*node));
150150

151151
if (node)
152152
{
@@ -1401,7 +1401,7 @@ size_t fill_pathname_application_path(char *s, size_t len)
14011401
return strlcpy(s, info.name, len);
14021402
}
14031403
#elif defined(__QNX__)
1404-
char *buff = malloc(len);
1404+
char *buff = (char*)malloc(len);
14051405
size_t _len = 0;
14061406
if (_cmdname(buff))
14071407
_len = strlcpy(s, buff, len);

formats/bmp/rbmp.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -231,22 +231,22 @@ static int rbmp_bitcount(unsigned int a)
231231

232232
static int rbmp_shiftsigned(int v, int shift, int bits)
233233
{
234-
int result;
234+
int ret;
235235
int z = bits;
236236

237237
if (shift < 0)
238238
v <<= -shift;
239239
else
240240
v >>= shift;
241241

242-
result = v;
242+
ret = v;
243243

244244
while (z < 8)
245245
{
246-
result += v >> z;
247-
z += bits;
246+
ret += v >> z;
247+
z += bits;
248248
}
249-
return result;
249+
return ret;
250250
}
251251

252252
static unsigned char *rbmp_bmp_load(rbmp_context *s, unsigned *x, unsigned *y,

formats/json/rjson.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1011,7 +1011,7 @@ double rjson_get_double(rjson_t *json)
10111011
snprintf(test, sizeof(test), "%.1f", 0.0f);
10121012
json->decimal_sep = test[1];
10131013
}
1014-
if (json->decimal_sep != '.' && (p = strchr(str, '.')) != NULL)
1014+
if (json->decimal_sep != '.' && (p = memchr(str, '.', strlen(str) + 1)) != NULL)
10151015
{
10161016
double res;
10171017
*p = json->decimal_sep;

formats/png/rpng_encode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ uint8_t* rpng_save_image_bgr24_string(const uint8_t *data,
410410
if (!buf)
411411
GOTO_END_ERROR();
412412

413-
intf_s = intfstream_open_writable_memory(buf,
413+
intf_s = intfstream_open_memory(buf,
414414
RETRO_VFS_FILE_ACCESS_WRITE,
415415
RETRO_VFS_FILE_ACCESS_HINT_NONE,
416416
_len);

include/cdrom/cdrom.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ unsigned cdrom_msf_to_lba(unsigned char min, unsigned char sec, unsigned char fr
7474

7575
void increment_msf(unsigned char *min, unsigned char *sec, unsigned char *frame);
7676

77-
int cdrom_read_subq(libretro_vfs_implementation_file *stream, unsigned char *buf, size_t len);
77+
int cdrom_read_subq(libretro_vfs_implementation_file *stream, unsigned char *s, size_t len);
7878

7979
int cdrom_write_cue(libretro_vfs_implementation_file *stream, char **out_buf, size_t *out_len, char cdrom_drive, unsigned char *num_tracks, cdrom_toc_t *toc);
8080

include/file/file_path.h

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -194,49 +194,49 @@ size_t path_basedir(char *path);
194194

195195
/**
196196
* path_parent_dir:
197-
* @path : path
198-
* @len : length of @path
197+
* @s : path
198+
* @len : size of buffer
199199
*
200200
* Extracts parent directory by mutating path.
201201
* Assumes that path is a directory. Keeps trailing '/'.
202202
* If the path was already at the root directory, returns empty string
203203
**/
204-
size_t path_parent_dir(char *path, size_t len);
204+
size_t path_parent_dir(char *s, size_t len);
205205

206206
/**
207207
* path_resolve_realpath:
208-
* @buf : input and output buffer for path
208+
* @s : input and output buffer for path
209209
* @size : size of buffer
210210
* @resolve_symlinks : whether to resolve symlinks or not
211211
*
212212
* Resolves use of ".", "..", multiple slashes etc in absolute paths.
213213
*
214214
* Relative paths are rebased on the current working dir.
215215
*
216-
* @return @buf if successful, NULL otherwise.
216+
* @return @s if successful, NULL otherwise.
217217
* Note: Not implemented on consoles
218218
* Note: Symlinks are only resolved on Unix-likes
219219
* Note: The current working dir might not be what you expect,
220220
* e.g. on Android it is "/"
221221
* Use of fill_pathname_resolve_relative() should be preferred
222222
**/
223-
char *path_resolve_realpath(char *buf, size_t len, bool resolve_symlinks);
223+
char *path_resolve_realpath(char *s, size_t len, bool resolve_symlinks);
224224

225225
/**
226226
* path_relative_to:
227-
* @out : buffer to write the relative path to
227+
* @s : buffer to write the relative path to
228228
* @path : path to be expressed relatively
229229
* @base : relative to this
230-
* @size : size of output buffer
230+
* @len : size of output buffer
231231
*
232-
* Turns @path into a path relative to @base and writes it to @out.
232+
* Turns @path into a path relative to @base and writes it to @s.
233233
*
234234
* @base is assumed to be a base directory, i.e. a path ending with '/' or '\'.
235235
* Both @path and @base are assumed to be absolute paths without "." or "..".
236236
*
237237
* E.g. path /a/b/e/f.cgp with base /a/b/c/d/ turns into ../../e/f.cgp
238238
*
239-
* @return Length of the string copied into @out
239+
* @return Length of the string copied into @s
240240
**/
241241
size_t path_relative_to(char *s, const char *path, const char *base,
242242
size_t len);
@@ -277,7 +277,7 @@ bool path_is_absolute(const char *path);
277277
* - calls strrchr
278278
* - calls strlcat
279279
*
280-
* @return Length of the string copied into @out
280+
* @return Length of the string copied into @s
281281
*/
282282
size_t fill_pathname(char *s, const char *in_path,
283283
const char *replace, size_t len);
@@ -371,23 +371,23 @@ size_t fill_pathname_dir(char *s, const char *in_basename,
371371
* fill_pathname_base:
372372
* @s : output path
373373
* @in_path : input path
374-
* @size : size of output path
374+
* @len : size of output path
375375
*
376376
* Copies basename of @in_path into @s.
377377
*
378378
* Hidden non-leaf function cost:
379379
* - Calls path_basename()
380380
* - Calls strlcpy
381381
*
382-
* @return length of the string copied into @out
382+
* @return length of the string copied into @s
383383
**/
384384
size_t fill_pathname_base(char *s, const char *in_path, size_t len);
385385

386386
/**
387387
* fill_pathname_basedir:
388388
* @s : output directory
389389
* @in_path : input path
390-
* @size : size of output directory
390+
* @len : size of output directory
391391
*
392392
* Copies base directory of @in_path into @s.
393393
* If in_path is a path without any slashes (relative current directory),
@@ -405,7 +405,7 @@ size_t fill_pathname_basedir(char *s, const char *in_path, size_t len);
405405
* @in_dir : input directory
406406
* @len : size of @s
407407
*
408-
* Copies only the parent directory name of @in_dir into @out_dir.
408+
* Copies only the parent directory name of @in_dir into @s.
409409
* The two buffers must not overlap. Removes trailing '/'.
410410
*
411411
* Hidden non-leaf function cost:
@@ -419,17 +419,17 @@ size_t fill_pathname_parent_dir_name(char *s,
419419

420420
/**
421421
* fill_pathname_parent_dir:
422-
* @out_dir : output directory
422+
* @s : output directory
423423
* @in_dir : input directory
424-
* @size : size of output directory
424+
* @len : size of output directory
425425
*
426-
* Copies parent directory of @in_dir into @out_dir.
426+
* Copies parent directory of @in_dir into @s.
427427
* Assumes @in_dir is a directory. Keeps trailing '/'.
428-
* If the path was already at the root directory, @out_dir will be an empty string.
428+
* If the path was already at the root directory, @s will be an empty string.
429429
*
430430
* Hidden non-leaf function cost:
431-
* - Can call strlcpy if (@out_dir != @in_dir)
432-
* - Calls strlen if (@out_dir == @in_dir)
431+
* - Can call strlcpy if (@s!= @in_dir)
432+
* - Calls strlen if (@s == @in_dir)
433433
* - Calls path_parent_dir()
434434
*
435435
* @return Length of the string copied into @s
@@ -442,7 +442,7 @@ size_t fill_pathname_parent_dir(char *s,
442442
* @s : output path
443443
* @in_refpath : input reference path
444444
* @in_path : input path
445-
* @size : size of @s
445+
* @len : size of @s
446446
*
447447
* Joins basedir of @in_refpath together with @in_path.
448448
* If @in_path is an absolute path, s = in_path.
@@ -457,7 +457,7 @@ void fill_pathname_resolve_relative(char *s, const char *in_refpath,
457457
* @s : output path
458458
* @dir : directory
459459
* @path : path
460-
* @size : size of output path
460+
* @len : size of output path
461461
*
462462
* Joins a directory (@dir) and path (@path) together.
463463
* Makes sure not to get two consecutive slashes
@@ -480,7 +480,7 @@ size_t fill_pathname_join(char *s, const char *dir,
480480
* @s : output path
481481
* @dir : directory. Cannot be identical to @s
482482
* @path : path
483-
* @size : size of output path
483+
* @len : size of output path
484484
*
485485
*
486486
* Specialized version of fill_pathname_join.
@@ -510,7 +510,7 @@ size_t fill_pathname_join_special_ext(char *s,
510510
* @dir : directory
511511
* @path : path
512512
* @delim : delimiter
513-
* @size : size of output path
513+
* @len : size of output path
514514
*
515515
* Joins a directory (@dir) and path (@path) together
516516
* using the given delimiter (@delim).
@@ -548,7 +548,7 @@ size_t fill_pathname_abbreviated_or_relative(char *s,
548548
* sanitize_path_part:
549549
*
550550
* @path_part : directory or filename
551-
* @size : length of path_part
551+
* @len : length of path_part
552552
*
553553
* Takes single part of a path eg. single filename
554554
* or directory, and removes any special chars that are
@@ -621,8 +621,8 @@ void path_basedir_wrapper(char *s);
621621

622622
/**
623623
* fill_pathname_slash:
624-
* @path : path
625-
* @size : size of path
624+
* @s : path
625+
* @len : size of path
626626
*
627627
* Assumes path is a directory. Appends a slash
628628
* if not already there.

include/libretro.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2575,6 +2575,18 @@ enum retro_mod
25752575
*/
25762576
#define RETRO_ENVIRONMENT_GET_FILE_BROWSER_START_DIRECTORY 80
25772577

2578+
/**
2579+
* Returns the audio sample rate the frontend is targeting, in Hz.
2580+
* The intended use case is for the core to use the result to select an ideal sample rate.
2581+
*
2582+
* @param[out] data <tt>unsigned *</tt>.
2583+
* Pointer to the \c unsigned integer in which the frontend will store its target sample rate.
2584+
* Behavior is undefined if \c data is <tt>NULL</tt>.
2585+
* @return \c true if this environment call is available,
2586+
* regardless of the value returned in \c data.
2587+
*/
2588+
#define RETRO_ENVIRONMENT_GET_TARGET_SAMPLE_RATE (81 | RETRO_ENVIRONMENT_EXPERIMENTAL)
2589+
25782590
/**@}*/
25792591

25802592
/**

include/streams/file_stream_transforms.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ int64_t rfread(void* buffer,
9696
size_t elem_size, size_t elem_count, RFILE* stream);
9797

9898
/** @see https://en.cppreference.com/w/c/io/fgets */
99-
char *rfgets(char *buffer, int maxCount, RFILE* stream);
99+
char *rfgets(char *s, int maxCount, RFILE* stream);
100100

101101
/** @see https://en.cppreference.com/w/c/io/fgetc */
102102
int rfgetc(RFILE* stream);

include/streams/interface_stream.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ intfstream_t *intfstream_open_file(const char *path,
121121
intfstream_t *intfstream_open_memory(void *data,
122122
unsigned mode, unsigned hints, uint64_t size);
123123

124+
/* Deprecated. Has the same effect as `intfstream_open_memory` with
125+
a mode including `RETRO_VFS_FILE_ACCESS_WRITE`. */
124126
intfstream_t *intfstream_open_writable_memory(void *data,
125127
unsigned mode, unsigned hints, uint64_t size);
126128

0 commit comments

Comments
 (0)