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); const char *fullpath = path_get(RARCH_PATH_CONTENT);
if (!string_is_empty(fullpath)) 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", RARCH_WARN("SYSTEM DIR is empty, assume CONTENT DIR %s\n",
fullpath); 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) bool * charging, int *seconds, int *percent)
{ {
const char *base = proc_acpi_battery_path; const char *base = proc_acpi_battery_path;
char path[1024] = {0}; char path[1024];
ssize_t length = 0; ssize_t length = 0;
char *ptr = NULL; char *ptr = NULL;
char *buf = NULL; char *buf = NULL;
@ -650,6 +650,8 @@ static void check_proc_acpi_battery(const char * node, bool * have_battery,
int secs = -1; int secs = -1;
int pct = -1; int pct = -1;
path[0] = '\0';
snprintf(path, sizeof(path), "%s/%s/%s", base, node, "state"); snprintf(path, sizeof(path), "%s/%s/%s", base, node, "state");
if (!path_file_exists(path)) if (!path_file_exists(path))
@ -762,7 +764,7 @@ static void check_proc_acpi_sysfs_battery(const char *node,
int *seconds, int *percent) int *seconds, int *percent)
{ {
unsigned capacity; unsigned capacity;
char path[1024] = {0}; char path[1024];
const char *base = proc_acpi_sysfs_battery_path; const char *base = proc_acpi_sysfs_battery_path;
char *buf = NULL; char *buf = NULL;
char *ptr = NULL; char *ptr = NULL;
@ -779,6 +781,8 @@ static void check_proc_acpi_sysfs_battery(const char *node,
if (!strstr(node, "BAT")) if (!strstr(node, "BAT"))
return; return;
path[0] = '\0';
snprintf(path, sizeof(path), "%s/%s/%s", base, node, "status"); snprintf(path, sizeof(path), "%s/%s/%s", base, node, "status");
if (!path_file_exists(path)) if (!path_file_exists(path))
return; return;
@ -806,7 +810,7 @@ end:
static void check_proc_acpi_ac_adapter(const char * node, bool *have_ac) 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; const char *base = proc_acpi_ac_adapter_path;
char *buf = NULL; char *buf = NULL;
char *ptr = NULL; char *ptr = NULL;
@ -814,6 +818,8 @@ static void check_proc_acpi_ac_adapter(const char * node, bool *have_ac)
char *val = NULL; char *val = NULL;
ssize_t length = 0; ssize_t length = 0;
path[0] = '\0';
snprintf(path, sizeof(path), "%s/%s/%s", base, node, "state"); snprintf(path, sizeof(path), "%s/%s/%s", base, node, "state");
if (!path_file_exists(path)) if (!path_file_exists(path))
return; 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) 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; ssize_t length = 0;
char *buf = NULL; char *buf = NULL;
const char *base = proc_acpi_sysfs_ac_adapter_path; const char *base = proc_acpi_sysfs_ac_adapter_path;
path[0] = '\0';
snprintf(path, sizeof(path), "%s/%s", base, "online"); snprintf(path, sizeof(path), "%s/%s", base, "online");
if (!path_file_exists(path)) if (!path_file_exists(path))
return; return;

View File

@ -32,7 +32,8 @@
#include "../configuration.h" #include "../configuration.h"
#include "../verbosity.h" #include "../verbosity.h"
typedef struct { typedef struct
{
enum overlay_status state; enum overlay_status state;
enum overlay_image_transfer_status loading_status; enum overlay_image_transfer_status loading_status;
config_file_t *conf; config_file_t *conf;
@ -48,7 +49,7 @@ typedef struct {
static void task_overlay_image_done(struct overlay *overlay) 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, /* Divide iteration steps by half of total descs if size is even,
* otherwise default to 8 (arbitrary value for now to speed things up). */ * otherwise default to 8 (arbitrary value for now to speed things up). */
overlay->pos_increment = (overlay->size / 2) ? (overlay->size / 2) : 8; 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) static bool take_screenshot_viewport(const char *name_base, bool savestate)
{ {
char screenshot_path[PATH_MAX_LENGTH]; char screenshot_path[PATH_MAX_LENGTH];
struct video_viewport vp;
const char *screenshot_dir = NULL; const char *screenshot_dir = NULL;
uint8_t *buffer = NULL; uint8_t *buffer = NULL;
bool retval = false; bool retval = false;
struct video_viewport vp = {0};
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
screenshot_path[0] = '\0'; 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); video_driver_get_viewport_info(&vp);
if (!vp.width || !vp.height) if (!vp.width || !vp.height)