Skip to content

Commit

Permalink
Style nits
Browse files Browse the repository at this point in the history
  • Loading branch information
LibretroAdmin committed Jan 20, 2025
1 parent 350e4fa commit 4020326
Show file tree
Hide file tree
Showing 6 changed files with 133 additions and 132 deletions.
4 changes: 2 additions & 2 deletions audio/drivers/xaudio.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ static void xaudio2_free(xaudio2_t *handle)
}

static xaudio2_t *xaudio2_new(unsigned samplerate, unsigned channels,
size_t size, const char *device)
size_t len, const char *device)
{
int32_t idx_found = -1;
WAVEFORMATEX wfx = {0};
Expand Down Expand Up @@ -292,7 +292,7 @@ static xaudio2_t *xaudio2_new(unsigned samplerate, unsigned channels,
if (!handle->hEvent)
goto error;

handle->bufsize = size / MAX_BUFFERS;
handle->bufsize = len / MAX_BUFFERS;
handle->buf = (uint8_t*)calloc(1, handle->bufsize * MAX_BUFFERS);
if (!handle->buf)
goto error;
Expand Down
14 changes: 7 additions & 7 deletions core_option_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -754,8 +754,8 @@ static bool core_option_manager_parse_variable(
const char *value = option->vals->elems[i].data;
uint32_t value_hash = *((uint32_t*)option->vals->elems[i].userdata);

if ((value_hash == entry_value_hash) &&
string_is_equal(value, entry->value))
if ( (value_hash == entry_value_hash)
&& string_is_equal(value, entry->value))
{
option->index = i;
break;
Expand Down Expand Up @@ -928,9 +928,9 @@ static bool core_option_manager_parse_option(
* match an entry in the categories array
* > Category key cannot contain a map delimiter
* character */
if (opt->cats &&
!string_is_empty(category_key) &&
!strstr(category_key, ":"))
if ( opt->cats
&& !string_is_empty(category_key)
&& !strstr(category_key, ":"))
{
for (i = 0; i < opt->cats_size; i++)
{
Expand Down Expand Up @@ -960,8 +960,8 @@ static bool core_option_manager_parse_option(
{
/* If option has a category, option key
* cannot contain a map delimiter character */
if (!string_is_empty(option->category_key) &&
strstr(key, ":"))
if ( !string_is_empty(option->category_key)
&& strstr(key, ":"))
return false;

option->key = strdup(key);
Expand Down
39 changes: 19 additions & 20 deletions frontend/drivers/platform_wii.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ static void dol_copy_argv_path(const char *dolpath, const char *argpath)
}
/* a relative path */
else if (
(strstr(dolpath, "sd:/") != dolpath) &&
(strstr(dolpath, "usb:/") != dolpath) &&
(strstr(dolpath, "carda:/") != dolpath) &&
(strstr(dolpath, "cardb:/") != dolpath)
(strstr(dolpath, "sd:/") != dolpath)
&& (strstr(dolpath, "usb:/") != dolpath)
&& (strstr(dolpath, "carda:/") != dolpath)
&& (strstr(dolpath, "cardb:/") != dolpath)
)
{
fill_pathname_parent_dir(tmp,
Expand Down Expand Up @@ -165,17 +165,16 @@ static void dol_copy_raw_argv(const char *dolpath,
* heap memory and are restricted to the stack only. */
void system_exec_wii(const char *_path, bool should_load_game)
{
char path[PATH_MAX_LENGTH];
char args[PATH_MAX_LENGTH];
size_t args_size;
size_t size;
FILE *fp;
void *dol;
char path[PATH_MAX_LENGTH];
char args[PATH_MAX_LENGTH];
size_t _len, __len;
#ifndef IS_SALAMANDER
bool verbosity = verbosity_is_enabled();
#endif

args_size = 0;
__len = 0;

/* copy heap info into stack so it survives
* us moving the .dol into MEM2. */
Expand All @@ -190,7 +189,7 @@ void system_exec_wii(const char *_path, bool should_load_game)
if (net_st->fork_args.size)
{
memcpy(args, net_st->fork_args.args, net_st->fork_args.size);
args_size = net_st->fork_args.size;
__len = net_st->fork_args.size;
}
else
#endif
Expand All @@ -208,19 +207,19 @@ void system_exec_wii(const char *_path, bool should_load_game)
}

fseek(fp, 0, SEEK_END);
size = ftell(fp);
_len = ftell(fp);
fseek(fp, 0, SEEK_SET);

/* try to allocate a buffer for it. if we can't, fail. */
dol = malloc(size);
dol = malloc(_len);
if (!dol)
{
RARCH_ERR("Could not execute DOL file %s.\n", path);
fclose(fp);
goto exit;
}

fread(dol, 1, size, fp);
fread(dol, 1, _len, fp);
fclose(fp);

fatUnmount("carda:");
Expand All @@ -231,17 +230,17 @@ void system_exec_wii(const char *_path, bool should_load_game)
__io_usbstorage.shutdown();

/* don't use memcpy, there might be an overlap. */
memmove(EXECUTE_ADDR, dol, size);
DCFlushRange(EXECUTE_ADDR, size);
memmove(EXECUTE_ADDR, dol, _len);
DCFlushRange(EXECUTE_ADDR, _len);

if (args_size)
dol_copy_raw_argv(path, args, args_size);
if (__len)
dol_copy_raw_argv(path, args, __len);
else
dol_copy_argv_path(path, should_load_game ? args : NULL);

size = booter_end - booter_start;
memcpy(BOOTER_ADDR, booter_start, size);
DCFlushRange(BOOTER_ADDR, size);
_len = booter_end - booter_start;
memcpy(BOOTER_ADDR, booter_start, _len);
DCFlushRange(BOOTER_ADDR, _len);

SYS_ResetSystem(SYS_SHUTDOWN, 0, 0);
__lwp_thread_stopmultitasking((void (*)(void))BOOTER_ADDR);
Expand Down
Loading

0 comments on commit 4020326

Please sign in to comment.