diff --git a/file_path_special.c b/file_path_special.c index b8167068ff73..78007d073835 100644 --- a/file_path_special.c +++ b/file_path_special.c @@ -146,7 +146,7 @@ bool fill_pathname_application_data(char *s, size_t len) if (appdata) { fill_pathname_join(s, appdata, - "Library/Application Support/RetroArch", len); + "Library/Application Support/RetroArch", len); return true; } #endif diff --git a/gfx/drivers_shader/glslang_util.c b/gfx/drivers_shader/glslang_util.c index 4bb3a8e49617..d5281d331332 100644 --- a/gfx/drivers_shader/glslang_util.c +++ b/gfx/drivers_shader/glslang_util.c @@ -28,17 +28,17 @@ #include "glslang_util.h" #include "../../verbosity.h" -static void get_include_file(const char *line, char *s, size_t len) +static char *slang_get_include_file(const char *line) { char *end = NULL; char *start = (char*)strchr(line, '\"'); if (!start) - return; + return NULL; start++; if (!(end = (char*)strchr(start, '\"'))) - return; + return NULL; *end = '\0'; - strlcpy(s, start, len); + return start; } bool slang_texture_semantic_is_array(enum slang_texture_semantic sem) @@ -193,15 +193,8 @@ bool glslang_read_shader_file(const char *path, bool include_optional = !strncmp("#pragma include_optional ", line, STRLEN_CONST("#pragma include_optional ")); if ( !strncmp("#include ", line, STRLEN_CONST("#include ")) || include_optional ) { - - char include_file[PATH_MAX_LENGTH]; char include_path[PATH_MAX_LENGTH]; - - include_file[0] = '\0'; - include_path[0] = '\0'; - - /* Build include file path */ - get_include_file(line, include_file, sizeof(include_file)); + char *include_file = slang_get_include_file(line); if (string_is_empty(include_file)) { @@ -209,6 +202,7 @@ bool glslang_read_shader_file(const char *path, goto error; } + include_path[0] = '\0'; fill_pathname_resolve_relative( include_path, path, include_file, sizeof(include_path)); diff --git a/libretro-common/encodings/encoding_utf.c b/libretro-common/encodings/encoding_utf.c index f204e57b5248..fd04c1c290e6 100644 --- a/libretro-common/encodings/encoding_utf.c +++ b/libretro-common/encodings/encoding_utf.c @@ -185,7 +185,7 @@ size_t utf8cpy(char *d, size_t d_len, const char *s, size_t chars) sb++; } - if ((size_t)(sb - sb_org) > d_len-1 /* NUL */) + if ((size_t)(sb - sb_org) > d_len-1) { sb = sb_org + d_len-1; while ((*sb & 0xC0) == 0x80)