[Winpt-commits] r304 - trunk/Src

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Mar 21 11:59:32 CET 2007


Author: twoaday
Date: 2007-03-21 11:59:31 +0100 (Wed, 21 Mar 2007)
New Revision: 304

Modified:
   trunk/Src/wptGPG.cpp
   trunk/Src/wptGPGMEWrapper.cpp
   trunk/Src/wptKeyEdit.cpp
   trunk/Src/wptKeyEditOwnertrustDlg.cpp
   trunk/Src/wptKeyManager.cpp
   trunk/Src/wptKeyRevokersDlg.cpp
   trunk/Src/wptKeyTrustPathDlg.cpp
   trunk/Src/wptKeysigDlg.cpp
   trunk/Src/wptListView.cpp
   trunk/Src/wptPassphraseCB.cpp
   trunk/Src/wptRegistry.cpp
   trunk/Src/wptSigTreeDlg.cpp
   trunk/Src/wptVerifyList.cpp
Log:


Modified: trunk/Src/wptGPG.cpp
===================================================================
--- trunk/Src/wptGPG.cpp	2007-03-21 10:48:02 UTC (rev 303)
+++ trunk/Src/wptGPG.cpp	2007-03-21 10:59:31 UTC (rev 304)
@@ -1,5 +1,5 @@
 /* wptGPG.cpp - GnuPG configuration
- *    	Copyright (C) 2001-2006 Timo Schulz
+ *    	Copyright (C) 2001-2007 Timo Schulz
  *
  * This file is part of WinPT.
  *
@@ -12,10 +12,6 @@
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License 
- * along with WinPT; if not, write to the Free Software Foundation, 
- * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
  */
 #ifdef HAVE_CONFIG_H
 #include <config.h>

Modified: trunk/Src/wptGPGMEWrapper.cpp
===================================================================
--- trunk/Src/wptGPGMEWrapper.cpp	2007-03-21 10:48:02 UTC (rev 303)
+++ trunk/Src/wptGPGMEWrapper.cpp	2007-03-21 10:59:31 UTC (rev 304)
@@ -1,5 +1,5 @@
 /* wptGPGMEWrapper.cpp - Object oriented wrapper for GPGME
- *	Copyright (C) 2006 Timo Schulz
+ *	Copyright (C) 2006, 2007 Timo Schulz
  *
  * This file is part of WinPT.
  *

Modified: trunk/Src/wptKeyEdit.cpp
===================================================================
--- trunk/Src/wptKeyEdit.cpp	2007-03-21 10:48:02 UTC (rev 303)
+++ trunk/Src/wptKeyEdit.cpp	2007-03-21 10:59:31 UTC (rev 304)
@@ -282,7 +282,7 @@
 	goto leave;
     
     gpgme_data_rewind (out);
-    while (gpg_data_readline (out, buf, sizeof (buf)-1) > 0)
+    while (gpg_data_readline (out, buf, DIM (buf)-1) > 0)
 	rev_key_colon_handler (&rev, buf);
     *r_rev = rev;
 
@@ -320,7 +320,7 @@
 	goto leave;
     
     gpgme_data_rewind (out);
-    while (gpg_data_readline (out, buf, sizeof (buf) -1) > 0)
+    while (gpg_data_readline (out, buf, DIM (buf) -1) > 0)
 	uid_inf_colon_handler (&inf, buf);
 
     *r_uinf = inf;

Modified: trunk/Src/wptKeyEditOwnertrustDlg.cpp
===================================================================
--- trunk/Src/wptKeyEditOwnertrustDlg.cpp	2007-03-21 10:48:02 UTC (rev 303)
+++ trunk/Src/wptKeyEditOwnertrustDlg.cpp	2007-03-21 10:59:31 UTC (rev 304)
@@ -43,7 +43,7 @@
     static winpt_key_t k;
     gpgme_error_t err;
     gpgme_key_t key=NULL;
-    GpgKeyEdit *ek;
+    GpgKeyEdit ek;
     HWND lb;
     int index, id = 0;
     
@@ -91,9 +91,8 @@
                     return TRUE;
             }
 	    k->callback.new_val = index;
-	    ek = new GpgKeyEdit (k->keyid);
-	    err = ek->setTrust ((gpgme_validity_t)index);
-	    delete ek;
+	    ek.setKeyID (k->keyid);
+	    err = ek.setTrust ((gpgme_validity_t)index);
             if (err)
                 msg_box (dlg, gpgme_strerror (err), _("Ownertrust"), MB_ERR);
 	    else

Modified: trunk/Src/wptKeyManager.cpp
===================================================================
--- trunk/Src/wptKeyManager.cpp	2007-03-21 10:48:02 UTC (rev 303)
+++ trunk/Src/wptKeyManager.cpp	2007-03-21 10:59:31 UTC (rev 304)
@@ -1,5 +1,5 @@
 /* wptKeyManager.cpp - Handy functions for the Key Manager dialog
- *	Copyright (C) 2001-2006 Timo Schulz
+ *	Copyright (C) 2001-2007 Timo Schulz
  *	Copyright (C) 2005 g10 Code GmbH
  *
  * This file is part of WinPT.
@@ -218,19 +218,16 @@
 {
     gpgme_error_t err;
     gpgme_key_t key;
-    GpgKeyEdit *ke;
+    GpgKeyEdit ke;
 
     key = km_get_key_ptr (lv, pos, NULL);
-    ke = new GpgKeyEdit (key->subkeys->keyid);
-    if (!ke)
-	BUG (NULL);
+    ke.setKeyID (key->subkeys->keyid);
 
-    err = enable? ke->enable () : ke->disable ();
+    err = enable? ke.enable () : ke.disable ();
     if (!err)
 	show_msg (dlg, 1500, _("Key status changed."));
     else
 	msg_box (dlg, gpgme_strerror (err), _("Key Manager"), MB_ERR);
-    delete ke;
     return err? WPTERR_GENERAL : 0;
 }
 
@@ -927,20 +924,17 @@
 {
     gpgme_error_t err;
     gpgme_key_t key;
-    GpgKeyEdit *ke;
+    GpgKeyEdit ke;
 
     key = km_get_key_ptr (lv, pos, NULL);
-    ke = new GpgKeyEdit (key->subkeys->keyid);
-    if (!ke)
-	BUG (0);
+    ke.setKeyID (key->subkeys->keyid);
 
-    err = ke->setTrust (GPGME_VALIDITY_ULTIMATE);
+    err = ke.setTrust (GPGME_VALIDITY_ULTIMATE);
     if (err)
 	msg_box (dlg, gpgme_strerror (err), _("Key Manager"), MB_ERR);
     else
 	show_msg (dlg, 1500, _("GnuPG Status: Finished"));
 
-    delete ke;
     return (int)err;
 }
 

Modified: trunk/Src/wptKeyRevokersDlg.cpp
===================================================================
--- trunk/Src/wptKeyRevokersDlg.cpp	2007-03-21 10:48:02 UTC (rev 303)
+++ trunk/Src/wptKeyRevokersDlg.cpp	2007-03-21 10:59:31 UTC (rev 304)
@@ -1,5 +1,5 @@
 /* wptKeyRevokersDlg.cpp - Designated Revoker Keys
- *	Copyright (C) 2002, 2003, 2005 Timo Schulz
+ *	Copyright (C) 2002, 2003, 2005, 2007 Timo Schulz
  *	Copyright (C) 2005 g10 Code GmbH
  *
  * This file is part of WinPT.
@@ -13,10 +13,6 @@
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with WinPT; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
  */
 #ifdef HAVE_CONFIG_H
 #include <config.h>
@@ -78,17 +74,14 @@
 {
     gpgme_error_t err;
     gpg_desig_rev_t rev;
-    GpgKeyEdit *ke;
+    GpgKeyEdit ke;
 
     if (!reload && key->ext->rev) {
 	*r_rev = key->ext->rev;
 	return 0;
     }
-    ke = new GpgKeyEdit (key->keyid);
-    if (!ke)
-	BUG (NULL);
-    err = ke->getDesignatedRevoker (&rev);
-    delete ke;
+    ke.setKeyID (key->keyid);
+    err = ke.getDesignatedRevoker (&rev);
     if (err) {
 	gpg_desig_rev_release (rev);
 	return err;
@@ -129,7 +122,7 @@
 	    uid = _("user ID not found");
 	else
 	    uid = revkey.ext->uids->name;
-	_snprintf (keyid, sizeof (keyid)-1, "0x%s", kid);
+	_snprintf (keyid, DIM (keyid)-1, "0x%s", kid);
 	listview_add_item2 (lv, "", revkey.ext);
 	alg = get_key_pubalgo (r->pubkey_algo);
 	listview_add_sub_item (lv, 0, REV_COL_ALGO, alg);

Modified: trunk/Src/wptKeyTrustPathDlg.cpp
===================================================================
--- trunk/Src/wptKeyTrustPathDlg.cpp	2007-03-21 10:48:02 UTC (rev 303)
+++ trunk/Src/wptKeyTrustPathDlg.cpp	2007-03-21 10:59:31 UTC (rev 304)
@@ -84,12 +84,13 @@
     HTREEITEM node;
     
     if( tp->type == 0 ) /* root */
-        _snprintf( info, sizeof info-1, "%s", tp->uid );
+        _snprintf (info, DIM (info)-1, "%s", tp->uid );
     else if( tp->type == 1 )/* key */
-        _snprintf(info, sizeof info -1, "0x%s (otrust=%s, validity=%s)",
+        _snprintf (info, DIM (info) -1, "0x%s (otrust=%s, validity=%s)",
                   tp->keyid, tp->otrust, tp->valid );
     else if( tp->type == 2 ) /* userid */
-        _snprintf( info, sizeof info -1, "%s (validity=%s)", tp->uid, tp->valid );    
+        _snprintf (info, DI M(info) -1, "%s (validity=%s)", 
+		   tp->uid, tp->valid );    
     node = treeview_insert_item( tree, parent, info );
     return node;
 } /* treeview_create_child_item */

Modified: trunk/Src/wptKeysigDlg.cpp
===================================================================
--- trunk/Src/wptKeysigDlg.cpp	2007-03-21 10:48:02 UTC (rev 303)
+++ trunk/Src/wptKeysigDlg.cpp	2007-03-21 10:59:31 UTC (rev 304)
@@ -66,7 +66,7 @@
 do_delsig (HWND dlg, listview_ctrl_t lv, winpt_key_t key)
 {
     gpgme_error_t err;
-    GpgKeyEdit *ke;
+    GpgKeyEdit ke;
     char keyid[32];
     int pos, npos, id, is_selfsig=0;
     int signo=0, uidno=0;
@@ -98,15 +98,12 @@
     if (id == IDNO)
 	return 0;
 
-    ke = new GpgKeyEdit (key->keyid);
-    if (!ke)
-	BUG (NULL);    
-    err = ke->delUseridSignature (uidno, signo);
+    ke.setKeyID (key->keyid);
+    err = ke.delUseridSignature (uidno, signo);
     if (err)
 	msg_box (dlg, gpgme_strerror (err), _("Key Manager"), MB_ERR);
     else
 	listview_del_item (lv, pos);
-    delete ke;
     if (!err)
 	key->update = 1;
     return err? -1 : 0;

Modified: trunk/Src/wptListView.cpp
===================================================================
--- trunk/Src/wptListView.cpp	2007-03-21 10:48:02 UTC (rev 303)
+++ trunk/Src/wptListView.cpp	2007-03-21 10:59:31 UTC (rev 304)
@@ -1,5 +1,5 @@
 /* wptListView.cpp - Dynamic list view control
- *	Copyright (C) 2000-2006 Timo Schulz
+ *	Copyright (C) 2000-2007 Timo Schulz
  *	Copyright (C) 2004 Andreas Jobs
  *
  * This file is part of WinPT.
@@ -13,12 +13,7 @@
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License 
- * along with WinPT; if not, write to the Free Software Foundation, 
- * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
  */
-
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
@@ -389,7 +384,7 @@
     /* We assume the first column contains text. */
     n = listview_count_items (ctx, 0);
     for (i = 0; i < n; i++) {
-	listview_get_item_text (ctx, i, 0, buf, sizeof (buf)-1);
+	listview_get_item_text (ctx, i, 0, buf, DIM (buf)-1);
 	if (stristr (buf, str)) {
 	    fnd = 1;
 	    break;

Modified: trunk/Src/wptPassphraseCB.cpp
===================================================================
--- trunk/Src/wptPassphraseCB.cpp	2007-03-21 10:48:02 UTC (rev 303)
+++ trunk/Src/wptPassphraseCB.cpp	2007-03-21 10:59:31 UTC (rev 304)
@@ -377,7 +377,7 @@
 	    const char *s=passphrase_info;
 	    while (s && *s && *s != 'D')
 		s++;
-	    _snprintf (c->info, sizeof (c->info)-1,
+	    _snprintf (c->info, DIM (c->info)-1,
 		       _("Please enter the PIN to unlock your secret card key\n"
 		         "Card: %s"), extract_serial_no (s));
 	    c->is_card = 1;

Modified: trunk/Src/wptRegistry.cpp
===================================================================
--- trunk/Src/wptRegistry.cpp	2007-03-21 10:48:02 UTC (rev 303)
+++ trunk/Src/wptRegistry.cpp	2007-03-21 10:59:31 UTC (rev 304)
@@ -171,11 +171,11 @@
     }
     
     memset( &deficon, 0, sizeof deficon );
-    _snprintf( deficon, sizeof deficon - 1, "%s\\DefaultIcon", extname );
+    _snprintf( deficon, DIM (deficon) - 1, "%s\\DefaultIcon", extname );
     memset( &defexec, 0, sizeof defexec );
-    _snprintf( defexec, sizeof defexec - 1, "%s\\shell\\open\\command", extname );	
+    _snprintf( defexec, DIM (defexec) - 1, "%s\\shell\\open\\command", extname );	
     memset( &p_exefile, 0, sizeof p_exefile );
-    _snprintf( p_exefile, sizeof p_exefile - 1, "%s %%1", exefile );
+    _snprintf( p_exefile, DIM (p_exefile) - 1, "%s %%1", exefile );
     
     rc = RegCreateKey( HKEY_CLASSES_ROOT, deficon, &reg );
     if( rc_ok( rc ) )
@@ -207,9 +207,9 @@
     char icon[MAX_PATH+1] = {0};
     char prog[MAX_PATH+1] = {0};
 
-    if (!GetModuleFileName (glob_hinst, prog, sizeof (prog)-1))
+    if (!GetModuleFileName (glob_hinst, prog, DIM (prog)-1))
 	return WPTERR_REGISTRY;
-    _snprintf (icon, sizeof (icon) -1, "%s,%d", prog, gfile->nicon);
+    _snprintf (icon, DIM (icon) -1, "%s,%d", prog, gfile->nicon);
     return create_file_type (prog, gfile->ext, gfile->descr, icon);
 }
 

Modified: trunk/Src/wptSigTreeDlg.cpp
===================================================================
--- trunk/Src/wptSigTreeDlg.cpp	2007-03-21 10:48:02 UTC (rev 303)
+++ trunk/Src/wptSigTreeDlg.cpp	2007-03-21 10:59:31 UTC (rev 304)
@@ -160,7 +160,7 @@
 	tree = GetDlgItem (dlg, IDC_VKEYSIG_TREE);
 	hil = treeview_set_image_list (tree, ico, 2);
 	sigtree_load (tree, key);
-	_snprintf (inf, sizeof (inf)-1, 
+	_snprintf (inf, DIM (inf)-1, 
 		   _("Signature Tree for \"%s\" (0x%s)"), 
 		   key->ext->uids->name, key->ctx->subkeys->keyid+8);
 	SetDlgItemText (dlg, IDC_VKEYSIG_EDIT, _("Edit..."));

Modified: trunk/Src/wptVerifyList.cpp
===================================================================
--- trunk/Src/wptVerifyList.cpp	2007-03-21 10:48:02 UTC (rev 303)
+++ trunk/Src/wptVerifyList.cpp	2007-03-21 10:59:31 UTC (rev 304)
@@ -1,5 +1,5 @@
 /* wptVerifyList.cpp - Listview for verifying signatures
- *	Copyright (C) 2001, 2002, 2003, 2005, 2006 Timo Schulz
+ *	Copyright (C) 2001, 2002, 2003, 2005, 2006, 2007 Timo Schulz
  *	Copyright (C) 2005 g10 Code GmbH
  *
  * This file is part of WinPT.



More information about the Winpt-commits mailing list