[Winpt-commits] r301 - trunk/Src
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Wed Mar 21 11:25:49 CET 2007
Author: twoaday
Date: 2007-03-21 11:25:48 +0100 (Wed, 21 Mar 2007)
New Revision: 301
Modified:
trunk/Src/wptGPG.cpp
trunk/Src/wptKeyManager.cpp
Log:
Modified: trunk/Src/wptGPG.cpp
===================================================================
--- trunk/Src/wptGPG.cpp 2007-03-19 15:20:05 UTC (rev 300)
+++ trunk/Src/wptGPG.cpp 2007-03-21 10:25:48 UTC (rev 301)
@@ -837,6 +837,7 @@
case 0: api_mode = FILE_SHARE_READ; break;
case 1: api_mode = FILE_SHARE_WRITE; break;
case 2: api_mode = FILE_SHARE_WRITE|FILE_SHARE_READ; break;
+ default: api_mode = FILE_SHARE_READ; break;
}
return check_file_access (fname, api_mode);
Modified: trunk/Src/wptKeyManager.cpp
===================================================================
--- trunk/Src/wptKeyManager.cpp 2007-03-19 15:20:05 UTC (rev 300)
+++ trunk/Src/wptKeyManager.cpp 2007-03-21 10:25:48 UTC (rev 301)
@@ -263,7 +263,7 @@
{
gpgme_error_t err;
gpgme_key_t *rset;
- GPGME *ctx;
+ GPGME ctx;
char *patt=NULL;
char buf[256];
size_t n=0;
@@ -278,11 +278,8 @@
patt = gpg_keylist_to_pattern (rset, n);
- ctx = new GPGME ();
- if (!ctx)
- BUG (0);
- ctx->setArmor (true);
- err = ctx->exportToClipboard (patt);
+ ctx.setArmor (true);
+ err = ctx.exportToClipboard (patt);
if (err) {
msg_box (dlg, gpgme_strerror (err), _("Key Manager"), MB_ERR);
rc = WPTERR_GENERAL;
@@ -298,7 +295,6 @@
leave:
safe_free (rset);
safe_free (patt);
- delete ctx;
return rc;
}
@@ -341,7 +337,7 @@
int
km_file_export (HWND dlg, listview_ctrl_t lv, const char *fname)
{
- GPGME *ctx;
+ GPGME ctx;
gpgme_key_t *rset;
gpgme_error_t err;
char *patt;
@@ -355,9 +351,8 @@
}
patt = gpg_keylist_to_pattern (rset, n);
- ctx = new GPGME ();
- ctx->setArmor (true);
- err = ctx->exportToFile (patt, fname);
+ ctx.setArmor (true);
+ err = ctx.exportToFile (patt, fname);
if (err) {
msg_box (dlg, gpgme_strerror (err), _("Key Manager"), MB_ERR);
goto leave;
@@ -367,7 +362,6 @@
_("Key(s) successfully saved in '%s'."), fname);
leave:
- delete ctx;
safe_free (patt);
return (int)err;
}
@@ -400,7 +394,7 @@
{
gpgme_error_t err;
gpgme_import_result_t res;
- GPGME *gpg = NULL;
+ GPGME gpg;
fm_state_s fm_stat;
int pgptype;
int id, has_data = 0;
@@ -444,14 +438,13 @@
if (!has_data)
goto leave;
- gpg = new GPGME ();
- err = gpg->importFromClipboard ();
+ err = gpg.importFromClipboard ();
if (err) {
msg_box (dlg, gpgme_strerror (err), _("Import"), MB_ERR);
goto leave;
}
- res = gpg->importGetResult ();
+ res = gpg.importGetResult ();
print_import_status (res);
new_keys = res->considered - res->unchanged;
new_sks = res->secret_imported - res->secret_unchanged;
@@ -462,8 +455,6 @@
}
leave:
- if (gpg)
- delete gpg;
free_if_alloc (fm_stat.opaque);
if (r_newkeys)
*r_newkeys = new_keys;
@@ -527,7 +518,7 @@
{
gpgme_error_t err;
gpgme_import_result_t res;
- GPGME *gpg;
+ GPGME gpg;
fm_state_s fm_stat;
const char *name;
int no_data = 0;
@@ -553,14 +544,13 @@
return WPTERR_GENERAL;
}
- gpg = new GPGME ();
- err = gpg->importFromFile (name);
+ err = gpg.importFromFile (name);
if (err) {
msg_box (dlg, gpgme_strerror (err), _("Import"), MB_ERR);
goto leave;
}
- res = gpg->importGetResult ();
+ res = gpg.importGetResult ();
if (res->unchanged == res->considered &&
res->secret_unchanged == res->secret_imported)
no_data = 1;
@@ -579,7 +569,6 @@
}
leave:
- delete gpg;
free_if_alloc (fm_stat.opaque);
if (r_newkeys)
*r_newkeys = new_keys;
More information about the Winpt-commits
mailing list