[Winpt-commits] r407 - trunk/Src

scm-commit at wald.intevation.org scm-commit at wald.intevation.org
Mon Feb 6 20:26:03 CET 2012


Author: twoaday
Date: 2012-02-06 20:26:03 +0100 (Mon, 06 Feb 2012)
New Revision: 407

Modified:
   trunk/Src/ChangeLog
   trunk/Src/WinPT.cpp
   trunk/Src/versioninfo.rc
   trunk/Src/wptErrors.cpp
   trunk/Src/wptFileManager.cpp
   trunk/Src/wptGPG.cpp
   trunk/Src/wptNLS.cpp
Log:
2012-02-06  Timo Schulz  <twoaday at gmx.net>

        * wptNLS.cpp (gettext_free_current_domain): Replace free()
	        with safe_free():
        * WinPT.cpp: Use log_debug to improve bug tracking capabilities.



Modified: trunk/Src/ChangeLog
===================================================================
--- trunk/Src/ChangeLog	2012-02-01 18:47:45 UTC (rev 406)
+++ trunk/Src/ChangeLog	2012-02-06 19:26:03 UTC (rev 407)
@@ -1,3 +1,9 @@
+2012-02-06  Timo Schulz  <twoaday at gmx.net>
+
+        * wptNLS.cpp (gettext_free_current_domain): Replace free() 
+	with safe_free():
+	* WinPT.cpp: Use log_debug to improve bug tracking capabilities.
+	
 2012-01-29  Timo Schulz  <twoaday at gmx.net>
 
         * wptNLS.cpp: Added 'Dutch' as a valid language.

Modified: trunk/Src/WinPT.cpp
===================================================================
--- trunk/Src/WinPT.cpp	2012-02-01 18:47:45 UTC (rev 406)
+++ trunk/Src/WinPT.cpp	2012-02-06 19:26:03 UTC (rev 407)
@@ -99,13 +99,12 @@
 int
 update_keycache (HWND hwnd)
 {
-    int err;
     refresh_cache_s rcs;
 
     /* no need to rebuild the sig cache each time. */
     memset (&rcs, 0, sizeof (rcs));
     rcs.kring_update = 1;
-    err = DialogBoxParam (glob_hinst, (LPCSTR)IDD_WINPT_KEYCACHE, hwnd,
+    int err = DialogBoxParam (glob_hinst, (LPCSTR)IDD_WINPT_KEYCACHE, hwnd,
 		    keycache_dlg_proc, (LPARAM)&rcs);
     if (err) {
 	char *cfgf = get_gnupg_config ();
@@ -124,10 +123,10 @@
 gpg_set_debug_mode (int val)
 {
     static char buf[MAX_PATH+1];
-    char tmp[128];
     
     /* XXX: no gpgme.dbg is created. */
     if (val > 0) {
+	char tmp[128];
 	GetTempPath (DIM (tmp)-1, tmp);
 	_snprintf (buf, DIM (buf)-1, "GPGME_DEBUG=5:%sgpgme.dbg", tmp);
 	putenv (buf);
@@ -173,7 +172,8 @@
 check_readonly_attr (const char *homedir)
 {
     const char *files[] = {"pubring.gpg", "secring.gpg", "trustdb.gpg", NULL};
-
+    
+    log_debug("check if there are gpg files with a read-only attribute");
     for (int i=0; files[i] != NULL; i++) {
 	char *file = make_filename (homedir, files[i], NULL);
 	remove_crit_file_attrs (file, 0);
@@ -340,7 +340,7 @@
     char output[512];
     char temp[MAX_PATH+1];
 	
-    GetTempPath (DIM (temp) -1, temp);
+    GetTempPath (DIM (temp) - 1, temp);
     _snprintf (output, DIM (output)-1,
 	"The GPGME output file is %sgpgme.dbg\n"
 	"The WinPT output file is %swinpt.log\n", temp, temp);
@@ -355,9 +355,8 @@
 {
     gpg_keycache_t pc;
     gpgme_key_t key;
-    int n;
 
-    n=0;
+    int n = 0;
     pc = keycache_get_ctx (1);
     while (!gpg_keycache_next_key (pc, 0, &key)) {
 	if (key->subkeys->pubkey_algo == GPGME_PK_ELG)
@@ -376,6 +375,7 @@
     memset (&osver, 0, sizeof (osver));
     osver.dwOSVersionInfoSize = sizeof (osver);
     
+    log_debug("check OS version");
     if (!GetVersionEx (&osver)) {
 	MessageBox (NULL, _("Could not read the OS version."), _("WinPT Error"), MB_ERR);
 	return 0;
@@ -419,6 +419,7 @@
 	return 0;
     }    
 
+    log_debug("check PTD and GPGME version");
     get_file_version ("winpt.exe", &ver[0], &ver[1], &ver[2], &ver[3]);
     ec = get_file_version ("PTD.dll", &ptdver[0], &ptdver[1], &ptdver[2], &ptdver[3]);
     if (!ec && (ptdver[0] != ver[0] || ptdver[1] != ver[1] || ptdver[2] != ver[2])) {
@@ -458,13 +459,13 @@
 		     _("WinPT Error"), MB_ERR);
     }
 
-    if (is_gpg4win_installed ())
+    if (is_gpg4win_installed ()) {
+	log_debug("gpg4win: load gpg environment");
 	load_gpg_env (); /* TODO: check return code. */
+    }
 
     rc = gnupg_check_homedir ();
-    if (rc) {
-	char *p;
-
+    if (rc) {	
 	log_box (_("WinPT Error"), MB_ERR, 
 	         _("GPG home directory is not set correctly.\n"
 		   "Please check the GPG registry settings:\n%s."),
@@ -473,7 +474,9 @@
 			      _("Select GPG Public Keyring"),
 			      "GPG Keyrings (*.gpg)\0*.gpg\0\0",
 			      NULL);
-	if (s != NULL && (p=strrchr (s, '\\'))) {
+	
+	char * p;
+	if (s != NULL && (p = strrchr (s, '\\'))) {
 	    char *path = substr (s, 0, (p-s));
 
 	    set_reg_entry_gpg ("HomeDir", path);
@@ -599,6 +602,7 @@
     UpdateWindow (hwnd);
 
     if (!first_start && !start_gpgprefs) {
+	log_debug("backup gpg config file and check back-end");
 	gnupg_backup_options ();	
 	if (!check_crypto_engine ()) {
 	    DestroyWindow (hwnd);

Modified: trunk/Src/versioninfo.rc
===================================================================
--- trunk/Src/versioninfo.rc	2012-02-01 18:47:45 UTC (rev 406)
+++ trunk/Src/versioninfo.rc	2012-02-06 19:26:03 UTC (rev 407)
@@ -15,8 +15,8 @@
 #line __LINE__ "versioninfo.rc.in"
 
 VS_VERSION_INFO VERSIONINFO
- FILEVERSION 1,5,0,0
- PRODUCTVERSION 1,5,0,0
+ FILEVERSION 1,5,1,0
+ PRODUCTVERSION 1,5,1,0
  FILEFLAGSMASK 0x3fL
 #ifdef _DEBUG
  FILEFLAGS 0x1L
@@ -34,15 +34,15 @@
             VALUE "Comments", "This is Free Software under the terms of the GNU GPL v2\0"
             VALUE "CompanyName", "\0"
             VALUE "FileDescription", "Windows Privacy Tray (WinPT)\0"
-            VALUE "FileVersion", "1.5.0\0"
+            VALUE "FileVersion", "1.5.1-svn\0"
             VALUE "InternalName", "WinPT\0"
             VALUE "LegalCopyright", " Copyright (C) 2012 Timo Schulz\0"
             VALUE "LegalTrademarks", "\0"
             VALUE "OriginalFilename", "WinPT.exe\0"
             VALUE "PrivateBuild", "\0"
             VALUE "ProductName", "Windows Privacy Tray\0"
-            VALUE "ProductVersion", "1.5.0\0"
-            VALUE "SpecialBuild", "2012-01-29T13:20+0100\0"
+            VALUE "ProductVersion", "1.5.1-svn\0"
+            VALUE "SpecialBuild", "2012-02-06T20:18+0100\0"
         END
     END
     BLOCK "VarFileInfo"

Modified: trunk/Src/wptErrors.cpp
===================================================================
--- trunk/Src/wptErrors.cpp	2012-02-01 18:47:45 UTC (rev 406)
+++ trunk/Src/wptErrors.cpp	2012-02-06 19:26:03 UTC (rev 407)
@@ -35,14 +35,14 @@
 gpg_strerror (int errid)
 {
     static char buf[2*MAX_PATH+1];
-    char *path;
 
-    path = get_gnupg_path ();
+    char *path = get_gnupg_path ();
     switch (errid) {
     case WPTERR_GPG_EXEFILE:
 	_snprintf (buf, DIM (buf) - 1, 
 		    _("Could not locate GPG.exe in %s."), path);
         break;
+	
     case WPTERR_GPG_OPT_KEYRINGS:
     case WPTERR_GPG_KEYRINGS:
 	_snprintf (buf, DIM (buf) - 1,
@@ -210,11 +210,10 @@
 {
     va_list arg_ptr;
     char log[4096];
-    int id;
 
     va_start (arg_ptr, format);
     _vsnprintf (log, DIM (log)-1, format, arg_ptr);    
-    id = msg_box (NULL, log, title, style);
+    int id = msg_box (NULL, log, title, style);
     va_end (arg_ptr);
 
     return id;

Modified: trunk/Src/wptFileManager.cpp
===================================================================
--- trunk/Src/wptFileManager.cpp	2012-02-01 18:47:45 UTC (rev 406)
+++ trunk/Src/wptFileManager.cpp	2012-02-06 19:26:03 UTC (rev 407)
@@ -130,7 +130,7 @@
     int id = 0;
 
     if (file_exist_check (fname))
-	return; /* Does not exist */
+	return; /* file does not exist */
 	
     fattr = GetFileAttributes (fname);
     if ((fattr & FILE_ATTRIBUTE_READONLY) && force)

Modified: trunk/Src/wptGPG.cpp
===================================================================
--- trunk/Src/wptGPG.cpp	2012-02-01 18:47:45 UTC (rev 406)
+++ trunk/Src/wptGPG.cpp	2012-02-06 19:26:03 UTC (rev 407)
@@ -950,10 +950,9 @@
 void
 gnupg_backup_options (void)
 {
-    char *cfgfile;
     char bak[MAX_PATH+32];
 
-    cfgfile = get_gnupg_cfgfile ();
+    char *cfgfile = get_gnupg_cfgfile ();
     if (!cfgfile)
 	return;
     _snprintf (bak, DIM (bak)-1, "%s.bak", cfgfile);

Modified: trunk/Src/wptNLS.cpp
===================================================================
--- trunk/Src/wptNLS.cpp	2012-02-01 18:47:45 UTC (rev 406)
+++ trunk/Src/wptNLS.cpp	2012-02-06 19:26:03 UTC (rev 407)
@@ -149,7 +149,7 @@
 
     fp = fopen (filename, "rb");
     if (!fp)
-       return NULL;
+	return NULL;
     /* we must know about the size of the file */
     if (fstat (fileno(fp), &st) ||
 	(size = (size_t)st.st_size) != (size_t)st.st_size ||
@@ -248,12 +248,12 @@
     
     char *p = strrchr (file, '.');
     if (p == NULL) {
-	p = new char[strlen(file)+strlen(lang)+2+1];
+	p = new char[strlen (file) + strlen (lang) + 8 + 1];
 	sprintf (p, "%s.%s", file, lang);
 	return p;
     }
     char *name = substr (file, 0, p - file);
-    char *ext = substr (file, p - file + 1, strlen(file));
+    char *ext = substr (file, p - file + 1, strlen (file));
     p = get_module_dir (buf, MAX_PATH);
     if (!p)
 	BUG (NULL);
@@ -272,10 +272,10 @@
 {
     if (the_domain == NULL)
 	return;
-    free (the_domain->data);
-    free (the_domain->mapped);
-    free (the_domain->file_name);
-    free (the_domain);
+    safe_free(the_domain->data);
+    safe_free(the_domain->mapped);
+    safe_free(the_domain->file_name);
+    safe_free(the_domain);
     the_domain = NULL;
 }
 



More information about the Winpt-commits mailing list