[Winpt-commits] r73 - in trunk: . Include Src

scm-commit at wald.intevation.org scm-commit at wald.intevation.org
Tue Nov 8 08:15:15 CET 2005


Author: twoaday
Date: 2005-11-08 08:15:13 +0100 (Tue, 08 Nov 2005)
New Revision: 73

Modified:
   trunk/AUTHORS
   trunk/Include/ChangeLog
   trunk/Include/wptCryptdisk.h
   trunk/Include/wptListView.h
   trunk/Include/wptVersion.h
   trunk/Src/ChangeLog
   trunk/Src/WinPT.cpp
   trunk/Src/wptAboutDlgs.cpp
   trunk/Src/wptClipVerifyDlg.cpp
   trunk/Src/wptGPG.cpp
   trunk/Src/wptGPGUtil.cpp
   trunk/Src/wptKeyPropsDlg.cpp
   trunk/Src/wptKeygenDlg.cpp
   trunk/Src/wptKeylist.cpp
   trunk/Src/wptKeyserver.cpp
   trunk/Src/wptKeyserverDlg.cpp
   trunk/Src/wptKeysignDlg.cpp
   trunk/Src/wptMainProc.cpp
   trunk/Src/wptRegistry.cpp
Log:
2005-11-08  Timo Schulz  <ts at g10code.com>
 
        More minor changes to avoid GCC warnings.
         
        * wptGPG.cpp (check_homedir): Free memory in case of errors.
        (multi_gnupg_path): Add strict mode. If non-strict mode return
        the folder even if it does not exist.
        (check_for_gpgwin): New.
        * wptKeyserverDlg.cpp (hkp_recv_key): Make sure import_res is
        initialized.
        * wptRegistry.cpp (get_reg_entry_gpg4win): New.
        (get_reg_entry_mo): Support for gpg4win.
         
For complete changes see ChangeLogs.


Modified: trunk/AUTHORS
===================================================================
--- trunk/AUTHORS	2005-11-07 12:48:34 UTC (rev 72)
+++ trunk/AUTHORS	2005-11-08 07:15:13 UTC (rev 73)
@@ -43,7 +43,7 @@
 wptSecmem.cpp - John J. Kane <jkane89 at softhome.net>
 
 Translators:
-[German] Timo Schulz <ts at winpt.org>,
+[German] Timo Schulz <twoaday at freakmail.de>,
          Thomas Henlich <henlich at mmers1.mw.tu-dresden.de>         
 [French] Nicolas Robaux <nicolas at robaux.com>
 [Italy] Andrea Ungaro <semperfin at tin.it>,

Modified: trunk/Include/ChangeLog
===================================================================
--- trunk/Include/ChangeLog	2005-11-07 12:48:34 UTC (rev 72)
+++ trunk/Include/ChangeLog	2005-11-08 07:15:13 UTC (rev 73)
@@ -1,6 +1,11 @@
+2005-11-07  Timo Schulz  <ts at g10code.com>
+
+	* wptVersion.h: Removed MODERN_BUILD directive and removed
+	old constants.
+	
 2005-11-03  Timo Schulz  <ts at g10code.com>
 
-	* wptTypes.h (BUG): cast hwnd to HWND to avoid warning.
+	* wptTypes.h (BUG): Cast hwnd to HWND to avoid warning.
 	
 2005-11-03  Werner Koch  <wk at g10code.com>
 

Modified: trunk/Include/wptCryptdisk.h
===================================================================
--- trunk/Include/wptCryptdisk.h	2005-11-07 12:48:34 UTC (rev 72)
+++ trunk/Include/wptCryptdisk.h	2005-11-08 07:15:13 UTC (rev 73)
@@ -75,4 +75,4 @@
 BOOL CALLBACK cryptdisk_new_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, 
 				      LPARAM lparam);
 
-#endif /* WPT_CRYPTDISK_H */
\ No newline at end of file
+#endif /* WPT_CRYPTDISK_H */

Modified: trunk/Include/wptListView.h
===================================================================
--- trunk/Include/wptListView.h	2005-11-07 12:48:34 UTC (rev 72)
+++ trunk/Include/wptListView.h	2005-11-08 07:15:13 UTC (rev 73)
@@ -61,4 +61,4 @@
 int listview_del_items( listview_ctrl_t ctx );
 void listview_select_all( listview_ctrl_t ctx );
 
-#endif /* WPT_LISTVIEW_H */
\ No newline at end of file
+#endif /* WPT_LISTVIEW_H */

Modified: trunk/Include/wptVersion.h
===================================================================
--- trunk/Include/wptVersion.h	2005-11-07 12:48:34 UTC (rev 72)
+++ trunk/Include/wptVersion.h	2005-11-08 07:15:13 UTC (rev 73)
@@ -20,23 +20,15 @@
 #ifndef WPT_VERSION_H
 #define WPT_VERSION_H
 
-#ifdef WINPT_MODERN_BUILD
-
+/* Application name */
 #define PGM_NAME PACKAGE_NAME
-#define PGM_VERSION PACKAGE_VERSION
-#define PGM_DATE "(xxxx?-x?-x?)"  /* FIXME */
 
-#else
-/* Application name */
-#define PGM_NAME "WinPT" 
-
 /* Application version */
-#define PGM_VERSION "0.10.3-beta"
-#define PGM_DATE "(2005-10-25)"
+#define PGM_VERSION PACKAGE_VERSION
+#define PGM_DATE "("__DATE__")"
 
-/* Package version string */
-#define PACKAGE_VERSION "Version: "PGM_VERSION" "PGM_DATE
-#endif
+/* Full package version string */
+#define PACKAGE_FULL_VERSION "Version: "PGM_VERSION" "PGM_DATE
 
 /*-- WinPT.cpp --*/
 extern HINSTANCE glob_hinst;	/* Global HINSTANCE for tray window */

Modified: trunk/Src/ChangeLog
===================================================================
--- trunk/Src/ChangeLog	2005-11-07 12:48:34 UTC (rev 72)
+++ trunk/Src/ChangeLog	2005-11-08 07:15:13 UTC (rev 73)
@@ -1,3 +1,16 @@
+2005-11-08  Timo Schulz  <ts at g10code.com>
+
+	More minor changes to avoid GCC warnings.
+	
+	* wptGPG.cpp (check_homedir): Free memory in case of errors.
+	(multi_gnupg_path): Add strict mode. If non-strict mode return
+	the folder even if it does not exist.
+	(check_for_gpgwin): New.
+	* wptKeyserverDlg.cpp (hkp_recv_key): Make sure import_res is
+	initialized.
+	* wptRegistry.cpp (get_reg_entry_gpg4win): New.
+	(get_reg_entry_mo): Support for gpg4win.
+	
 2005-11-07  Timo Schulz  <ts at g10code.com>
 
 	* wptMainProc.cpp (winpt_main_proc): Disable

Modified: trunk/Src/WinPT.cpp
===================================================================
--- trunk/Src/WinPT.cpp	2005-11-07 12:48:34 UTC (rev 72)
+++ trunk/Src/WinPT.cpp	2005-11-08 07:15:13 UTC (rev 73)
@@ -42,7 +42,6 @@
 
 #define MIN_GPG_VER   "1.4.3"	/* Minimal GPG version. */
 #define MIN_GPGME_VER "1.2.0"	/* Minimal GPGME version. */
-#define MIN_PTD_VER   "0.8.1"   /* Minimal PTD version. */
 
 
 HINSTANCE glob_hinst;	/* global instance for the dialogs */
@@ -391,7 +390,7 @@
 
     if (cmdline && stristr (cmdline, "--wipe-freespace")) {
 	dialog_box_param (glob_hinst, (LPCTSTR)IDD_WINPT_SPACE_SECDEL,
-			    GetDesktopWindow(), space_wipefrees_dlg_proc, NULL,
+			    GetDesktopWindow(), space_wipefrees_dlg_proc, 0,
 			    _("Wipe Free Space"), IDS_WINPT_SPACE_SECDEL);
 	free_gnupg_table ();
 	return 0;
@@ -404,7 +403,7 @@
 	update_keycache (GetDesktopWindow ());
 	if (stristr (cmdline, "keymanager"))
 	    dialog_box_param (glob_hinst, (LPCTSTR)IDD_WINPT_KEYMISC,
-			    GetDesktopWindow(), keymanager_dlg_proc, NULL,
+			    GetDesktopWindow(), keymanager_dlg_proc, 0,
 			    _("Key Manager"), IDS_WINPT_KEYMISC);  
 	else {
 	    gpg_card_t crd = gpg_card_load ();

Modified: trunk/Src/wptAboutDlgs.cpp
===================================================================
--- trunk/Src/wptAboutDlgs.cpp	2005-11-07 12:48:34 UTC (rev 72)
+++ trunk/Src/wptAboutDlgs.cpp	2005-11-08 07:15:13 UTC (rev 73)
@@ -98,7 +98,7 @@
                          "more details. "));
 	SetDlgItemText (dlg, IDC_ABOUT_GPG, _("&About GPG..."));
 	SetDlgItemText (dlg, IDC_ABOUT_HELP, _("&Help"));
-	SetDlgItemText (dlg, IDC_WINPT_VERSION, PACKAGE_VERSION);
+	SetDlgItemText (dlg, IDC_WINPT_VERSION, PACKAGE_FULL_VERSION);
 
 	center_window (dlg, NULL);
 	SetForegroundWindow (dlg);

Modified: trunk/Src/wptClipVerifyDlg.cpp
===================================================================
--- trunk/Src/wptClipVerifyDlg.cpp	2005-11-07 12:48:34 UTC (rev 72)
+++ trunk/Src/wptClipVerifyDlg.cpp	2005-11-08 07:15:13 UTC (rev 73)
@@ -267,7 +267,7 @@
             
         case IDC_VERIFY_SAVE:
             dialog_box_param (glob_hinst, (LPCTSTR)IDD_WINPT_FILE_SAVE, dlg,
-                              file_save_dlg_proc, NULL, _("Save Plaintext"), 
+                              file_save_dlg_proc, 0, _("Save Plaintext"), 
 			      IDS_WINPT_FILE_SAVE);
             break;
         }

Modified: trunk/Src/wptGPG.cpp
===================================================================
--- trunk/Src/wptGPG.cpp	2005-11-07 12:48:34 UTC (rev 72)
+++ trunk/Src/wptGPG.cpp	2005-11-08 07:15:13 UTC (rev 73)
@@ -22,7 +22,6 @@
 #endif
 
 #include <windows.h>
-#include <shlobj.h>
 #include <string.h>
 #include <stdio.h>
 #include <shlobj.h>
@@ -40,7 +39,9 @@
 #include "wptW32API.h"
 #include "wptCrypto.h"
 
-#define GPG_CONF "gpg.conf"
+#define GPG_CONF	"gpg.conf"
+#define GPG_REG_EXE	"gpgProgram"	/* registry name for the binary. */
+#define GPG_REG_HOME	"HomeDir"	/* registry name of the home dir. */
 
 struct gpg_watcher_s {
     FILETIME	last_access;
@@ -62,7 +63,7 @@
 
 /* Return the application data folder of the current user. */
 static char*
-multi_gnupg_path (void)
+multi_gnupg_path (int strict)
 {
     static char buf[256+64];
     BOOL ec;
@@ -71,10 +72,13 @@
     memset (buf, 0, sizeof (buf));
     /* XXX: ec should be NOERROR (MSDN) but NOERROR is defined as '0' !? */
     ec = SHGetSpecialFolderPath (HWND_DESKTOP, buf, CSIDL_APPDATA, TRUE);
-    if (ec != 1)
+    if (ec != 1) {
+	log_debug ("multi_gnupg_path: SHGetSpecialFolderPath() failed\r\n",
+		   (int)GetLastError ());
 	return NULL;
+    }
     strcat (buf, "\\gnupg");
-    if (access (buf, 00))
+    if (strict && access (buf, 00))
 	return NULL;
     return m_strdup (buf);
 }
@@ -86,16 +90,17 @@
 char*
 get_gnupg_path (void)
 {
-    char *p = NULL, *path = NULL;
+    char *p = NULL;
+    char *path = NULL;
     
-    p = get_reg_entry_gpg ("HomeDir");
+    p = get_reg_entry_gpg (GPG_REG_HOME);
     if (p) {
 	path = m_strdup (p);
 	free_if_alloc (p);
 	return path;
     }
     else
-	return multi_gnupg_path ();
+	return multi_gnupg_path (1);
     return m_strdup ("c:\\gnupg");
 }
 
@@ -105,7 +110,9 @@
 char*
 get_gnupg_cfgfile (void)
 {    
-    char *p = NULL, *optfile = NULL, *path = NULL;
+    char *p = NULL;
+    char *optfile = NULL;
+    char *path = NULL;
     size_t nlen = 0;
 
     path = get_gnupg_path ();
@@ -178,7 +185,7 @@
     char *p;
     char *pgm = NULL;
 
-    p = get_reg_entry_gpg ("gpgProgram");
+    p = get_reg_entry_gpg (GPG_REG_EXE);
     if (!p) {
 	char *path = get_gnupg_path ();
 	if (!path)
@@ -200,8 +207,8 @@
 static char *
 default_key_from_cache (int *ret_no_useable)
 {
-    const char * s;
-    char * keyid = NULL;
+    const char *s;
+    char *keyid = NULL;
     gpgme_key_t key;
     gpg_keycache_t sec = keycache_get_ctx (0);
 
@@ -261,8 +268,8 @@
 	return default_key_from_cache (&no_usable);
     rc = parse_gpg_options (optfile, &opt);
     if (rc) {
-	free_if_alloc( optfile );
-	return default_key_from_cache( &no_usable );
+	free_if_alloc (optfile);
+	return default_key_from_cache (&no_usable);
     }
     e = find_option( opt, "default-key" );
     if ( e )
@@ -286,19 +293,34 @@
 } /* get_gnupg_default_key */
 
 
+char* get_reg_entry_gpg4win (const char *path);
+
+/* Check if GPG4WIN is available and if so, use the
+   install path to figure out where the gpg.exe is. */
+char*
+check_for_gpg4win (void)
+{
+    return get_reg_entry_gpg4win ("\\gpg.exe");
+}
+
+
 /* Check if the gpg application (exe file) is available. */
 int
 check_gnupg_prog (void)
 {
-    char *pgm = NULL;
+    char *gpgexe = NULL;
     int rc = 0;
 
-    pgm = get_gnupg_prog ();
-    if (!pgm)
-	rc = WPTERR_GPG_EXEFILE;
-    if (file_exist_check (pgm))
-	rc = WPTERR_GPG_EXEFILE;
-    free_if_alloc (pgm);
+    gpgexe = get_gnupg_prog ();
+    if (!gpgexe || file_exist_check (gpgexe)) {
+	free_if_alloc (gpgexe);
+	gpgexe = check_for_gpg4win ();
+	if (!gpgexe || file_exist_check (gpgexe))
+	    rc = WPTERR_GPG_EXEFILE;
+	else
+	    set_reg_entry_gpg (GPG_REG_EXE, gpgexe);
+    }
+    free_if_alloc (gpgexe);
     return rc;
 }
 
@@ -357,7 +379,6 @@
 	gpgme_release (ctx);
 	return rc;
     }
-
     /* FIXME: This check is wrong! */
     if (major < *r_major || minor < *r_minor)
 	rc = 1;
@@ -421,12 +442,13 @@
 	rc = WPTERR_GPG_KEYRINGS;
     else
 	secring_ok = 1;
+
     if (!pubring_ok || !secring_ok) {
 	optfile = get_gnupg_cfgfile ();
 	if (!optfile)
 	    return WPTERR_GPG_KEYRINGS;
 	rc = file_exist_check (optfile);
-	if (!rc && get_file_size(optfile) > 0) {
+	if (!rc && get_file_size (optfile) > 0) {
 	    rc = check_gnupg_cfgfile (optfile, &secrings, &pubrings);
 	    if (!rc && secrings && pubrings) {
 		free_if_alloc (optfile);
@@ -453,10 +475,10 @@
     FILE *fp;
     char *s, *optfile;
 
-    s = get_gnupg_path( );
+    s = get_gnupg_path ();
     if( s == NULL )
 	return WPTERR_FILE_CREAT;
-    optfile = make_filename( s, GPG_CONF, NULL );
+    optfile = make_filename (s, GPG_CONF, NULL);
     fp = fopen( optfile, "wb" );
     if( fp == NULL ) {	
 	return WPTERR_FILE_CREAT;
@@ -821,12 +843,15 @@
 check_homedir (void)
 {	
     char *homedir = NULL;
-    int yes = 0;
+    int yes = 0, set_reg=0;
+    int rc = 0;
 
-    homedir = get_reg_entry_gpg ("HomeDir");
+    homedir = get_reg_entry_gpg (GPG_REG_HOME);
+    if (!homedir) {
+	set_reg = 1;
+	homedir = multi_gnupg_path (0);
+    }
     if (!homedir)
-	homedir = multi_gnupg_path ();
-    if (!homedir)
 	homedir = m_strdup ("c:\\gnupg");
     if (homedir) {
 	if (GetFileAttributes (homedir) == 0xFFFFFFFF) {
@@ -834,17 +859,17 @@
 			   _("%s does not exit.\n"
 			     "Do you want to create this directory?"), homedir);
 	    if (yes == IDYES) {
-		BOOL ec = CreateDirectory (homedir, NULL);
-		free_if_alloc (homedir);
-		if (ec == FALSE)
-		    return WPTERR_DIR_CREAT;
-		return 0;
+		if (!CreateDirectory (homedir, NULL))
+		    rc = WPTERR_DIR_CREAT;
 	    }
-	    return WPTERR_DIR_OPEN;
+	    else
+		rc = WPTERR_DIR_OPEN;
 	}
+	if (set_reg)
+	    set_reg_entry_gpg (GPG_REG_HOME, homedir);
 	free_if_alloc (homedir);
     }
-    return 0;
+    return rc;
 }
 
 
@@ -858,11 +883,11 @@
     rc = check_homedir ();
     if (rc)
 	return rc;
-    if ((homedir = get_reg_entry_gpg ("HomeDir")) &&
-	!(prog = get_reg_entry_gpg ("gpgProgram" ))) {
+    if ((homedir = get_reg_entry_gpg (GPG_REG_HOME)) &&
+	!(prog = get_reg_entry_gpg (GPG_REG_EXE ))) {
 	prog = make_filename (homedir, "gpg", "exe");
 	if (file_exist_check (prog) == 0) {
-	    rc = set_reg_entry_gpg ("gpgProgram", prog);
+	    rc = set_reg_entry_gpg (GPG_REG_EXE, prog);
 	    if (rc)
 		goto fail;
 	}
@@ -870,17 +895,17 @@
 	free_if_alloc (prog);
 	return rc;
     }
-    if ((prog = get_reg_entry_gpg ("gpgProgram"))
+    if ((prog = get_reg_entry_gpg (GPG_REG_EXE))
 	&& file_exist_check (prog)) {
 	free_if_alloc (prog);
-	homedir = get_reg_entry_gpg ("HomeDir");
+	homedir = get_reg_entry_gpg (GPG_REG_HOME);
 	if (!homedir) {
 	    rc = WPTERR_GENERAL;
 	    goto fail;
 	}
 	prog = make_filename (homedir, "gpg", "exe");
 	if (file_exist_check (prog) == 0) {
-	    rc = set_reg_entry_gpg ("gpgProgram", prog);
+	    rc = set_reg_entry_gpg (GPG_REG_EXE, prog);
 	    if (rc)
 		goto fail;
 	    free_if_alloc (prog);
@@ -1081,7 +1106,7 @@
 	else {
 	    rc = 0;
 	    fclose (fp);
-	    unlink (tmpfile);
+	    remove (tmpfile);
 	}
 	free_if_alloc (tmpfile);
 	if (!fp || rc == IDCANCEL)

Modified: trunk/Src/wptGPGUtil.cpp
===================================================================
--- trunk/Src/wptGPGUtil.cpp	2005-11-07 12:48:34 UTC (rev 72)
+++ trunk/Src/wptGPGUtil.cpp	2005-11-08 07:15:13 UTC (rev 73)
@@ -24,6 +24,7 @@
 #include <windows.h>
 #include <sys/stat.h>
 
+#include "wptErrors.h"
 #include "gpgme.h"
 
 
@@ -285,8 +286,11 @@
 	si.hStdInput = in;
     si.wShowWindow = SW_HIDE;
     if (!CreateProcess (NULL, (char*)cmd, NULL, NULL, TRUE, 0, 
-		        NULL, NULL, &si, &pi))
+		        NULL, NULL, &si, &pi)) {
+	log_debug ("create_process: CreateProcess() failed ec=%d\r\n",
+		   (int)GetLastError ());
 	return -1;
+    }
     WaitForSingleObject (pi.hProcess, INFINITE);
     CloseHandle (pi.hProcess);
     return 0;

Modified: trunk/Src/wptKeyPropsDlg.cpp
===================================================================
--- trunk/Src/wptKeyPropsDlg.cpp	2005-11-07 12:48:34 UTC (rev 72)
+++ trunk/Src/wptKeyPropsDlg.cpp	2005-11-08 07:15:13 UTC (rev 73)
@@ -156,8 +156,6 @@
 static const char*
 get_pref_cipher (winpt_key_t k)
 {
-    const char *sym_prefs=NULL;    
-
     if (k->is_v3)
 	return "IDEA";
     if (!k->ext->sym_prefs)

Modified: trunk/Src/wptKeygenDlg.cpp
===================================================================
--- trunk/Src/wptKeygenDlg.cpp	2005-11-07 12:48:34 UTC (rev 72)
+++ trunk/Src/wptKeygenDlg.cpp	2005-11-08 07:15:13 UTC (rev 73)
@@ -375,7 +375,7 @@
     
     switch ( msg ) {
     case WM_INITDIALOG:
-	if (lparam != NULL)
+	if (lparam != 0)
 	    ctx = (genkey_s *)lparam;
         SetWindowText( dlg, _("Key Generation") );
         SetDlgItemText( dlg, IDC_KEYGEN_INFO, 
@@ -606,7 +606,7 @@
 	switch( LOWORD( wparam ) ) {
 	case IDC_KEYWIZARD_EXPERT:
 	    DialogBoxParam (glob_hinst, (LPCTSTR)IDD_WINPT_KEYGEN, dlg,
-			    keygen_dlg_proc, NULL);
+			    keygen_dlg_proc, 0);
 	    EndDialog (dlg, TRUE);
 	    break;
 

Modified: trunk/Src/wptKeylist.cpp
===================================================================
--- trunk/Src/wptKeylist.cpp	2005-11-07 12:48:34 UTC (rev 72)
+++ trunk/Src/wptKeylist.cpp	2005-11-08 07:15:13 UTC (rev 73)
@@ -297,6 +297,7 @@
     case GPGME_PK_ELG:
     case GPGME_PK_ELG_E: return "ELG";
     case GPGME_PK_RSA: return "RSA";
+    default: return "???";
     }
     return "???";
 }
@@ -374,7 +375,6 @@
 {
     gpgme_user_id_t u;
     const char *attr;
-    int i = 0;
     u32 key_attr =0;
 
     if (uididx < 0 || count_userids (key) > uididx)
@@ -495,7 +495,7 @@
 static const char*
 calc_validity (gpg_group_t grp)
 {
-    int level = 0, valid;
+    int valid=0;
     gpg_member_t mbr;
     gpgme_key_t key;
 
@@ -548,7 +548,7 @@
     listview_ctrl_t lv;
     listview_column_t col;
     int j, n = 0;
-    int kl_nolist = 0, rc = 0;
+    int rc = 0;
     
     rc = listview_new (&lv);
     if( rc )
@@ -812,7 +812,7 @@
 int
 keylist_add_key (listview_ctrl_t lv, int mode, gpgme_key_t key)
 {
-    int uids, rc = 0, i, n = 0;
+    int uids, rc = 0, i;
     gpgme_subkey_t k;
 
     /* if the entire key is disabled, just return. */

Modified: trunk/Src/wptKeyserver.cpp
===================================================================
--- trunk/Src/wptKeyserver.cpp	2005-11-07 12:48:34 UTC (rev 72)
+++ trunk/Src/wptKeyserver.cpp	2005-11-08 07:15:13 UTC (rev 73)
@@ -470,9 +470,9 @@
 {
     struct stat statbuf;
     FILE *fp;
-    char buf[1024], * s, * p;
+    char buf[1024], * s, *p;
     char *user = NULL, *pass = NULL;    
-    int pos, proxy_auth = 0;
+    int pos;
     int no_config=0, chk_pos=0;
     
     for (pos = 0; pos < MAX_KEYSERVERS; pos++) {
@@ -499,12 +499,11 @@
     }
     /* check if the host has a http:// prefix and skip it */
     if( proxy.host && !strncmp( proxy.host, "http://", 7 ) ) {
-	const char *s = proxy.host+7;
-	char * p = m_strdup (s);
-	if (!p)
-	    BUG (0);
+	char *pr = m_strdup (proxy.host+7);
+	if (!pr)
+	    BUG (NULL);
 	free_if_alloc (proxy.host);
-	proxy.host = p;
+	proxy.host = pr;
     }
     free_if_alloc (user);
     free_if_alloc (pass);
@@ -547,16 +546,14 @@
 	    memcpy (server[pos].name, s, (p-s));
 	}
 	pos++;
-	if (pos > MAX_KEYSERVERS)
-	{
+	if (pos > MAX_KEYSERVERS) {
 	    msg_box (NULL, _("The keyserver limit is exceeded"), _("Keyserver Warning"), MB_INFO);
 	    break;
 	}
     }
     if (fp)
 	fclose (fp);
-    if (!pos) 
-    {
+    if (!pos) {
 	/* only issue an error if the config file exist but it has no valid entries. */
 	keyserver_set_default (NULL, HKP_PORT);
 	if (!no_config)

Modified: trunk/Src/wptKeyserverDlg.cpp
===================================================================
--- trunk/Src/wptKeyserverDlg.cpp	2005-11-07 12:48:34 UTC (rev 72)
+++ trunk/Src/wptKeyserverDlg.cpp	2005-11-08 07:15:13 UTC (rev 73)
@@ -104,7 +104,7 @@
     gpgme_ctx_t ctx;
     gpgme_data_t keydata;
     gpgme_error_t ec;
-    gpgme_import_result_t import_res;
+    gpgme_import_result_t import_res = NULL;
     int rc;
     char *rawkey = NULL, msg[384];
     
@@ -158,7 +158,7 @@
     /* if we use the refresh mode, a lot of keys will be fetched and thus only
        a summarize at the end is presented and not for each key. */
     if (!(flags & KM_KS_REFRESH)) {
-	if (import_res->new_user_ids == 0) {
+	if (import_res && import_res->new_user_ids == 0) {
 	    _snprintf (msg, DIM (msg)-1,
 		       _("Key '%s' successfully received but nothing was changed."), pattern );
 	    status_box (dlg, msg, _("GnuPG Status"));
@@ -399,7 +399,7 @@
         switch( LOWORD( wparam ) ) {
         case IDC_KEYSERVER_PROXSETT:
             dialog_box_param( glob_hinst, (LPCTSTR)IDD_WINPT_KEYSERVER_PROXY, glob_hwnd,
-                              keyserver_proxy_dlg_proc, NULL, 
+                              keyserver_proxy_dlg_proc, 0, 
                               _("Proxy Settings"), IDS_WINPT_KEYSERVER_PROXY );
             set_proxy( dlg );
             return TRUE;

Modified: trunk/Src/wptKeysignDlg.cpp
===================================================================
--- trunk/Src/wptKeysignDlg.cpp	2005-11-07 12:48:34 UTC (rev 72)
+++ trunk/Src/wptKeysignDlg.cpp	2005-11-08 07:15:13 UTC (rev 73)
@@ -194,8 +194,6 @@
 static const char*
 get_expire_date (gpgme_key_t key)
 {
-    static char tmp[64];
-
     u32 u = key->subkeys->expires;
     if (!u)
 	return _("never");

Modified: trunk/Src/wptMainProc.cpp
===================================================================
--- trunk/Src/wptMainProc.cpp	2005-11-07 12:48:34 UTC (rev 72)
+++ trunk/Src/wptMainProc.cpp	2005-11-08 07:15:13 UTC (rev 73)
@@ -572,7 +572,7 @@
             
             /** Misc **/
         case ID_WINPT_KEY:
-            param = NULL;
+            param = 0;
             if( cmd )
                 param = (LPARAM)cmd;
             dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_KEYMISC, 

Modified: trunk/Src/wptRegistry.cpp
===================================================================
--- trunk/Src/wptRegistry.cpp	2005-11-07 12:48:34 UTC (rev 72)
+++ trunk/Src/wptRegistry.cpp	2005-11-08 07:15:13 UTC (rev 73)
@@ -380,11 +380,36 @@
 }
 
 
-char *
-get_reg_entry_mo(void)
+/* Return if possible the GPG4Win installation directory concatenated
+   with the string in @path if given. */
+char*
+get_reg_entry_gpg4win (const char *path)
+{
+    char *p, *pp;
+    p = get_reg_entry (HKEY_LOCAL_MACHINE,
+		       "Software\\GNU\\GnuPG", "Install Directory");
+    if (!p)
+	return NULL;
+    if (!path)
+	return p;
+    pp = new char[strlen (p) + strlen (path) + 4];
+    if (!pp)
+	BUG (NULL);
+    sprintf (pp, "%s\\%s", p, path);
+    free_if_alloc (p);
+    return pp;
+}
+
+    
+char*
+get_reg_entry_mo (void)
 {	
-    return get_reg_entry(HKEY_CURRENT_USER, 
-			 "Control Panel\\Mingw32\\NLS", "MODir");
+    char *p;
+    p = get_reg_entry (HKEY_CURRENT_USER, 
+		       "Control Panel\\Mingw32\\NLS", "MODir");
+    if (!p)
+	p = get_reg_entry_gpg4win ("share\\locale");
+    return p;
 }
 
 
@@ -440,7 +465,8 @@
 set_reg_winpt_prefs (winpt_reg_prefs_s * opt)
 {
     char buf[128];
-    int rc = 0, i;
+    size_t i;
+    int rc = 0;
 
     for (i=1; i < DIM (cfg); i++) {
 	switch (i) {
@@ -550,7 +576,7 @@
 get_reg_winpt_prefs (winpt_reg_prefs_s * opt)
 {
     char * val = NULL;
-    int i;
+    size_t i;
 
     for (i=1; i < DIM (cfg); i++) {
 	val = get_reg_entry (HKEY_CURRENT_USER, WINPT_REG, cfg[i]);



More information about the Winpt-commits mailing list