From 09a9867d8a78872af6aaf413808d8867924f8a8e Mon Sep 17 00:00:00 2001 From: Heiko Hund Date: Mon, 9 Feb 2009 17:58:53 +0000 Subject: [PATCH] use new inline function instead of old macro --- openvpn.c | 18 +++++++++--------- openvpn_config.c | 8 ++++---- scripts.c | 6 +++--- viewlog.c | 4 ++-- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/openvpn.c b/openvpn.c index a9cded1..904043e 100644 --- a/openvpn.c +++ b/openvpn.c @@ -53,7 +53,7 @@ int CreateExitEvent(int config) o.cnn[config].exit_event = NULL; if (o.oldversion == 1) { - mysnprintf(o.cnn[config].exit_event_name, "openvpn_exit"); + _sntprintf_0(o.cnn[config].exit_event_name, _T("openvpn_exit")); o.cnn[config].exit_event = CreateEvent (NULL, TRUE, FALSE, @@ -75,7 +75,7 @@ int CreateExitEvent(int config) } else { - mysnprintf(o.cnn[config].exit_event_name, "openvpngui_exit_event_%d",config); + _sntprintf_0(o.cnn[config].exit_event_name, _T("openvpngui_exit_event_%d"), config); o.cnn[config].exit_event = CreateEvent (NULL, TRUE, FALSE, @@ -206,15 +206,15 @@ int StartOpenVPN(int config) /* construct command line */ if (o.oldversion == 1) { - mysnprintf (command_line, "openvpn --config \"%s\" %s", - o.cnn[config].config_file, proxy_string); + _sntprintf_0(command_line, _T("openvpn --config \"%s\" %s"), + o.cnn[config].config_file, proxy_string); } else { - mysnprintf (command_line, "openvpn --service %s 0 --config \"%s\" %s", - o.cnn[config].exit_event_name, - o.cnn[config].config_file, - proxy_string); + _sntprintf_0(command_line, _T("openvpn --service %s 0 --config \"%s\" %s"), + o.cnn[config].exit_event_name, + o.cnn[config].config_file, + proxy_string); } @@ -671,7 +671,7 @@ int CheckVersion() #endif /* construct command line */ - mysnprintf (command_line, "openvpn --version"); + _sntprintf_0(command_line, _T("openvpn --version")); /* construct bin path */ strncpy(bin_path, o.exe_path, sizeof(bin_path)); diff --git a/openvpn_config.c b/openvpn_config.c index 3ca584b..b90f2e8 100644 --- a/openvpn_config.c +++ b/openvpn_config.c @@ -124,7 +124,7 @@ int AddConfigFileToList(int config, char filename[], char config_dir[]) ShowLocalizedMsg (GUI_NAME, IDS_ERR_LOG_CONSTRUCT, o.cnn[config].config_file); return(false); } - mysnprintf (o.cnn[config].log_path, "%s\\%s", o.log_dir, log_file); + _sntprintf_0(o.cnn[config].log_path, _T("%s\\%s"), o.log_dir, log_file); /* Check if connection should be autostarted */ for (i=0; (i < MAX_CONFIGS) && o.auto_connect[i]; i++) @@ -154,7 +154,7 @@ BuildFileList() /* Reset config counter */ o.num_configs=0; - mysnprintf (find_string, "%s\\*", o.config_dir); + _sntprintf_0(find_string, _T("%s\\*"), o.config_dir); find_handle = FindFirstFile (find_string, &find_obj); if (find_handle == INVALID_HANDLE_VALUE) @@ -190,7 +190,7 @@ BuildFileList() (subdir < MAX_CONFIG_SUBDIRS)) { /* Add dir to dir_table */ - mysnprintf(subdir_table[subdir], "%s\\%s", o.config_dir, find_obj.cFileName); + _sntprintf_0(subdir_table[subdir], _T("%s\\%s"), o.config_dir, find_obj.cFileName); subdir++; } } @@ -208,7 +208,7 @@ BuildFileList() for (subdir_counter=0; subdir_counter < subdir; subdir_counter++) { - mysnprintf (find_string, "%s\\*", subdir_table[subdir_counter]); + _sntprintf_0(find_string, _T("%s\\*"), subdir_table[subdir_counter]); find_handle = FindFirstFile (find_string, &find_obj); if (find_handle == INVALID_HANDLE_VALUE) diff --git a/scripts.c b/scripts.c index ee296e0..3774371 100644 --- a/scripts.c +++ b/scripts.c @@ -47,7 +47,7 @@ void RunConnectScript(int config, int run_as_service) strncpy(batch_file, o.cnn[config].config_file, sizeof(batch_file)); batch_file[strlen(batch_file) - (strlen(o.ext_string)+1)]=0; strncat(batch_file, "_up.bat", sizeof(batch_file) - strlen(batch_file) - 1); - mysnprintf(command_line, "%s\\%s", o.cnn[config].config_dir, batch_file); + _sntprintf_0(command_line, _T("%s\\%s"), o.cnn[config].config_dir, batch_file); /* Return if no script exists */ @@ -147,7 +147,7 @@ void RunDisconnectScript(int config, int run_as_service) /* Append "_down.bat" to config name. */ strncpy(batch_file, o.cnn[config].config_name, sizeof(batch_file)); strncat(batch_file, "_down.bat", sizeof(batch_file) - strlen(batch_file) - 1); - mysnprintf(command_line, "%s\\%s", o.cnn[config].config_dir, batch_file); + _sntprintf_0(command_line, _T("%s\\%s"), o.cnn[config].config_dir, batch_file); /* Return if no script exists */ @@ -227,7 +227,7 @@ void RunPreconnectScript(int config) /* Append "_pre.bat" to config name. */ strncpy(batch_file, o.cnn[config].config_name, sizeof(batch_file)); strncat(batch_file, "_pre.bat", sizeof(batch_file) - strlen(batch_file) - 1); - mysnprintf(command_line, "%s\\%s", o.cnn[config].config_dir, batch_file); + _sntprintf_0(command_line, _T("%s\\%s"), o.cnn[config].config_dir, batch_file); /* Return if no script exists */ diff --git a/viewlog.c b/viewlog.c index a329514..b5334ae 100644 --- a/viewlog.c +++ b/viewlog.c @@ -44,7 +44,7 @@ void ViewLog(int config) CLEAR (sa); CLEAR (sd); - mysnprintf(filename, "%s \"%s\"", o.log_viewer, o.cnn[config].log_path); + _sntprintf_0(filename, _T("%s \"%s\""), o.log_viewer, o.cnn[config].log_path); /* fill in STARTUPINFO struct */ GetStartupInfo(&start_info); @@ -86,7 +86,7 @@ void EditConfig(int config) CLEAR (sa); CLEAR (sd); - mysnprintf(filename, "%s \"%s\\%s\"", o.editor, o.cnn[config].config_dir, o.cnn[config].config_file); + _sntprintf_0(filename, _T("%s \"%s\\%s\""), o.editor, o.cnn[config].config_dir, o.cnn[config].config_file); /* fill in STARTUPINFO struct */ GetStartupInfo(&start_info);