[Winpt-commits] r137 - in trunk: . Include Po Src
scm-commit at wald.intevation.org
scm-commit at wald.intevation.org
Mon Jan 9 15:01:53 CET 2006
Author: twoaday
Date: 2006-01-09 15:01:51 +0100 (Mon, 09 Jan 2006)
New Revision: 137
Modified:
trunk/Include/ChangeLog
trunk/Include/wptGPG.h
trunk/Include/wptVersion.h
trunk/Include/wptW32API.h
trunk/Po/POTFILES.in
trunk/Src/ChangeLog
trunk/Src/WinPT.cpp
trunk/Src/wptGPG.cpp
trunk/Src/wptMainProc.cpp
trunk/Src/wptW32API.cpp
trunk/configure.ac
Log:
2006-01-09 Timo Schulz <ts at g10code.com>
* WinPT.cpp (load_gettext): Remove file locking.
(WinMain): Use pre-defined autoconf constants.
* wptW32API.cpp (init_file_lock, release_file_lock): Deleted.
* wptGPG.cpp (check_gnupg_engine): Add param @need_gpg_ver.
Change all callers.
Remove all static version constants. The only place for
constants is now configure.c (config.h).
Modified: trunk/Include/ChangeLog
===================================================================
--- trunk/Include/ChangeLog 2006-01-09 10:03:13 UTC (rev 136)
+++ trunk/Include/ChangeLog 2006-01-09 14:01:51 UTC (rev 137)
@@ -1,3 +1,7 @@
+2006-01-09 Timo Schulz <ts at g10code.com>
+
+ * wptW32API.h (init_file_lock, release_file_lock): Removed.
+
2006-01-07 Timo Schulz <ts at g10code.com>
* wptKeyserver.h (hkp_recv_key2): Removed.
Modified: trunk/Include/wptGPG.h
===================================================================
--- trunk/Include/wptGPG.h 2006-01-09 10:03:13 UTC (rev 136)
+++ trunk/Include/wptGPG.h 2006-01-09 14:01:51 UTC (rev 137)
@@ -153,7 +153,8 @@
void gnupg_backup_keyrings (void);
void gnupg_display_error (void);
int gnupg_copy_keyrings (void);
-int check_gnupg_engine (int *r_major, int *r_minor, int *r_patch);
+int check_gnupg_engine (const char *need_gpg_ver,
+ int *r_major, int *r_minor, int *r_patch);
/*-- wptGPGME.cpp --*/
const char * get_signature_status( gpgme_sigsum_t sigstat );
Modified: trunk/Include/wptVersion.h
===================================================================
--- trunk/Include/wptVersion.h 2006-01-09 10:03:13 UTC (rev 136)
+++ trunk/Include/wptVersion.h 2006-01-09 14:01:51 UTC (rev 137)
@@ -42,7 +42,6 @@
extern int scard_support; /* Smartcard support available? */
extern int gpg_read_only; /* GPG read-only keyring access? */
-extern LOCK mo_file;
extern char gpgver[]; /* Contains gpg version (3 bytes) */
/* Privacy Tray Dynamic */
Modified: trunk/Include/wptW32API.h
===================================================================
--- trunk/Include/wptW32API.h 2006-01-09 10:03:13 UTC (rev 136)
+++ trunk/Include/wptW32API.h 2006-01-09 14:01:51 UTC (rev 137)
@@ -29,13 +29,6 @@
HWND focus;
};
-struct LOCK {
- char *file;
- int size;
- HANDLE fh;
-};
-
-
/*-- wptMAPI.cpp --*/
int mapi_init (void);
int mapi_send_pubkey (const char * keyid, char * keyfile);
@@ -44,8 +37,6 @@
/*-- wptW32API.cpp --*/
char* make_filename (const char *path, const char *file, const char *ext);
-int init_file_lock (LOCK *ctx, const char *file);
-void release_file_lock (LOCK *ctx);
int file_exist_check (const char *fname);
int dir_exist_check (const char *dir);
DWORD get_file_size (const char *fname);
Modified: trunk/Po/POTFILES.in
===================================================================
--- trunk/Po/POTFILES.in 2006-01-09 10:03:13 UTC (rev 136)
+++ trunk/Po/POTFILES.in 2006-01-09 14:01:51 UTC (rev 137)
@@ -82,3 +82,4 @@
Src/wptUtil.cpp
Src/wptVerifyList.cpp
Src/wptW32API.cpp
+Src/wptGPGMEWrapper.cpp
Modified: trunk/Src/ChangeLog
===================================================================
--- trunk/Src/ChangeLog 2006-01-09 10:03:13 UTC (rev 136)
+++ trunk/Src/ChangeLog 2006-01-09 14:01:51 UTC (rev 137)
@@ -1,3 +1,11 @@
+2006-01-09 Timo Schulz <ts at g10code.com>
+
+ * WinPT.cpp (load_gettext): Remove file locking.
+ (WinMain): Use pre-defined autoconf constants.
+ * wptW32API.cpp (init_file_lock, release_file_lock): Deleted.
+ * wptGPG.cpp (check_gnupg_engine): Add param @need_gpg_ver.
+ Change all callers.
+
2006-01-07 Timo Schulz <ts at g10code.com>
* wptKeyManager.cpp (km_refresh_from_keyserver): Summarize
Modified: trunk/Src/WinPT.cpp
===================================================================
--- trunk/Src/WinPT.cpp 2006-01-09 10:03:13 UTC (rev 136)
+++ trunk/Src/WinPT.cpp 2006-01-09 14:01:51 UTC (rev 137)
@@ -40,14 +40,9 @@
#include "wptCardEdit.h"
#include "wptCrypto.h"
-#define MIN_GPG_VER "1.4.2" /* Minimal GPG version. */
-#define MIN_GPGME_VER NEED_GPGME_VERSION /* Minimal GPGME version. */
-
-
HINSTANCE glob_hinst; /* global instance for the dialogs */
HWND glob_hwnd; /* global window handle for the dialogs */
HWND activ_hwnd;
-LOCK mo_file;
int scard_support = 0;
int debug = 0;
int mobile = 0;
@@ -96,20 +91,11 @@
load_gettext (int prev_inst)
{
char *nls = NULL;
- char *file = NULL;
nls = get_gettext_lang ();
- if (nls) {
+ if (nls != NULL) {
set_gettext_file ("winpt", nls);
- file = make_filename (nls, "winpt", "mo");
- if (!file_exist_check (nls) && init_file_lock (&mo_file, file)) {
- if (!prev_inst)
- msg_box (NULL, _("Could not initizalize file lock.\n"
- "Native Language Support"),
- _("WinPT Error"), MB_ERR);
- }
free_if_alloc (nls);
- free_if_alloc (file);
}
}
@@ -215,10 +201,10 @@
static bool
check_crypto_engine (void)
{
- int ma=1, mi=4, pa=2; /* GPG 1.4.2 */
+ int ma=0, mi=0, pa=0;
int rc;
- rc = check_gnupg_engine (&ma, &mi, &pa);
+ rc = check_gnupg_engine (NEED_GPG_VERSION, &ma, &mi, &pa);
if (rc == -1) {
msg_box (NULL, _("Could not read GnuPG version."),
_("WinPT Error"), MB_ERR);
@@ -227,12 +213,12 @@
else if (rc) {
log_box (_("WinPT Error"), MB_ERR,
_("Sorry, you need a newer GPG version.\n"
- "GPG version %d.%d.%d required GPG version "MIN_GPG_VER),
+ "GPG version %d.%d.%d required GPG version "NEED_GPG_VERSION),
ma, mi, pa);
return false;
}
/* We enable smartcard support for GPG: >= 2 or >= 1.4.3 */
- if (ma > 1 || pa >= 3)
+ if (ma > 1 || pa >= 3)
scard_support = 1;
gpgver[0] = ma;
@@ -361,9 +347,9 @@
return 0;
}
- s = gpgme_check_version (MIN_GPGME_VER);
+ s = gpgme_check_version (NEED_GPGME_VERSION);
if (!s || !*s) {
- msg_box (NULL, _("A newer GPGME version is needed; at least "MIN_GPGME_VER),
+ msg_box (NULL, _("A newer GPGME version is needed; at least "NEED_GPGME_VERSION),
_("WinPT Error"), MB_ERR);
return 0;
}
Modified: trunk/Src/wptGPG.cpp
===================================================================
--- trunk/Src/wptGPG.cpp 2006-01-09 10:03:13 UTC (rev 136)
+++ trunk/Src/wptGPG.cpp 2006-01-09 14:01:51 UTC (rev 137)
@@ -325,7 +325,7 @@
static int
-parse_version_nr (const char * buf, int *major, int *minor, int *patch)
+parse_version_nr (const char *buf, int *major, int *minor, int *patch)
{
char tmp[8];
int i;
@@ -353,14 +353,22 @@
version given in @r_major. at r_minor.@r_patch. On success these
variables contain the GPG version which is installed. */
int
-check_gnupg_engine (int *r_major, int *r_minor, int *r_patch)
+check_gnupg_engine (const char *need_gpg_ver,
+ int *r_major, int *r_minor, int *r_patch)
{
gpgme_ctx_t ctx;
gpgme_engine_info_t inf;
char *eng = NULL;
int major=0, minor=0, patch=0;
+ int need_major = 0, need_minor = 0, need_patch = 0;
int rc = 1;
-
+
+ /* Convert the needed GPG version to the integer format. */
+ rc = parse_version_nr (need_gpg_ver,
+ &need_major, &need_minor, &need_patch);
+ if (rc)
+ return rc;
+
gpgme_new (&ctx);
inf = gpgme_ctx_get_engine_info (ctx);
if (!inf) {
@@ -380,14 +388,15 @@
return rc;
}
- if (major > *r_major)
+ if (major > need_major)
rc = 0;
- else if (major == *r_major && minor > *r_minor)
+ else if (major == need_major && minor > need_minor)
rc = 0;
- else if (major == *r_major && minor == *r_minor &&
- patch >= *r_patch)
+ else if (major == need_major && minor == need_minor &&
+ patch >= need_patch)
rc = 0;
+ /* Return the current GPG version. */
*r_major = major;
*r_minor = minor;
*r_patch = patch;
Modified: trunk/Src/wptMainProc.cpp
===================================================================
--- trunk/Src/wptMainProc.cpp 2006-01-09 10:03:13 UTC (rev 136)
+++ trunk/Src/wptMainProc.cpp 2006-01-09 14:01:51 UTC (rev 137)
@@ -361,7 +361,6 @@
free_reg_prefs ();
free_gnupg_table ();
hotkeys_unregister (hwnd);
- release_file_lock (&mo_file);
PTD_delete ();
agent_flush_cache ();
if (!gpg_clip_istext_avail (&has_data) && has_data) {
@@ -375,7 +374,6 @@
wipe_contents = 0;
}
debug_end ();
- /*cleanup_tmp_files ();*/
Shell_NotifyIcon (NIM_DELETE, &NID);
PostQuitMessage (0);
ExitProcess (0);
Modified: trunk/Src/wptW32API.cpp
===================================================================
--- trunk/Src/wptW32API.cpp 2006-01-09 10:03:13 UTC (rev 136)
+++ trunk/Src/wptW32API.cpp 2006-01-09 14:01:51 UTC (rev 137)
@@ -354,37 +354,6 @@
}
-int
-init_file_lock( LOCK *ctx, const char *file )
-{
-
- ctx->size = get_file_size( file );
- ctx->file = m_strdup( file );
- ctx->fh = CreateFile( file, GENERIC_READ, FILE_SHARE_READ, NULL,
- OPEN_ALWAYS, 0, NULL );
- if( ctx->fh == INVALID_HANDLE_VALUE )
- return WPTERR_GENERAL;
- if( LockFile( ctx->fh, 0, 0, ctx->size, 0 ) == FALSE ) {
- CloseHandle( ctx->fh );
- ctx->fh = INVALID_HANDLE_VALUE;
- ctx->size = 0;
- free( ctx->file );
- return WPTERR_GENERAL;
- }
- return 0;
-} /* init_file_lock */
-
-
-void
-release_file_lock( LOCK *ctx )
-{
- free_if_alloc( ctx->file );
- ctx->file = NULL;
- ctx->size = 0;
- CloseHandle( ctx->fh );
-} /* release_file_lock */
-
-
/* Start a dialog with the exception that before it is checked that the
dialog is not already openened. */
int
Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac 2006-01-09 10:03:13 UTC (rev 136)
+++ trunk/configure.ac 2006-01-09 14:01:51 UTC (rev 137)
@@ -16,6 +16,7 @@
# Version number: Remember to change it immediately *after* a release.
# Add a "-cvs" prefix for non-released code.
AC_INIT(WinPT, 0.11.5-cvs, http://www.winpt.org)
+NEED_GPG_VERSION=1.4.2
NEED_GPGME_API=1
NEED_GPGME_VERSION=1.1.1
NEED_GPG_ERROR_VERSION=1.2
@@ -43,6 +44,8 @@
[Bug report address])
AC_DEFINE_UNQUOTED(NEED_GPGME_VERSION, "$NEED_GPGME_VERSION",
[Required version of GPGME])
+AC_DEFINE_UNQUOTED(NEED_GPG_VERSION, "$NEED_GPG_VERSION",
+ [Required version of GnuPG])
BUILD_TIMESTAMP=`date --iso-8601=minutes`
AC_SUBST(BUILD_TIMESTAMP)
More information about the Winpt-commits
mailing list