1
0
mirror of https://github.com/FunkyFr3sh/cnc-ddraw.git synced 2025-03-15 06:04:49 +01:00

fix _snprintf calls

This commit is contained in:
FunkyFr3sh 2023-10-14 05:04:36 +02:00
parent 995d1f294b
commit dfae3361a0
4 changed files with 7 additions and 7 deletions

View File

@ -1115,7 +1115,7 @@ static DWORD cfg_get_string(LPCSTR key, LPCSTR default_value, LPSTR out_string,
else
{
char section[MAX_PATH] = { 0 };
_snprintf(section, sizeof(section), "%s?%d", g_config.process_file_name, 2);
_snprintf(section, sizeof(section) - 1, "%s?%d", g_config.process_file_name, 2);
s = GetPrivateProfileStringA(section, key, "", out_string, out_size, g_config.ini_path);
@ -1135,7 +1135,7 @@ static DWORD cfg_get_string(LPCSTR key, LPCSTR default_value, LPSTR out_string,
else
{
char section[MAX_PATH] = { 0 };
_snprintf(section, sizeof(section), "%s/%d", g_config.process_file_name, 2);
_snprintf(section, sizeof(section) - 1, "%s/%d", g_config.process_file_name, 2);
s = GetPrivateProfileStringA(section, key, "", out_string, out_size, g_config.ini_path);
@ -1162,8 +1162,8 @@ static BOOL cfg_get_bool(LPCSTR key, BOOL default_value)
static int cfg_get_int(LPCSTR key, int default_value)
{
char def_value[20];
_snprintf(def_value, sizeof(def_value), "%d", default_value);
char def_value[24];
_snprintf(def_value, sizeof(def_value) - 1, "%d", default_value);
char value[20];
cfg_get_string(key, def_value, value, sizeof(value));

View File

@ -58,7 +58,7 @@ BOOL WINAPI DllMain(HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
_snprintf(
mes,
sizeof(mes),
sizeof(mes) - 1,
"Please disable the '%s' compatibility mode for all game executables and "
"then try to start the game again.",
s);

View File

@ -29,7 +29,7 @@ DWORD WINAPI gdi_render_main(void)
_snprintf(
warning_text,
sizeof(warning_text),
sizeof(warning_text) - 1,
"-WARNING- Using slow software rendering, please update your graphics card driver (%s)",
strlen(g_oglu_version) > 10 ? "" : g_oglu_version);
}

View File

@ -150,7 +150,7 @@ BOOL ss_take_screenshot(IDirectDrawSurfaceImpl* src)
CreateDirectoryA(g_config.screenshot_dir, NULL);
strftime(str_time, sizeof(str_time), "%Y-%m-%d-%H_%M_%S", localtime(&t));
_snprintf(filename, sizeof(filename), "%s%s-%s.png", g_config.screenshot_dir, title, str_time);
_snprintf(filename, sizeof(filename) - 1, "%s%s-%s.png", g_config.screenshot_dir, title, str_time);
if (src->bpp == 8 && src->palette)
{