From 3c7c667cf5727f947368e349f5455fbdc2c1b125 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 19 Dec 2016 19:04:52 +0100 Subject: [PATCH] Get rid of some implicit memsets --- dynamic.c | 4 +++- frontend/drivers/platform_linux.c | 16 ++++++++++++---- tasks/task_overlay.c | 5 +++-- tasks/task_screenshot.c | 9 ++++++++- 4 files changed, 26 insertions(+), 8 deletions(-) diff --git a/dynamic.c b/dynamic.c index 084193dea1..fccd1fab31 100644 --- a/dynamic.c +++ b/dynamic.c @@ -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); diff --git a/frontend/drivers/platform_linux.c b/frontend/drivers/platform_linux.c index 42c00f023b..a7edcdca67 100644 --- a/frontend/drivers/platform_linux.c +++ b/frontend/drivers/platform_linux.c @@ -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; diff --git a/tasks/task_overlay.c b/tasks/task_overlay.c index ed3fb2998c..dfc8704ef8 100644 --- a/tasks/task_overlay.c +++ b/tasks/task_overlay.c @@ -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; diff --git a/tasks/task_screenshot.c b/tasks/task_screenshot.c index d80479cac2..0f755cdb70 100644 --- a/tasks/task_screenshot.c +++ b/tasks/task_screenshot.c @@ -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)