[misc] add static_strcat & static_strcpy and use static_ calls wherever possible

* Also set Rufus next to 2.17 and fix a warning
This commit is contained in:
Pete Batard 2017-08-10 19:43:04 +01:00
parent 5d371088cb
commit 90dc847e24
23 changed files with 121 additions and 120 deletions

View file

@ -205,7 +205,7 @@ const char* WinInetErrorString(void)
InternetGetLastResponseInfoA(&error_code, error_string, &size);
return error_string;
default:
safe_sprintf(error_string, sizeof(error_string), "Unknown internet error 0x%08lX", error_code);
static_sprintf(error_string, "Unknown internet error 0x%08lX", error_code);
return error_string;
}
}
@ -275,7 +275,7 @@ DWORD DownloadFile(const char* url, const char* file, HWND hProgressDialog)
uprintf("Network is unavailable: %s\n", WinInetErrorString());
goto out;
}
safe_sprintf(agent, ARRAYSIZE(agent), APPLICATION_NAME "/%d.%d.%d (Windows NT %d.%d%s)",
static_sprintf(agent, APPLICATION_NAME "/%d.%d.%d (Windows NT %d.%d%s)",
rufus_version[0], rufus_version[1], rufus_version[2],
nWindowsVersion>>4, nWindowsVersion&0x0F, is_x64()?"; WOW64":"");
hSession = InternetOpenA(agent, INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
@ -467,7 +467,7 @@ static DWORD WINAPI CheckForUpdatesThread(LPVOID param)
goto out;
hostname[sizeof(hostname)-1] = 0;
safe_sprintf(agent, ARRAYSIZE(agent), APPLICATION_NAME "/%d.%d.%d (Windows NT %d.%d%s)",
static_sprintf(agent, APPLICATION_NAME "/%d.%d.%d (Windows NT %d.%d%s)",
rufus_version[0], rufus_version[1], rufus_version[2],
nWindowsVersion >> 4, nWindowsVersion & 0x0F, is_x64() ? "; WOW64" : "");
hSession = InternetOpenA(agent, INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
@ -493,7 +493,7 @@ static DWORD WINAPI CheckForUpdatesThread(LPVOID param)
// and then remove each each of the <os_> components until we find our match. For instance, we may first
// look for rufus_win_x64_6.2.ver (Win8 x64) but only get a match for rufus_win_x64_6.ver (Vista x64 or later)
// This allows sunsetting OS versions (eg XP) or providing different downloads for different archs/groups.
safe_sprintf(urlpath, sizeof(urlpath), "%s%s%s_%s_%lu.%lu.ver", APPLICATION_NAME, (k==0)?"":"_",
static_sprintf(urlpath, "%s%s%s_%s_%lu.%lu.ver", APPLICATION_NAME, (k==0)?"":"_",
(k==0)?"":channel[k], archname[is_x64()?1:0], os_version.dwMajorVersion, os_version.dwMinorVersion);
vuprintf("Base update check: %s\n", urlpath);
for (i=0, j=(int)safe_strlen(urlpath)-5; (j>0)&&(i<ARRAYSIZE(verpos)); j--) {