Style nits

This commit is contained in:
LibretroAdmin 2025-02-12 10:35:04 +01:00
parent f6006ae6ca
commit d2d0e7a17d
6 changed files with 104 additions and 102 deletions

View File

@ -420,8 +420,8 @@ static bool menu_screensaver_update_state(
#endif
/* Check if dimensions have changed */
if ((screensaver->last_width != width) ||
(screensaver->last_height != height))
if ( (screensaver->last_width != width)
|| (screensaver->last_height != height))
{
menu_screensaver_set_dimensions(screensaver, width, height);
@ -453,9 +453,9 @@ static bool menu_screensaver_update_state(
}
/* Create font, if required */
if ((screensaver->effect != MENU_SCREENSAVER_BLANK) &&
!screensaver->font_data.font &&
screensaver->font_enabled)
if ( (screensaver->effect != MENU_SCREENSAVER_BLANK)
&& !screensaver->font_data.font
&& screensaver->font_enabled)
{
char font_file[PATH_MAX_LENGTH];
#if defined(HAVE_FREETYPE) || (defined(__APPLE__) && defined(HAVE_CORETEXT)) || defined(HAVE_STB_FONT)
@ -623,11 +623,11 @@ void menu_screensaver_iterate(
/* Reset particle if it has:
* - Dropped off the edge of the screen
* - Reached the screen depth */
if ((particle->x < -particle_size_px) ||
(particle->x > (float)width + particle_size_px) ||
(particle->y < -particle_size_px) ||
(particle->y > (float)height + particle_size_px) ||
(particle->c <= 0.0f))
if ( (particle->x < -particle_size_px)
|| (particle->x > (float)width + particle_size_px)
|| (particle->y < -particle_size_px)
|| (particle->y > (float)height + particle_size_px)
|| (particle->c <= 0.0f))
{
/* x pos ('physical' space) */
particle->a = (float)(rand() % width);

View File

@ -12595,8 +12595,8 @@ static bool setting_append_list(
}
#if defined(DINGUX) && defined(DINGUX_BETA)
if (string_is_equal(settings->arrays.video_driver, "sdl_dingux") ||
string_is_equal(settings->arrays.video_driver, "sdl_rs90"))
if ( string_is_equal(settings->arrays.video_driver, "sdl_dingux")
|| string_is_equal(settings->arrays.video_driver, "sdl_rs90"))
{
CONFIG_UINT(
list, list_info,

View File

@ -805,9 +805,11 @@ static bool netplay_handshake_init_send(netplay_t *netplay,
connection->ping = -1;
connection->ping_timer = cpu_features_get_time_usec();
if (!netplay_send(&connection->send_packet_buffer, connection->fd, header,
sizeof(header)) ||
!netplay_send_flush(&connection->send_packet_buffer, connection->fd, false))
if ( !netplay_send(&connection->send_packet_buffer,
connection->fd, header,
sizeof(header))
|| !netplay_send_flush(&connection->send_packet_buffer,
connection->fd, false))
return false;
return true;
@ -866,13 +868,11 @@ static bool netplay_handshake_nick(netplay_t *netplay,
/* Second ping */
connection->ping_timer = cpu_features_get_time_usec();
if (!netplay_send(&connection->send_packet_buffer, connection->fd,
&nick_buf, sizeof(nick_buf)) ||
!netplay_send_flush(&connection->send_packet_buffer, connection->fd,
false))
if ( !netplay_send(&connection->send_packet_buffer,
connection->fd, &nick_buf, sizeof(nick_buf))
|| !netplay_send_flush(&connection->send_packet_buffer,
connection->fd, false))
return false;
return true;
}
@ -1233,10 +1233,10 @@ static bool netplay_handshake_info(netplay_t *netplay,
connection->ping_timer = cpu_features_get_time_usec(); /* Third ping */
/* Send it off and wait for info back */
if (!netplay_send(&connection->send_packet_buffer, connection->fd,
&info_buf, sizeof(info_buf)) ||
!netplay_send_flush(&connection->send_packet_buffer, connection->fd,
false))
if ( !netplay_send(&connection->send_packet_buffer,
connection->fd, &info_buf, sizeof(info_buf))
|| !netplay_send_flush(&connection->send_packet_buffer,
connection->fd, false))
return false;
return true;
@ -1380,10 +1380,10 @@ static bool netplay_handshake_sync(netplay_t *netplay,
autosave_lock();
#endif
core_get_memory(&mem_info);
if (!netplay_send(&connection->send_packet_buffer, connection->fd,
mem_info.data, mem_info.size) ||
!netplay_send_flush(&connection->send_packet_buffer, connection->fd,
false))
if ( !netplay_send(&connection->send_packet_buffer,
connection->fd, mem_info.data, mem_info.size)
|| !netplay_send_flush(&connection->send_packet_buffer,
connection->fd, false))
{
#ifdef HAVE_THREADS
autosave_unlock();
@ -2989,8 +2989,9 @@ static void merge_analog_part(netplay_t *netplay,
value += (int32_t) new_value;
break;
default:
if (abs(new_value) > abs(value) ||
(abs(new_value) == abs(value) && new_value > value))
if ( abs(new_value) > abs(value)
|| (abs(new_value) == abs(value)
&& new_value > value))
value = new_value;
}
}
@ -3771,9 +3772,11 @@ static bool netplay_sync_pre_frame(netplay_t *netplay)
goto process;
}
if (!netplay_init_socket_buffer(&connection->send_packet_buffer,
netplay->packet_buffer_size) ||
!netplay_init_socket_buffer(&connection->recv_packet_buffer,
if ( !netplay_init_socket_buffer(
&connection->send_packet_buffer,
netplay->packet_buffer_size)
|| !netplay_init_socket_buffer(
&connection->recv_packet_buffer,
netplay->packet_buffer_size))
{
netplay_deinit_socket_buffer(&connection->send_packet_buffer);
@ -3818,8 +3821,9 @@ static void netplay_sync_input_post_frame(netplay_t *netplay, bool stalled)
}
/* We've finished an input frame even if we're stalling */
if ((!stalled || netplay->stall == NETPLAY_STALL_INPUT_LATENCY) &&
netplay->self_frame_count <
if (( !stalled
|| netplay->stall == NETPLAY_STALL_INPUT_LATENCY)
&& netplay->self_frame_count <
netplay->run_frame_count + netplay->input_latency_frames)
{
netplay->self_ptr = NEXT_PTR(netplay->self_ptr);
@ -6128,7 +6132,9 @@ static bool netplay_get_cmd(netplay_t *netplay,
#ifdef HAVE_CHEEVOS
/* did not receive a protocol 7 packet. server isn't sending achievement data. disable hardcore */
if (!netplay->is_server && rcheevos_hardcore_active() && !netplay_is_spectating())
if ( !netplay->is_server
&& rcheevos_hardcore_active()
&& !netplay_is_spectating())
{
const char* msg = msg_hash_to_str(MSG_CHEEVOS_HARDCORE_MODE_REQUIRES_NEWER_HOST);
runloop_msg_queue_push(msg, strlen(msg), 0, 180, true, NULL,
@ -6464,8 +6470,8 @@ static bool netplay_get_cmd(netplay_t *netplay,
{
/* If client, we receive both the nickname and
the message from the server. */
if (cmd_size <= sizeof(nickname) ||
cmd_size >= sizeof(nickname) + sizeof(message))
if ( cmd_size <= sizeof(nickname)
|| cmd_size >= sizeof(nickname) + sizeof(message))
{
RARCH_ERR("[Netplay] NETPLAY_CMD_PLAYER_CHAT with incorrect payload size.\n");
return netplay_cmd_nak(netplay, connection);
@ -6814,9 +6820,10 @@ static int init_tcp_connection(netplay_t *netplay, const struct addrinfo *addr,
/* Tunnel server should provide us with our session ID. */
if ( socket_send_all_blocking_with_timeout(fd,
&new_session, sizeof(new_session), 5000, true) &&
socket_receive_all_blocking_with_timeout(fd,
&netplay->mitm_session_id, sizeof(netplay->mitm_session_id),
&new_session, sizeof(new_session), 5000, true)
&& socket_receive_all_blocking_with_timeout(fd,
&netplay->mitm_session_id,
sizeof(netplay->mitm_session_id),
5000))
{
if (ntohl(netplay->mitm_session_id.magic) == MITM_SESSION_MAGIC &&
@ -7033,17 +7040,21 @@ static bool netplay_init_socket_buffers(netplay_t *netplay)
{
if (connection->send_packet_buffer.data)
{
if (!netplay_resize_socket_buffer(&connection->send_packet_buffer,
packet_buffer_size) ||
!netplay_resize_socket_buffer(&connection->recv_packet_buffer,
if ( !netplay_resize_socket_buffer(
&connection->send_packet_buffer,
packet_buffer_size)
|| !netplay_resize_socket_buffer(
&connection->recv_packet_buffer,
packet_buffer_size))
return false;
}
else
{
if (!netplay_init_socket_buffer(&connection->send_packet_buffer,
packet_buffer_size) ||
!netplay_init_socket_buffer(&connection->recv_packet_buffer,
if ( !netplay_init_socket_buffer(
&connection->send_packet_buffer,
packet_buffer_size)
|| !netplay_init_socket_buffer(
&connection->recv_packet_buffer,
packet_buffer_size))
return false;
}
@ -7406,8 +7417,8 @@ static netplay_t *netplay_new(const char *server, const char *mitm,
/* Clients get device info from the server. */
}
if (!init_tcp_socket(netplay, server, mitm, port) ||
!netplay_init_buffers(netplay))
if ( !init_tcp_socket(netplay, server, mitm, port)
|| !netplay_init_buffers(netplay))
goto failure;
return netplay;
@ -8174,14 +8185,14 @@ static bool netplay_poll(netplay_t *netplay, bool block_libretro_input)
/* We can't hide this much network latency with replay,
so hide some with input latency. */
if (netplay->input_latency_frames < input_latency_frames_min ||
(frames_per_frame < frames_ahead &&
netplay->input_latency_frames < input_latency_frames_max))
if ( netplay->input_latency_frames < input_latency_frames_min
|| (frames_per_frame < frames_ahead
&& netplay->input_latency_frames < input_latency_frames_max))
netplay->input_latency_frames++;
/* We don't need this much latency (any more). */
else if (netplay->input_latency_frames > input_latency_frames_max ||
(frames_per_frame > (frames_ahead + 2) &&
netplay->input_latency_frames > input_latency_frames_min))
else if (netplay->input_latency_frames > input_latency_frames_max
|| (frames_per_frame > (frames_ahead + 2)
&& netplay->input_latency_frames > input_latency_frames_min))
netplay->input_latency_frames--;
}
@ -8516,12 +8527,12 @@ static void netplay_announce_cb(retro_task_t *task, void *task_data,
host_room->host_method = (int)strtol(value, NULL, 10);
else if (string_is_equal(key, "has_password"))
host_room->has_password =
string_is_equal_case_insensitive(value, "true") ||
string_is_equal(value, "1");
string_is_equal_case_insensitive(value, "true")
|| string_is_equal(value, "1");
else if (string_is_equal(key, "has_spectate_password"))
host_room->has_spectate_password =
string_is_equal_case_insensitive(value, "true") ||
string_is_equal(value, "1");
string_is_equal_case_insensitive(value, "true")
|| string_is_equal(value, "1");
else if (string_is_equal(key, "retroarch_version"))
strlcpy(host_room->retroarch_version, value,
sizeof(host_room->retroarch_version));
@ -8535,8 +8546,8 @@ static void netplay_announce_cb(retro_task_t *task, void *task_data,
strlcpy(host_room->country, value, sizeof(host_room->country));
else if (string_is_equal(key, "connectable"))
host_room->connectable =
string_is_equal_case_insensitive(value, "true") ||
string_is_equal(value, "1");
string_is_equal_case_insensitive(value, "true")
|| string_is_equal(value, "1");
}
}

View File

@ -1742,11 +1742,11 @@ void playlist_write_file(playlist_t *playlist)
bool pl_old_fmt = ((playlist->flags & CNT_PLAYLIST_FLG_OLD_FMT) > 0);
if ( !playlist
|| !((playlist->flags & CNT_PLAYLIST_FLG_MOD) ||
|| !((playlist->flags & CNT_PLAYLIST_FLG_MOD)
#if defined(HAVE_ZLIB)
(pl_compressed != playlist->config.compress) ||
|| (pl_compressed != playlist->config.compress)
#endif
(pl_old_fmt != playlist->config.old_format)))
|| (pl_old_fmt != playlist->config.old_format)))
return;
#if defined(HAVE_ZLIB)

View File

@ -134,7 +134,6 @@ static void task_audio_mixer_handle_upload_ogg_and_play(retro_task_t *task,
audio_mixer_stream_params_t params;
nbio_buf_t *img = (nbio_buf_t*)task_data;
struct audio_mixer_userdata *user = (struct audio_mixer_userdata*)user_data;
if (!img || !user)
return;
@ -166,7 +165,6 @@ static void task_audio_mixer_handle_upload_flac(retro_task_t *task,
audio_mixer_stream_params_t params;
nbio_buf_t *img = (nbio_buf_t*)task_data;
struct audio_mixer_userdata *user = (struct audio_mixer_userdata*)user_data;
if (!img || !user)
return;
@ -198,7 +196,6 @@ static void task_audio_mixer_handle_upload_flac_and_play(retro_task_t *task,
audio_mixer_stream_params_t params;
nbio_buf_t *img = (nbio_buf_t*)task_data;
struct audio_mixer_userdata *user = (struct audio_mixer_userdata*)user_data;
if (!img || !user)
return;
@ -230,7 +227,6 @@ static void task_audio_mixer_handle_upload_mp3(retro_task_t *task,
audio_mixer_stream_params_t params;
nbio_buf_t *img = (nbio_buf_t*)task_data;
struct audio_mixer_userdata *user = (struct audio_mixer_userdata*)user_data;
if (!img || !user)
return;
@ -262,7 +258,6 @@ static void task_audio_mixer_handle_upload_mp3_and_play(retro_task_t *task,
audio_mixer_stream_params_t params;
nbio_buf_t *img = (nbio_buf_t*)task_data;
struct audio_mixer_userdata *user = (struct audio_mixer_userdata*)user_data;
if (!img || !user)
return;
@ -294,7 +289,6 @@ static void task_audio_mixer_handle_upload_mod(retro_task_t *task,
audio_mixer_stream_params_t params;
nbio_buf_t *img = (nbio_buf_t*)task_data;
struct audio_mixer_userdata *user = (struct audio_mixer_userdata*)user_data;
if (!img || !user)
return;
@ -326,7 +320,6 @@ static void task_audio_mixer_handle_upload_mod_and_play(retro_task_t *task,
audio_mixer_stream_params_t params;
nbio_buf_t *img = (nbio_buf_t*)task_data;
struct audio_mixer_userdata *user = (struct audio_mixer_userdata*)user_data;
if (!img || !user)
return;
@ -359,7 +352,6 @@ static void task_audio_mixer_handle_upload_wav(retro_task_t *task,
audio_mixer_stream_params_t params;
nbio_buf_t *img = (nbio_buf_t*)task_data;
struct audio_mixer_userdata *user = (struct audio_mixer_userdata*)user_data;
if (!img || !user)
return;
@ -391,7 +383,6 @@ static void task_audio_mixer_handle_upload_wav_and_play(retro_task_t *task,
audio_mixer_stream_params_t params;
nbio_buf_t *img = (nbio_buf_t*)task_data;
struct audio_mixer_userdata *user = (struct audio_mixer_userdata*)user_data;
if (!img || !user)
return;
@ -650,9 +641,9 @@ bool task_push_audio_mixer_load(
t->callback = task_audio_mixer_handle_upload_flac;
}
else if (
string_is_equal(ext_lower, "mod") ||
string_is_equal(ext_lower, "s3m") ||
string_is_equal(ext_lower, "xm"))
string_is_equal(ext_lower, "mod")
|| string_is_equal(ext_lower, "s3m")
|| string_is_equal(ext_lower, "xm"))
{
mixer->type = AUDIO_MIXER_TYPE_MOD;
nbio->type = NBIO_TYPE_MOD;

View File

@ -162,10 +162,10 @@ static enum patch_error bps_apply_patch(
bps.target_relative_offset = 0;
bps.output_offset = 0;
if ( (bps_read(&bps) != 'B') ||
(bps_read(&bps) != 'P') ||
(bps_read(&bps) != 'S') ||
(bps_read(&bps) != '1'))
if ( (bps_read(&bps) != 'B')
|| (bps_read(&bps) != 'P')
|| (bps_read(&bps) != 'S')
|| (bps_read(&bps) != '1'))
return PATCH_PATCH_INVALID_HEADER;
modify_source_size = bps_decode(&bps);
@ -368,10 +368,10 @@ static enum patch_error ups_apply_patch(
return PATCH_PATCH_INVALID;
if (
(ups_patch_read(&data) != 'U') ||
(ups_patch_read(&data) != 'P') ||
(ups_patch_read(&data) != 'S') ||
(ups_patch_read(&data) != '1')
(ups_patch_read(&data) != 'U')
|| (ups_patch_read(&data) != 'P')
|| (ups_patch_read(&data) != 'S')
|| (ups_patch_read(&data) != '1')
)
return PATCH_PATCH_INVALID;
@ -548,12 +548,12 @@ static enum patch_error ips_apply_patch(
{
uint32_t offset = 5;
enum patch_error error_patch = PATCH_UNKNOWN;
if ( patchlen < 8 ||
patchdata[0] != 'P' ||
patchdata[1] != 'A' ||
patchdata[2] != 'T' ||
patchdata[3] != 'C' ||
patchdata[4] != 'H')
if ( patchlen < 8
|| patchdata[0] != 'P'
|| patchdata[1] != 'A'
|| patchdata[2] != 'T'
|| patchdata[3] != 'C'
|| patchdata[4] != 'H')
return PATCH_PATCH_INVALID;
if ((error_patch = ips_alloc_targetdata(
@ -639,11 +639,11 @@ static enum patch_error xdelta_apply_patch(
xd3_source source;
/* Validate the magic number, as given by RFC 3284 section 4.1 */
if (patchlen < 8 ||
patchdata[0] != 0xD6 ||
patchdata[1] != 0xC3 ||
patchdata[2] != 0xC4 ||
patchdata[3] != 0x00)
if ( patchlen < 8
|| patchdata[0] != 0xD6
|| patchdata[1] != 0xC3
|| patchdata[2] != 0xC4
|| patchdata[3] != 0x00)
return PATCH_PATCH_INVALID_HEADER;
xd3_init_config(&config, XD3_SKIP_EMIT);