Get rid of some implicit memsets

This commit is contained in:
twinaphex 2016-12-19 19:04:52 +01:00 committed by Brad Parker
parent d2b3762db8
commit 16b26139ff
4 changed files with 26 additions and 8 deletions

View File

@ -1050,7 +1050,9 @@ bool rarch_environment_cb(unsigned cmd, void *data)
const char *fullpath = path_get(RARCH_PATH_CONTENT);
if (!string_is_empty(fullpath))
{
char temp_path[PATH_MAX_LENGTH] = {0};
char temp_path[PATH_MAX_LENGTH];
temp_path[0] = '\0';
RARCH_WARN("SYSTEM DIR is empty, assume CONTENT DIR %s\n",
fullpath);

View File

@ -636,7 +636,7 @@ static void check_proc_acpi_battery(const char * node, bool * have_battery,
bool * charging, int *seconds, int *percent)
{
const char *base = proc_acpi_battery_path;
char path[1024] = {0};
char path[1024];
ssize_t length = 0;
char *ptr = NULL;
char *buf = NULL;
@ -650,6 +650,8 @@ static void check_proc_acpi_battery(const char * node, bool * have_battery,
int secs = -1;
int pct = -1;
path[0] = '\0';
snprintf(path, sizeof(path), "%s/%s/%s", base, node, "state");
if (!path_file_exists(path))
@ -762,7 +764,7 @@ static void check_proc_acpi_sysfs_battery(const char *node,
int *seconds, int *percent)
{
unsigned capacity;
char path[1024] = {0};
char path[1024];
const char *base = proc_acpi_sysfs_battery_path;
char *buf = NULL;
char *ptr = NULL;
@ -779,6 +781,8 @@ static void check_proc_acpi_sysfs_battery(const char *node,
if (!strstr(node, "BAT"))
return;
path[0] = '\0';
snprintf(path, sizeof(path), "%s/%s/%s", base, node, "status");
if (!path_file_exists(path))
return;
@ -806,7 +810,7 @@ end:
static void check_proc_acpi_ac_adapter(const char * node, bool *have_ac)
{
char path[1024] = {0};
char path[1024];
const char *base = proc_acpi_ac_adapter_path;
char *buf = NULL;
char *ptr = NULL;
@ -814,6 +818,8 @@ static void check_proc_acpi_ac_adapter(const char * node, bool *have_ac)
char *val = NULL;
ssize_t length = 0;
path[0] = '\0';
snprintf(path, sizeof(path), "%s/%s/%s", base, node, "state");
if (!path_file_exists(path))
return;
@ -838,11 +844,13 @@ static void check_proc_acpi_ac_adapter(const char * node, bool *have_ac)
static void check_proc_acpi_sysfs_ac_adapter(const char * node, bool *have_ac)
{
char path[1024] = {0};
char path[1024];
ssize_t length = 0;
char *buf = NULL;
const char *base = proc_acpi_sysfs_ac_adapter_path;
path[0] = '\0';
snprintf(path, sizeof(path), "%s/%s", base, "online");
if (!path_file_exists(path))
return;

View File

@ -32,7 +32,8 @@
#include "../configuration.h"
#include "../verbosity.h"
typedef struct {
typedef struct
{
enum overlay_status state;
enum overlay_image_transfer_status loading_status;
config_file_t *conf;
@ -48,7 +49,7 @@ typedef struct {
static void task_overlay_image_done(struct overlay *overlay)
{
overlay->pos = 0;
overlay->pos = 0;
/* Divide iteration steps by half of total descs if size is even,
* otherwise default to 8 (arbitrary value for now to speed things up). */
overlay->pos_increment = (overlay->size / 2) ? (overlay->size / 2) : 8;

View File

@ -239,14 +239,21 @@ static bool screenshot_dump(
static bool take_screenshot_viewport(const char *name_base, bool savestate)
{
char screenshot_path[PATH_MAX_LENGTH];
struct video_viewport vp;
const char *screenshot_dir = NULL;
uint8_t *buffer = NULL;
bool retval = false;
struct video_viewport vp = {0};
settings_t *settings = config_get_ptr();
screenshot_path[0] = '\0';
vp.x = 0;
vp.y = 0;
vp.width = 0;
vp.height = 0;
vp.full_width = 0;
vp.full_height = 0;
video_driver_get_viewport_info(&vp);
if (!vp.width || !vp.height)