fixed compiler warnings

pull/1/head
Heiko Hund 16 years ago
parent c554992de1
commit d646c7fc8c

@ -60,7 +60,6 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
HWND hwnd; /* This is the handle for our window */
MSG messages; /* Here messages to the application are saved */
WNDCLASSEX wincl; /* Data structure for the windowclass */
HWND hwndAbout;
DWORD shell32_version;
@ -323,7 +322,6 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
BOOL CALLBACK AboutDialogFunc (HWND hwndDlg, UINT msg, WPARAM wParam, UNUSED LPARAM lParam)
{
HICON hIcon;
TCHAR buf[1000];
switch (msg) {
@ -358,7 +356,6 @@ BOOL CALLBACK AboutDialogFunc (HWND hwndDlg, UINT msg, WPARAM wParam, UNUSED LPA
void CloseApplication(HWND hwnd)
{
int i, ask_exit=0;
TCHAR buf[1000];
if (o.service_running == SERVICE_CONNECTED)
{

@ -63,9 +63,9 @@ struct security_attributes
#define CLEAR(x) memset(&(x), 0, sizeof(x))
/* snprintf with guaranteed null termination */
#define mysnprintf(out, args...) \
#define mysnprintf(out, ...) \
{ \
snprintf (out, sizeof(out), args); \
snprintf (out, sizeof(out), __VA_ARGS__); \
out [sizeof (out) - 1] = '\0'; \
}

@ -143,11 +143,8 @@ int StartOpenVPN(int config)
SECURITY_DESCRIPTOR sd;
char command_line[256];
char proxy_string[100];
char msg[200];
int i, is_connected=0;
extern HINSTANCE hInstance;
CLEAR (start_info);
CLEAR (proc_info);
CLEAR (sa);
@ -178,7 +175,6 @@ int StartOpenVPN(int config)
if ((ConfigFileOptionExist(config, "log ")) ||
(ConfigFileOptionExist(config, "log-append ")))
{
TCHAR buf[1000];
if (MessageBox(NULL, LoadLocalizedString(ERR_OPTION_LOG_IN_CONFIG), GUI_NAME, MB_YESNO | MB_DEFBUTTON2 | MB_ICONWARNING) != IDYES)
return(false);
}
@ -392,9 +388,6 @@ failed:
void StopOpenVPN(int config)
{
int i;
TCHAR buf[1000];
o.cnn[config].connect_status = DISCONNECTING;
if (o.cnn[config].exit_event) {
@ -412,9 +405,6 @@ void StopOpenVPN(int config)
void SuspendOpenVPN(int config)
{
int i;
TCHAR buf[1000];
o.cnn[config].connect_status = SUSPENDING;
o.cnn[config].restart = true;
@ -450,7 +440,6 @@ BOOL CALLBACK StatusDialogFunc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
HWND hwndLogWindow;
RECT rect;
CHARFORMAT charformat;
HICON hIcon;
int config;
switch (msg) {
@ -630,7 +619,6 @@ int CheckVersion()
HANDLE hInputRead = NULL;
HANDLE hInputWrite = NULL;
HANDLE exit_event;
HANDLE debug_event;
STARTUPINFO start_info;
PROCESS_INFORMATION proc_info;
@ -902,7 +890,6 @@ void ThreadOpenVPNStatus(int config)
char conn_name[200];
HANDLE hThread;
DWORD IDThread;
char msg[200];
MSG messages;
/* Cut of extention from config filename. */
@ -912,7 +899,6 @@ void ThreadOpenVPNStatus(int config)
if (o.cnn[config].restart)
{
/* UserInfo: Connecting */
TCHAR buf[1000];
SetDlgItemText(o.cnn[config].hwndStatus, TEXT_STATUS, LoadLocalizedString(INFO_STATE_CONNECTING));
SetStatusWinIcon(o.cnn[config].hwndStatus, APP_ICON_CONNECTING);
EnableWindow(GetDlgItem(o.cnn[config].hwndStatus, ID_DISCONNECT), TRUE);
@ -923,8 +909,6 @@ void ThreadOpenVPNStatus(int config)
else
{
/* Create and Show Status Dialog */
TCHAR buf[1000];
o.cnn[config].hwndStatus = CreateLocalizedDialog(IDD_STATUS, StatusDialogFunc);
if (!o.cnn[config].hwndStatus)
ExitThread(1);

@ -24,6 +24,7 @@
#include "main.h"
#include "openvpn-gui-res.h"
#include "options.h"
#include "localization.h"
#define MATCH_FALSE 0
#define MATCH_FILE 1
@ -146,7 +147,6 @@ BuildFileList()
HANDLE find_handle;
BOOL more_files;
char find_string[MAX_PATH];
int i;
char subdir_table[MAX_CONFIG_SUBDIRS][MAX_PATH];
int subdir=0;
int subdir_counter=0;

@ -57,11 +57,9 @@ int ReadLineFromStdOut(HANDLE hStdOut, int config, char *line)
static int charsleft[MAX_CONFIGS];
char tmpline[MAX_LINELEN];
DWORD nBytesRead;
DWORD nCharsWritten;
char *p;
unsigned int len, i;
static int first_call = 1;
extern HINSTANCE hInstance;
if (first_call)
{
@ -192,9 +190,7 @@ int ReadLineFromStdOut(HANDLE hStdOut, int config, char *line)
*/
void monitor_openvpnlog_while_connecting(int config, char *line)
{
TCHAR buf[1000];
char msg[200];
char msg2[200];
unsigned int i;
char *linepos;
@ -283,8 +279,6 @@ void monitor_openvpnlog_while_connecting(int config, char *line)
*/
void monitor_openvpnlog_while_connected(int config, char *line)
{
TCHAR buf[1000];
/* Check for Ping-Restart message */
if (strstr(line, "process restarting") != NULL)
{
@ -303,11 +297,9 @@ void monitor_openvpnlog_while_connected(int config, char *line)
*/
void monitor_openvpnlog_while_reconnecting(int config, char *line)
{
TCHAR buf[1000];
char msg[200];
char msg2[200];
unsigned int i;
char *linepos;
size_t i;
/* Check for Connected message */
if (strstr(line, o.connect_string) != NULL)
@ -387,15 +379,9 @@ void WatchOpenVPNProcess(int config)
int ret;
char filemode[2] = "w\0";
FILE *fd;
char msg[200];
char msg2[200];
int i;
int iLineCount;
int LogLines = 0;
int logpos;
char *linepos;
HWND LogWindow;
TCHAR buf[1000];
/* set log file append/truncate filemode */
if (o.append_string[0] == '1')

@ -45,9 +45,7 @@ int Createargcargv(struct options* options, char* command_line)
char* arg;
int myindex;
int result;
int i;
// count the arguments
argc = 1;
@ -136,43 +134,6 @@ int Createargcargv(struct options* options, char* command_line)
}
void
parse_argv (struct options* options,
int argc,
char *argv[])
{
int i, j;
/* parse command line */
for (i = 1; i < argc; ++i)
{
char *p[MAX_PARMS];
CLEAR (p);
p[0] = argv[i];
if (strncmp(p[0], "--", 2))
{
/* Missing -- before option. */
ShowLocalizedMsg(GUI_NAME, ERR_BAD_PARAMETER, p[0]);
exit(0);
}
else
p[0] += 2;
for (j = 1; j < MAX_PARMS; ++j)
{
if (i + j < argc)
{
char *arg = argv[i + j];
if (strncmp (arg, "--", 2))
p[j] = arg;
else
break;
}
}
i = add_option (options, i, p);
}
}
static int
add_option (struct options *options,
int i,
@ -181,7 +142,6 @@ add_option (struct options *options,
if (streq (p[0], "help"))
{
TCHAR usagetext[5000];
TCHAR usagecaption[200];
LoadLocalizedStringBuf(usagecaption, sizeof(usagecaption)/sizeof(*usagecaption), INFO_USAGECAPTION);
@ -313,6 +273,43 @@ add_option (struct options *options,
return i;
}
void
parse_argv (struct options* options,
int argc,
char *argv[])
{
int i, j;
/* parse command line */
for (i = 1; i < argc; ++i)
{
char *p[MAX_PARMS];
CLEAR (p);
p[0] = argv[i];
if (strncmp(p[0], "--", 2))
{
/* Missing -- before option. */
ShowLocalizedMsg(GUI_NAME, ERR_BAD_PARAMETER, p[0]);
exit(0);
}
else
p[0] += 2;
for (j = 1; j < MAX_PARMS; ++j)
{
if (i + j < argc)
{
char *arg = argv[i + j];
if (strncmp (arg, "--", 2))
p[j] = arg;
else
break;
}
}
i = add_option (options, i, p);
}
}
/*
* Returns TRUE if option exist in config file.
*/
@ -320,8 +317,6 @@ int ConfigFileOptionExist(int config, const char *option)
{
FILE *fp;
char line[256];
int found_key=0;
int found_pkcs12=0;
char configfile_path[MAX_PATH];
strncpy(configfile_path, o.cnn[config].config_dir, sizeof(configfile_path));

@ -133,5 +133,4 @@ struct options
void init_options (struct options *o);
int Createargcargv(struct options* options, char* command_line);
void parse_argv (struct options* options, int argc, char *argv[]);
static int add_option (struct options *options, int i, char *p[]);
int ConfigFileOptionExist(int config, const char *option);

@ -42,7 +42,6 @@ int ConvertUnicode2Ascii(WCHAR str_unicode[], char str_ascii[], unsigned int str
unsigned int i;
unsigned int j;
int illegal_chars = false;
char *str_unicode_ptr = (char *) str_unicode;
for (i=0; (i < wcslen(str_unicode)) && (i < (str_ascii_size - 1)); i++)
{
for (j=0; j <= 256; j++)
@ -326,10 +325,8 @@ void ChangePassphraseThread(int config)
HWND hwndChangePSW;
MSG messages;
char conn_name[100];
char msg[100];
char keyfilename[MAX_PATH];
int keyfile_format=0;
TCHAR buf[1000];
/* Cut of extention from config filename. */
strncpy(conn_name, o.cnn[config].config_file, sizeof(conn_name));
@ -372,7 +369,6 @@ BOOL CALLBACK ChangePassphraseDialogFunc (HWND hwndDlg, UINT msg, WPARAM wParam,
char keyfile[MAX_PATH];
int keyfile_format;
BOOL Translated;
TCHAR buf[1000];
switch (msg) {
@ -687,7 +683,7 @@ int ChangePasswordPEM(HWND hwndDlg)
/* Use passphrase */
if ( !(PEM_write_PrivateKey(fp, privkey, \
EVP_des_ede3_cbc(), /* Use 3DES encryption */
newpsw, (int) strlen(newpsw), 0, NULL)))
(UCHAR*) newpsw, (int) strlen(newpsw), 0, NULL)))
{
/* can't write new key */
ShowLocalizedMsg(GUI_NAME, ERR_WRITE_NEW_KEY, keyfile);
@ -724,7 +720,6 @@ int ChangePasswordPKCS12(HWND hwndDlg)
X509 *cert;
STACK_OF(X509) *ca = NULL;
PKCS12 *p12;
PKCS12 *new_p12;
char *alias;
/* Get filename, old_psw and new_psw from Dialog */
@ -769,7 +764,7 @@ int ChangePasswordPKCS12(HWND hwndDlg)
PKCS12_free(p12);
/* Get FriendlyName of old cert */
alias = X509_alias_get0(cert, NULL);
alias = (char*) X509_alias_get0(cert, NULL);
/* Create new PKCS12 object */
p12 = PKCS12_create(newpsw, alias, privkey, cert, ca, 0,0,0,0,0);

@ -285,7 +285,6 @@ void LoadProxySettings(HWND hwndDlg)
void SaveProxySettings(HWND hwndDlg)
{
LONG status;
HKEY regkey;
DWORD dwDispos;
char proxy_source_string[2]="0";

@ -220,7 +220,7 @@ int GetRegKey(const char name[], char *data, const char default_data[], DWORD le
name,
0,
REG_SZ,
default_data,
(const PBYTE) default_data,
strlen(default_data)+1))
{
/* cant read / set reg-key */
@ -261,7 +261,7 @@ LONG GetRegistryValue(HKEY regkey, const char *name, char *data, DWORD len)
int SetRegistryValue(HKEY regkey, const char *name, char *data)
{
/* set a registry string */
if(RegSetValueEx(regkey, name, 0, REG_SZ, data, strlen(data)+1) != ERROR_SUCCESS)
if(RegSetValueEx(regkey, name, 0, REG_SZ, (PBYTE) data, strlen(data)+1) != ERROR_SUCCESS)
{
/* Error writing registry value */
ShowLocalizedMsg(GUI_NAME, ERR_WRITE_REGVALUE, GUI_REGKEY_HKCU, name);

@ -1,4 +1,4 @@
/*
/*
* OpenVPN-GUI -- A Windows GUI for OpenVPN.
*
* Copyright (C) 2004 Mathias Sundman <mathias@nilings.se>
@ -42,7 +42,6 @@ void RunConnectScript(int config, int run_as_service)
char batch_file[100];
DWORD ExitCode;
int i, TimeOut;
TCHAR buf[1000];
/* Cut of extention from config filename and add "_up.bat". */
strncpy(batch_file, o.cnn[config].config_file, sizeof(batch_file));
@ -144,7 +143,6 @@ void RunDisconnectScript(int config, int run_as_service)
char batch_file[100];
DWORD ExitCode;
int i, TimeOut;
TCHAR buf[1000];
/* Append "_down.bat" to config name. */
strncpy(batch_file, o.cnn[config].config_name, sizeof(batch_file));
@ -225,7 +223,6 @@ void RunPreconnectScript(int config)
char batch_file[100];
DWORD ExitCode;
int i, TimeOut;
TCHAR buf[1000];
/* Append "_pre.bat" to config name. */
strncpy(batch_file, o.cnn[config].config_name, sizeof(batch_file));

@ -41,8 +41,6 @@ int MyStartService()
DWORD dwOldCheckPoint;
DWORD dwStartTickCount;
DWORD dwWaitTime;
char msg[200];
TCHAR buf[1000];
int i;
/* Set Service Status = Connecting */
@ -181,9 +179,6 @@ int MyStopService()
SC_HANDLE schSCManager;
SC_HANDLE schService;
SERVICE_STATUS ssStatus;
DWORD dwOldCheckPoint;
DWORD dwStartTickCount;
DWORD dwWaitTime;
int i;
// Open a handle to the SC Manager database.
@ -248,9 +243,6 @@ int CheckServiceStatus()
SC_HANDLE schSCManager;
SC_HANDLE schService;
SERVICE_STATUS ssStatus;
DWORD dwOldCheckPoint;
DWORD dwStartTickCount;
DWORD dwWaitTime;
// Open a handle to the SC Manager database.
schSCManager = OpenSCManager(

@ -55,7 +55,6 @@ void OnNotifyTray(LPARAM lParam)
POINT pt; // point structure
int connected_config;
int i;
TCHAR buf[1000];
// Right click, show the menu
switch(lParam) {
@ -185,11 +184,7 @@ void DestroyPopupMenus()
void CreateItemList()
{
extern char ext_string[];
extern char allow_edit[2];
extern char allow_service[2];
int i;
TCHAR buf[1000];
if (o.num_configs == 1)
{
@ -319,8 +314,6 @@ BOOL LoadAppIcon()
void ShowTrayIcon()
{
TCHAR buf[1000];
ni.cbSize = sizeof(ni);
ni.uID = 0;
lstrcpyn(ni.szTip, LoadLocalizedString(MSG_TIP), sizeof(ni.szTip)/sizeof(*(ni.szTip)));
@ -346,11 +339,9 @@ void SetTrayIcon(int connected)
char msg[500];
char msg_connected[100];
char msg_connecting[100];
char conn_name[200];
char connected_since[50];
int i, first_conn;
int config=0;
TCHAR buf[1000];
ni.cbSize = sizeof(ni);
ni.uID = 0;

@ -26,6 +26,7 @@
#include "main.h"
#include "options.h"
#include "openvpn-gui-res.h"
#include "localization.h"
extern struct options o;
@ -33,14 +34,10 @@ void ViewLog(int config)
{
char filename[200];
extern char log_viewer[MAX_PATH];
extern char log_dir[MAX_PATH];
STARTUPINFO start_info;
PROCESS_INFORMATION proc_info;
SECURITY_ATTRIBUTES sa;
SECURITY_DESCRIPTOR sd;
char command_line[256];
CLEAR (start_info);
CLEAR (proc_info);
@ -79,14 +76,10 @@ void EditConfig(int config)
{
char filename[200];
extern char config_dir[MAX_PATH];
extern char editor[MAX_PATH];
STARTUPINFO start_info;
PROCESS_INFORMATION proc_info;
SECURITY_ATTRIBUTES sa;
SECURITY_DESCRIPTOR sd;
char command_line[256];
CLEAR (start_info);
CLEAR (proc_info);

Loading…
Cancel
Save