mirror of
https://github.com/libretro/RetroArch
synced 2025-02-21 09:39:56 +00:00
(General) Cleanups pt. 2
This commit is contained in:
parent
c36e21ed13
commit
29c82f9360
24
command.c
24
command.c
@ -56,9 +56,10 @@ struct rarch_cmd
|
|||||||
#if defined(HAVE_NETWORK_CMD) && defined(HAVE_NETPLAY)
|
#if defined(HAVE_NETWORK_CMD) && defined(HAVE_NETPLAY)
|
||||||
static bool cmd_init_network(rarch_cmd_t *handle, uint16_t port)
|
static bool cmd_init_network(rarch_cmd_t *handle, uint16_t port)
|
||||||
{
|
{
|
||||||
char port_buf[16];
|
struct addrinfo hints = {0};
|
||||||
struct addrinfo hints, *res = NULL;
|
char port_buf[16] = {0};
|
||||||
int yes = 1;
|
struct addrinfo *res = NULL;
|
||||||
|
int yes = 1;
|
||||||
|
|
||||||
if (!network_init())
|
if (!network_init())
|
||||||
return false;
|
return false;
|
||||||
@ -66,7 +67,6 @@ static bool cmd_init_network(rarch_cmd_t *handle, uint16_t port)
|
|||||||
RARCH_LOG("Bringing up command interface on port %hu.\n",
|
RARCH_LOG("Bringing up command interface on port %hu.\n",
|
||||||
(unsigned short)port);
|
(unsigned short)port);
|
||||||
|
|
||||||
memset(&hints, 0, sizeof(hints));
|
|
||||||
#if defined(_WIN32) || defined(HAVE_SOCKET_LEGACY)
|
#if defined(_WIN32) || defined(HAVE_SOCKET_LEGACY)
|
||||||
hints.ai_family = AF_INET;
|
hints.ai_family = AF_INET;
|
||||||
#else
|
#else
|
||||||
@ -217,9 +217,9 @@ static const struct cmd_map map[] = {
|
|||||||
|
|
||||||
static bool cmd_set_shader(const char *arg)
|
static bool cmd_set_shader(const char *arg)
|
||||||
{
|
{
|
||||||
char msg[PATH_MAX_LENGTH];
|
char msg[PATH_MAX_LENGTH] = {0};
|
||||||
enum rarch_shader_type type = RARCH_SHADER_NONE;
|
enum rarch_shader_type type = RARCH_SHADER_NONE;
|
||||||
const char *ext = path_get_extension(arg);
|
const char *ext = path_get_extension(arg);
|
||||||
|
|
||||||
if (strcmp(ext, "glsl") == 0 || strcmp(ext, "glslp") == 0)
|
if (strcmp(ext, "glsl") == 0 || strcmp(ext, "glslp") == 0)
|
||||||
type = RARCH_SHADER_GLSL;
|
type = RARCH_SHADER_GLSL;
|
||||||
@ -522,13 +522,13 @@ void rarch_cmd_poll(rarch_cmd_t *handle)
|
|||||||
static bool send_udp_packet(const char *host,
|
static bool send_udp_packet(const char *host,
|
||||||
uint16_t port, const char *msg)
|
uint16_t port, const char *msg)
|
||||||
{
|
{
|
||||||
char port_buf[16];
|
char port_buf[16] = {0};
|
||||||
struct addrinfo hints, *res = NULL;
|
struct addrinfo hints = {0};
|
||||||
|
struct addrinfo *res = NULL;
|
||||||
const struct addrinfo *tmp = NULL;
|
const struct addrinfo *tmp = NULL;
|
||||||
int fd = -1;
|
int fd = -1;
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
|
|
||||||
memset(&hints, 0, sizeof(hints));
|
|
||||||
#if defined(_WIN32) || defined(HAVE_SOCKET_LEGACY)
|
#if defined(_WIN32) || defined(HAVE_SOCKET_LEGACY)
|
||||||
hints.ai_family = AF_INET;
|
hints.ai_family = AF_INET;
|
||||||
#else
|
#else
|
||||||
@ -603,7 +603,7 @@ bool network_cmd_send(const char *cmd_)
|
|||||||
const char *port_ = NULL;
|
const char *port_ = NULL;
|
||||||
global_t *global = global_get_ptr();
|
global_t *global = global_get_ptr();
|
||||||
bool old_verbose = global->verbosity;
|
bool old_verbose = global->verbosity;
|
||||||
uint16_t port = DEFAULT_NETWORK_CMD_PORT;
|
uint16_t port = DEFAULT_NETWORK_CMD_PORT;
|
||||||
|
|
||||||
if (!network_init())
|
if (!network_init())
|
||||||
return false;
|
return false;
|
||||||
|
@ -182,7 +182,7 @@ static int database_cursor_iterate(libretrodb_cursor_t *cur,
|
|||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
struct rmsgpack_dom_value item;
|
struct rmsgpack_dom_value item;
|
||||||
const char* str;
|
const char* str = NULL;
|
||||||
|
|
||||||
if (libretrodb_cursor_read_item(cur, &item) != 0)
|
if (libretrodb_cursor_read_item(cur, &item) != 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
18
netplay.c
18
netplay.c
@ -887,10 +887,10 @@ static bool get_nickname(netplay_t *netplay, int fd)
|
|||||||
static bool send_info(netplay_t *netplay)
|
static bool send_info(netplay_t *netplay)
|
||||||
{
|
{
|
||||||
unsigned sram_size;
|
unsigned sram_size;
|
||||||
char msg[512];
|
char msg[512] = {0};
|
||||||
void *sram = NULL;
|
void *sram = NULL;
|
||||||
uint32_t header[3];
|
uint32_t header[3] = {0};
|
||||||
global_t *global = global_get_ptr();
|
global_t *global = global_get_ptr();
|
||||||
|
|
||||||
header[0] = htonl(global->content_crc);
|
header[0] = htonl(global->content_crc);
|
||||||
header[1] = htonl(implementation_magic_value());
|
header[1] = htonl(implementation_magic_value());
|
||||||
@ -1057,11 +1057,11 @@ static bool bsv_parse_header(const uint32_t *header, uint32_t magic)
|
|||||||
|
|
||||||
static bool get_info_spectate(netplay_t *netplay)
|
static bool get_info_spectate(netplay_t *netplay)
|
||||||
{
|
{
|
||||||
void *buf;
|
|
||||||
size_t save_state_size, size;
|
size_t save_state_size, size;
|
||||||
uint32_t header[4];
|
void *buf = NULL;
|
||||||
char msg[512];
|
uint32_t header[4] = {0};
|
||||||
bool ret = true;
|
char msg[512] = {0};
|
||||||
|
bool ret = true;
|
||||||
|
|
||||||
if (!send_nickname(netplay, netplay->fd))
|
if (!send_nickname(netplay, netplay->fd))
|
||||||
{
|
{
|
||||||
@ -1587,7 +1587,7 @@ static void netplay_post_frame_spectate(netplay_t *netplay)
|
|||||||
|
|
||||||
for (i = 0; i < MAX_SPECTATORS; i++)
|
for (i = 0; i < MAX_SPECTATORS; i++)
|
||||||
{
|
{
|
||||||
char msg[PATH_MAX_LENGTH];
|
char msg[PATH_MAX_LENGTH] = {0};
|
||||||
|
|
||||||
if (netplay->spectate_fds[i] == -1)
|
if (netplay->spectate_fds[i] == -1)
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user