[Winpt-commits] r305 - trunk/PTD

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Mar 23 12:32:28 CET 2007


Author: twoaday
Date: 2007-03-23 12:32:28 +0100 (Fri, 23 Mar 2007)
New Revision: 305

Modified:
   trunk/PTD/PTD.cpp
   trunk/PTD/wptDNSKeys.cpp
   trunk/PTD/wptZIP.cpp
   trunk/PTD/wptZIP.h
Log:


Modified: trunk/PTD/PTD.cpp
===================================================================
--- trunk/PTD/PTD.cpp	2007-03-21 10:59:31 UTC (rev 304)
+++ trunk/PTD/PTD.cpp	2007-03-23 11:32:28 UTC (rev 305)
@@ -1,5 +1,5 @@
 /* PTD.cpp - Privacy Tray Dynamic
- *	Copyright (C) 2002-2006 Timo Schulz
+ *	Copyright (C) 2002-2007 Timo Schulz
  *
  * This file is part of WinPT.
  *
@@ -12,12 +12,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
@@ -55,7 +50,7 @@
 #undef ATTR_SEC
 
 static unsigned *journ_keys = 0;
-static unsigned key_idx = 0;
+static unsigned keyidx = 0;
 static unsigned nkeys = 0;
 static HHOOK journ_hook = NULL;	 /* Journaling hook  handle. */
 
@@ -131,10 +126,10 @@
     mstask_swc = FindWindowEx (rebar_w32, NULL, "MSTaskSwWClass", NULL);
     systab_c32 = FindWindowEx (mstask_swc, NULL, "SysTabControl32", NULL);
     
-    /*log_foo ("tray_proc_id=%u cbt_hook=%p shell_traywnd=%p rebar_w32=%p "
-	       "mstask_swc=%p systab_c32=%p",
-	       tray_proc_id, cbt_hook, shell_traywnd, rebar_w32, 
-               mstask_swc, systab_c32);*/
+    /*debug ("tray_proc_id=%u cbt_hook=%p shell_traywnd=%p rebar_w32=%p "
+	     "mstask_swc=%p systab_c32=%p",
+	     tray_proc_id, cbt_hook, shell_traywnd, rebar_w32, 
+             mstask_swc, systab_c32);*/
     
     return TRUE;
 }
@@ -168,8 +163,8 @@
     LPEVENTMSG em;
     
     if (code == HC_SKIP) {
-        key_idx++;
-        if (key_idx == nkeys) {
+        keyidx++;
+        if (keyidx == nkeys) {
             UnhookWindowsHookEx (journ_hook);
             journ_hook = NULL;
         }
@@ -182,12 +177,12 @@
          * paramH - specifies the scan code.				
          */
         em = (LPEVENTMSG )lparam;
-        if (journ_keys[key_idx] & 0x8000)
-            em->message = journ_keys[key_idx] & 0x4000 ? WM_SYSKEYDOWN : WM_KEYDOWN;
+        if (journ_keys[keyidx] & 0x8000)
+            em->message = journ_keys[keyidx] & 0x4000 ? WM_SYSKEYDOWN : WM_KEYDOWN;
         else 
-            em->message = journ_keys[key_idx] & 0x4000 ? WM_SYSKEYUP : WM_KEYUP;
-        em->paramL = LOBYTE( journ_keys[key_idx] )
-            | (MapVirtualKey (LOBYTE (journ_keys[key_idx]), 0) << 8);
+            em->message = journ_keys[keyidx] & 0x4000 ? WM_SYSKEYUP : WM_KEYUP;
+        em->paramL = LOBYTE( journ_keys[keyidx] )
+            | (MapVirtualKey (LOBYTE (journ_keys[keyidx]), 0) << 8);
         em->paramH = 1;
         em->time = GetTickCount ();
         return 0;
@@ -203,7 +198,7 @@
 {
     MSG msg;
     journ_keys = keys;
-    key_idx = 0;
+    keyidx = 0;
     nkeys =  n_keys;    
     
     if (journ_hook)

Modified: trunk/PTD/wptDNSKeys.cpp
===================================================================
--- trunk/PTD/wptDNSKeys.cpp	2007-03-21 10:59:31 UTC (rev 304)
+++ trunk/PTD/wptDNSKeys.cpp	2007-03-23 11:32:28 UTC (rev 305)
@@ -61,7 +61,8 @@
 	dns_failed = 1;
 	return -1;
     }
-    dns_record_free = (dns_record_list_free_fnc)GetProcAddress (dns_api, "DnsRecordListFree");
+    dns_record_free = (dns_record_list_free_fnc)
+	GetProcAddress (dns_api, "DnsRecordListFree");
     if (!dns_record_free) {
 	dns_failed = 1;
 	return -1;
@@ -74,7 +75,7 @@
 void
 dns_cleanup (void)
 {
-    if (dns_api)
+    if (dns_api != NULL)
 	FreeLibrary (dns_api);
     dns_api = NULL;
     dns_failed = 0;
@@ -144,7 +145,6 @@
 	dns_free_pka_record (pka);
 	pka = NULL;
     }
-	
     return pka;
 }
 
@@ -154,9 +154,9 @@
 extern "C" int
 dns_get_pka_record (const char *userid, pka_info_t *r_pka)
 {
-    char *addr;
     DNS_STATUS err;
     DNS_RECORD *rec;
+    char *addr;
 
     *r_pka = NULL;
     if (dns_init ())
@@ -181,10 +181,10 @@
 extern "C" void
 dns_free_pka_record (pka_info_t pka)
 {
-    if (pka->fpr)
+    if (pka->fpr != NULL)
 	free (pka->fpr);
     pka->fpr = NULL;
-    if (pka->uri)
+    if (pka->uri != NULL)
 	free (pka->uri);
     pka->uri = NULL;
     free (pka);

Modified: trunk/PTD/wptZIP.cpp
===================================================================
--- trunk/PTD/wptZIP.cpp	2007-03-21 10:59:31 UTC (rev 304)
+++ trunk/PTD/wptZIP.cpp	2007-03-23 11:32:28 UTC (rev 305)
@@ -1,5 +1,5 @@
 /* wptZIP.cpp
- *        Copyright (C) 2002-2004 Timo Schulz
+ *        Copyright (C) 2002-2007 Timo Schulz
  *
  * This file is part of WinPT.
  *
@@ -12,17 +12,12 @@
  * 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 PTD; 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
 
 #include <windows.h>
-#include <windows.h>
 #include <assert.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -191,6 +186,7 @@
 read_16 (FILE *in)
 {
     unsigned short u;
+    
     u  = fgetc (in)     ;
     u |= fgetc (in) << 8;
     return u;
@@ -230,7 +226,8 @@
 static unsigned short
 date_to_dos (time_t t)
 {
-    struct tm * tm;
+    struct tm *tm;
+    
     tm = localtime (&t);
     return tm->tm_mday | (tm->tm_mon+1)<<5 | ((tm->tm_year-80)<<9);
 }
@@ -288,7 +285,7 @@
 static int
 write_local_header (FILE *out, PK_local_hdr *hdr)
 {
-    long crc_pos = 0, curr_pos = 0;
+    long crc_pos, curr_pos;
     
     write_32 (out, hdr->magic);
     write_16 (out, hdr->ver);
@@ -403,7 +400,7 @@
     /*if (debug)
         printf ("skip extra header (%d)\n", hdr->extra_len);*/
     n = hdr->extra_len;
-    while (n--)
+    while (n-- > 0)
         fgetc (in);
     /*if (debug)
         printf ("skip compressed data (%lu)\n", hdr->c_size);*/
@@ -711,6 +708,7 @@
 is_directory (const char * fname)
 {
     struct stat statbuf;
+    
     if (stat (fname, &statbuf))
 	return 0;
     return statbuf.st_mode & S_IFDIR;
@@ -781,17 +779,14 @@
 void
 pk_list_add (struct PK_file_list **list, const char *name)
 {
-    struct PK_file_list * l;
+    struct PK_file_list *l;
 
     l = new PK_file_list;
     if (!l)
 	abort ();
     memset (l, 0, sizeof *l);	
     l->next = *list;
-    l->d = new char[strlen (name)+2];	
-    if (!l->d)    
-	abort ();	
-    strcpy (l->d, name);	
+    l->d = xstrdup (name);
     *list = l;
 }
 
@@ -804,12 +799,12 @@
 
     while (list) {
         l = list->next;
-	if (list->hdr) {
+	if (list->hdr != NULL) {
 	    pkt.pkttype = PK_SIG_LOCAL;
 	    pkt.u.local = list->hdr;
 	    free_packet (&pkt);
 	}
-	if (list->d)
+	if (list->d != NULL)
 	    delete []list->d;
         delete list;
         list = l;

Modified: trunk/PTD/wptZIP.h
===================================================================
--- trunk/PTD/wptZIP.h	2007-03-21 10:59:31 UTC (rev 304)
+++ trunk/PTD/wptZIP.h	2007-03-23 11:32:28 UTC (rev 305)
@@ -1,5 +1,5 @@
-/* wptZIP.h
- *        Copyright (C) 2002 Timo Schulz
+/* wptZIP.h - Interface for the ZIP file format
+ *        Copyright (C) 2002, 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
  */
 
 #ifndef WPT_ZIP_H



More information about the Winpt-commits mailing list