diff options
author | Jan200101 <sentrycraft123@gmail.com> | 2022-12-13 23:30:05 +0100 |
---|---|---|
committer | Jan200101 <sentrycraft123@gmail.com> | 2022-12-13 23:30:05 +0100 |
commit | 7f85e6258de886259421dad28358633b57f874fb (patch) | |
tree | 347c65d6f05e363ba5e161e01d7dc7d43c35d0bb | |
parent | 42d2d277fd312f0796ebe6ab81f8d45f903d7022 (diff) | |
download | polecat-7f85e6258de886259421dad28358633b57f874fb.tar.gz polecat-7f85e6258de886259421dad28358633b57f874fb.zip |
replace str* with strs* where possible
-rw-r--r-- | src/lutris.c | 8 | ||||
-rw-r--r-- | src/wine.c | 44 |
2 files changed, 26 insertions, 26 deletions
diff --git a/src/lutris.c b/src/lutris.c index f1fb9f5..b6fe90a 100644 --- a/src/lutris.c +++ b/src/lutris.c @@ -481,8 +481,8 @@ struct script_t lutris_getInstaller(char* installername) if (installername) { char installerurl[PATH_MAX]; - strncpy(installerurl, INSTALLER_API, sizeof(installerurl)); - strncat(installerurl, installername, sizeof(installerurl) - strlen(installerurl) - 1); + strscpy(installerurl, INSTALLER_API); + strscat(installerurl, installername); struct json_object* installerjson = fetchJSON(installerurl); @@ -885,8 +885,8 @@ size_t parseVar(char** pvar, struct list_t** variables, size_t variable_count) // end of the string up until the variable // we cannot fetch this after the realloc because it points to completly different memory making pointer math impossible var[offset] = '\0'; - strncat(var, value, varsize - strlen(var) - 1); - strncat(var, buf, varsize - strlen(var) - 1); + strsncat(var, value, varsize); + strsncat(var, buf, varsize); // cleanup free(value); free(buf); @@ -121,8 +121,8 @@ COMMAND(winecmd, remove) char winepath[PATH_MAX]; getWineDir(winepath, sizeof(winepath)); - strncat(winepath, "/", sizeof(winepath) - strlen(winepath) - 1); - strncat(winepath, winever, sizeof(winepath) - strlen(winepath) - 1); + strscat(winepath, "/"); + strscat(winepath, winever); if (!isDir(winepath)) { @@ -132,8 +132,8 @@ COMMAND(winecmd, remove) if (!uname(&buffer)) { - strncat(winepath, "-", sizeof(winepath) - strlen(winepath) - 1); - strncat(winepath, buffer.machine, sizeof(winepath) - strlen(winepath) - 1); + strscat(winepath, "-"); + strscat(winepath, buffer.machine); } // if it still doesn't exist tell this wine version is not installed @@ -201,8 +201,8 @@ COMMAND(winecmd, run) getWineDir(winepath, sizeof(winepath)); char* winever = argv[1]; - strncat(winepath, "/", sizeof(winepath) - strlen(winepath) - 1); - strncat(winepath, winever, sizeof(winepath) - strlen(winepath) - 1); + strscat(winepath, "/"); + strscat(winepath, winever); if (!isDir(winepath)) { @@ -212,8 +212,8 @@ COMMAND(winecmd, run) if (!uname(&buffer)) { - strncat(winepath, "-", sizeof(winepath) - strlen(winepath) - 1); - strncat(winepath, buffer.machine, sizeof(winepath) - strlen(winepath) - 1); + strscat(winepath, "-"); + strscat(winepath, buffer.machine); } // if we still cannot find anything tell the user and exit @@ -236,7 +236,7 @@ COMMAND(winecmd, run) break; } - strncat(winepath, winebinloc, sizeof(winepath) - strlen(winepath) - 1); + strscat(winepath, winebinloc); if (isFile(winepath)) { @@ -278,7 +278,7 @@ COMMAND(winecmd, installed) while ((ent = readdir (dir)) != NULL) { if (ent->d_name[0] == '.') continue; - strncat(winedir, ent->d_name, sizeof(winedir) - winelen - 1); + strscat(winedir, ent->d_name); int isdirec = isDir(winedir); winedir[winelen] = '\0'; @@ -305,8 +305,8 @@ COMMAND(winecmd, env) getWineDir(winepath, sizeof(winepath)); char* winever = argv[1]; - strncat(winepath, "/", sizeof(winepath) - strlen(winepath) - 1); - strncat(winepath, winever, sizeof(winepath) - strlen(winepath) - 1); + strscat(winepath, "/"); + strscat(winepath, winever); if (!isDir(winepath)) { @@ -316,8 +316,8 @@ COMMAND(winecmd, env) if (!uname(&buffer)) { - strncat(winepath, "-", sizeof(winepath) - strlen(winepath) - 1); - strncat(winepath, buffer.machine, sizeof(winepath) - strlen(winepath) - 1); + strscat(winepath, "-"); + strscat(winepath, buffer.machine); } // if it still doesn't exist tell this wine version is not installed @@ -346,7 +346,7 @@ COMMAND(winecmd, env) break; } - strncat(winepath, winebinloc, sizeof(winepath) - strlen(winepath) - 1); + strscat(winepath, winebinloc); if (isFile(winepath)) { @@ -395,8 +395,8 @@ COMMAND(winecmd, shim) getWineDir(winepath, sizeof(winepath)); char* winever = argv[1]; - strncat(winepath, "/", sizeof(winepath) - strlen(winepath) - 1); - strncat(winepath, winever, sizeof(winepath) - strlen(winepath) - 1); + strscat(winepath, "/"); + strscat(winepath, winever); if (!isDir(winepath)) { @@ -406,8 +406,8 @@ COMMAND(winecmd, shim) if (!uname(&buffer)) { - strncat(winepath, "-", sizeof(winepath) - strlen(winepath) - 1); - strncat(winepath, buffer.machine, sizeof(winepath) - strlen(winepath) - 1); + strscat(winepath, "-"); + strscat(winepath, buffer.machine); } // if we still cannot find anything tell the user and exit @@ -430,7 +430,7 @@ COMMAND(winecmd, shim) break; } - strncat(winepath, winebinloc, sizeof(winepath) - strlen(winepath) - 1); + strscat(winepath, winebinloc); if (isFile(winepath)) { @@ -469,7 +469,7 @@ enum wine_type_t check_wine_ver(char* winepath, size_t size) if (winepathcopy) { strncpy(winepathcopy, winepath, size - 1); - strncat(winepathcopy, WINEBIN, size - strlen(winepathcopy) - 1); + strsncat(winepathcopy, WINEBIN, size); if (isFile(winepathcopy)) { @@ -478,7 +478,7 @@ enum wine_type_t check_wine_ver(char* winepath, size_t size) } strncpy(winepathcopy, winepath, size - 1); - strncat(winepathcopy, PROTONBIN, size - strlen(winepathcopy) - 1); + strsncat(winepathcopy, PROTONBIN, size); if (isFile(winepathcopy)) { |