(dylib.c) Avoid strlcat usage, camelcase variable name removal

and C comments
This commit is contained in:
libretroadmin 2024-06-16 15:10:11 +02:00
parent 0ced85b91d
commit 3cdadbef8c
1 changed files with 9 additions and 9 deletions

View File

@ -129,16 +129,16 @@ dylib_t dylib_load(const char *path)
dylib_t lib = (dylib_t)sceKernelLoadStartModule(path, 0, NULL, 0, NULL, &res); dylib_t lib = (dylib_t)sceKernelLoadStartModule(path, 0, NULL, 0, NULL, &res);
#elif IOS #elif IOS
dylib_t lib; dylib_t lib;
static const char fwSuffix[] = ".framework"; static const char fw_suffix[] = ".framework";
if (string_ends_with(path, fwSuffix)) if (string_ends_with(path, fw_suffix))
{ {
char fwPath[PATH_MAX_LENGTH] = {0}; char fw_path[PATH_MAX_LENGTH];
strlcat(fwPath, path, sizeof(fwPath)); const char *fw_name = path_basename(path);
size_t sz = strlcat(fwPath, "/", sizeof(fwPath)); size_t sz = strlcpy(fw_path, path, sizeof(fw_path));
const char *fwName = path_basename(path); sz += strlcpy(fw_path + sz, "/", sizeof(fw_path) - sz);
// Assume every framework binary is named for the framework. Not always /* Assume every framework binary is named for the framework. Not always
// a great assumption but correct enough for our uses. * a great assumption but correct enough for our uses. */
strlcpy(fwPath + sz, fwName, strlen(fwName) - STRLEN_CONST(fwSuffix) + 1); strlcpy(fwPath + sz, fw_name, strlen(fw_name) - STRLEN_CONST(fw_suffix) + 1);
lib = dlopen(fwPath, RTLD_LAZY | RTLD_LOCAL); lib = dlopen(fwPath, RTLD_LAZY | RTLD_LOCAL);
} }
else else