Skip to content

Commit

Permalink
* Start getting rid of strncpy
Browse files Browse the repository at this point in the history
* steam.c - cleanups:
  * Use string_to_lower from libretro-common/stdstring.c instead of
    its own version
  * Some stylistic changes
  * Rewrite strncpy calls into strlcpy/strlcat/manual assignment
  * Make it C89 compliant
  * Some unused variables
  • Loading branch information
LibretroAdmin committed Aug 25, 2022
1 parent 8017410 commit 88187e7
Show file tree
Hide file tree
Showing 4 changed files with 244 additions and 174 deletions.
2 changes: 1 addition & 1 deletion frontend/drivers/platform_ps2.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ static int mount_hdd_partition(void)
if (bootDeviceID == BOOT_DEVICE_HDD || bootDeviceID == BOOT_DEVICE_HDD0)
{
/* If we're booting from HDD, we must update the cwd variable and add : to the mount point */
strncpy(cwd, new_cwd, sizeof(cwd));
strlcpy(cwd, new_cwd, sizeof(cwd));
strlcat(mountPoint, ":", sizeof(mountPoint));
}
else
Expand Down
7 changes: 3 additions & 4 deletions gfx/drivers/gx2_gfx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1490,14 +1490,13 @@ static bool wiiu_gfx_set_shader(void *data,
for (i = 0; i < wiiu->shader_preset->passes; i++)
{
unsigned j;
char *ptr;
char gfdpath[PATH_MAX_LENGTH];
struct video_shader_pass *pass = &wiiu->shader_preset->pass[i];

strncpy(gfdpath, pass->source.path, PATH_MAX_LENGTH);
strlcpy(gfdpath, pass->source.path, sizeof(gfdpath));

char *ptr = strrchr(gfdpath, '.');

if (!ptr)
if (!(ptr = strrchr(gfdpath, '.')))
ptr = gfdpath + strlen(gfdpath);

*ptr++ = '.';
Expand Down
Loading

0 comments on commit 88187e7

Please sign in to comment.