[Winpt-commits] r351 - trunk/Src

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Dec 1 21:10:25 CET 2011


Author: twoaday
Date: 2011-12-01 21:10:25 +0100 (Thu, 01 Dec 2011)
New Revision: 351

Modified:
   trunk/Src/wptGPGME.cpp
   trunk/Src/wptGPGMEData.cpp
   trunk/Src/wptHTTP.cpp
   trunk/Src/wptListView.cpp
Log:


Modified: trunk/Src/wptGPGME.cpp
===================================================================
--- trunk/Src/wptGPGME.cpp	2011-12-01 19:58:09 UTC (rev 350)
+++ trunk/Src/wptGPGME.cpp	2011-12-01 20:10:25 UTC (rev 351)
@@ -165,15 +165,15 @@
 get_key_from_cache (const char *keyid, int secret, gpgme_key_t *r_key, 
 		    struct keycache_s **c)
 {
-    gpg_keycache_t cache;
     gpgme_error_t err;
-    int mode = secret? KEYCACHE_PRV : KEYCACHE_PUB;
-
+    
     if (!keyid)
 	return gpg_error (GPG_ERR_INV_VALUE);
     if (r_key)
 	*r_key = NULL;
-    cache = keycache_get_ctx (mode);
+    
+    int mode = secret? KEYCACHE_PRV : KEYCACHE_PUB;
+    gpg_keycache_t cache = keycache_get_ctx (mode);
     if (!c)
 	err = gpg_keycache_find_key (cache, keyid, 0, r_key);
     else

Modified: trunk/Src/wptGPGMEData.cpp
===================================================================
--- trunk/Src/wptGPGMEData.cpp	2011-12-01 19:58:09 UTC (rev 350)
+++ trunk/Src/wptGPGMEData.cpp	2011-12-01 20:10:25 UTC (rev 351)
@@ -47,7 +47,7 @@
     size_t n;
 
     inp[inlen] = 0;
-    if (inp[inlen-2] == '\r' && inp[inlen-1] == '\n')
+    if (inlen > 2 && inp[inlen-2] == '\r' && inp[inlen-1] == '\n')
 	end_is_le = 1;
     out = (char *)calloc (1, 4*inlen/3+2+1);
     if (!out)
@@ -156,7 +156,7 @@
         "Comment:",
 	"Charset:",
         "Hash:",
-	"MessageID",
+	"MessageID:",
 	NULL
     };
     int i;
@@ -217,19 +217,17 @@
 gpgme_error_t
 gpg_data_release_and_set_file (gpgme_data_t dh, const char *fname)
 {
-    char *p = NULL;
-    FILE *fp;
     size_t n;
     
-    fp = fopen (fname, "wb");
+    FILE *fp = fopen (fname, "wb");
     if (fp == NULL)
 	return gpg_error (GPG_ERR_ENOENT);
     
-    p = gpgme_data_release_and_get_mem (dh, &n);
-    if (p) {
+    char *p = gpgme_data_release_and_get_mem (dh, &n);
+    if (p != NULL) {
         fwrite (p, 1, n, fp);
         fflush (fp);
-	memset (p, 0xFF, n);
+	wipememory (p, n);
 	gpgme_free (p);
     }
     fclose (fp);

Modified: trunk/Src/wptHTTP.cpp
===================================================================
--- trunk/Src/wptHTTP.cpp	2011-12-01 19:58:09 UTC (rev 350)
+++ trunk/Src/wptHTTP.cpp	2011-12-01 20:10:25 UTC (rev 351)
@@ -198,8 +198,7 @@
     
     *val = NULL;
     for (n = root; n; n = n->next) {
-	if (strlen (n->d) >= strlen (name) &&
-	    strstr (n->d, name)) {
+	if (strlen (n->d) >= strlen (name) && strstr (n->d, name)) {
 	    p = strchr (n->d, ':');
             *val = p? n->d + (p - n->d + 1 + 1) : NULL;
 	    return true;
@@ -267,16 +266,15 @@
 int
 NetHTTP::isDataAvailable (int _fd)
 {
-    struct timeval tv;
+    struct timeval tv;    
     fd_set inp;
-    int n;
-
+    
     FD_ZERO (&inp);
     FD_SET (_fd, &inp);
     tv.tv_sec = 1;
     tv.tv_usec = 0;
 
-    n = select (_fd+1, &inp, NULL, NULL, &tv);
+    int n = select (_fd+1, &inp, NULL, NULL, &tv);
     if (n && FD_ISSET (_fd, &inp))
         return n;
     return 0;
@@ -288,7 +286,7 @@
    Return value: 0 on success. */
 int
 NetHTTP::readLine (char *buf, unsigned int nbuf,
-                 int nonblock, int *nn, int *eof)
+		   int nonblock, int *nn, int *eof)
 {
     char c;
     int n, i;

Modified: trunk/Src/wptListView.cpp
===================================================================
--- trunk/Src/wptListView.cpp	2011-12-01 19:58:09 UTC (rev 350)
+++ trunk/Src/wptListView.cpp	2011-12-01 20:10:25 UTC (rev 351)
@@ -298,7 +298,7 @@
 int
 listview_get_curr_pos (listview_ctrl_t ctx)
 {	
-    return ListView_GetNextItem( ctx->ctrl, -1, LVNI_SELECTED );
+    return ListView_GetNextItem (ctx->ctrl, -1, LVNI_SELECTED);
 }
 
 



More information about the Winpt-commits mailing list