[svn] GnuPG - r3928 - trunk/g10

svn author dshaw cvs at cvs.gnupg.org
Thu Nov 10 23:50:50 CET 2005


Author: dshaw
Date: 2005-11-10 23:50:46 +0100 (Thu, 10 Nov 2005)
New Revision: 3928

Modified:
   trunk/g10/ChangeLog
   trunk/g10/getkey.c
   trunk/g10/keyedit.c
   trunk/g10/keygen.c
   trunk/g10/packet.h
   trunk/g10/pkclist.c
Log:
* packet.h: Move some flags to a bitfield.  Change all callers.


Modified: trunk/g10/ChangeLog
===================================================================
--- trunk/g10/ChangeLog	2005-11-10 21:30:27 UTC (rev 3927)
+++ trunk/g10/ChangeLog	2005-11-10 22:50:46 UTC (rev 3928)
@@ -1,5 +1,7 @@
 2005-11-10  David Shaw  <dshaw at jabberwocky.com>
 
+	* packet.h: Move some flags to a bitfield.  Change all callers.
+
 	* options.h, import.c (parse_import_options,
 	clean_sigs_from_all_uids, import_one): Add import-minimal option.
 	Similar to export-minimal, except it works on the way in.

Modified: trunk/g10/getkey.c
===================================================================
--- trunk/g10/getkey.c	2005-11-10 21:30:27 UTC (rev 3927)
+++ trunk/g10/getkey.c	2005-11-10 22:50:46 UTC (rev 3928)
@@ -1464,16 +1464,16 @@
     }
 
     /* see whether we have the MDC feature */
-    uid->mdc_feature = 0;
+    uid->flags.mdc = 0;
     p = parse_sig_subpkt (sig->hashed, SIGSUBPKT_FEATURES, &n);
     if (p && n && (p[0] & 0x01))
-        uid->mdc_feature = 1;
+        uid->flags.mdc = 1;
 
     /* and the keyserver modify flag */
-    uid->ks_modify = 1;
+    uid->flags.ks_modify = 1;
     p = parse_sig_subpkt (sig->hashed, SIGSUBPKT_KS_FLAGS, &n);
     if (p && n && (p[0] & 0x80))
-        uid->ks_modify = 0;
+        uid->flags.ks_modify = 0;
 }
 
 static void
@@ -2170,7 +2170,7 @@
 	    && !k->pkt->pkt.user_id->attrib_data
             && k->pkt->pkt.user_id->is_primary) {
             prefs = k->pkt->pkt.user_id->prefs;
-            mdc_feature = k->pkt->pkt.user_id->mdc_feature;
+            mdc_feature = k->pkt->pkt.user_id->flags.mdc;
             break;
         }
     }    

Modified: trunk/g10/keyedit.c
===================================================================
--- trunk/g10/keyedit.c	2005-11-10 21:30:27 UTC (rev 3927)
+++ trunk/g10/keyedit.c	2005-11-10 22:50:46 UTC (rev 3928)
@@ -2350,17 +2350,17 @@
 	    }
 	    tty_printf ("%s",compress_algo_to_string(COMPRESS_ALGO_NONE));
         }
-	if(uid->mdc_feature || !uid->ks_modify)
+	if(uid->flags.mdc || !uid->flags.ks_modify)
 	  {
 	    tty_printf ("\n     ");
 	    tty_printf (_("Features: "));
 	    any=0;
-	    if(uid->mdc_feature)
+	    if(uid->flags.mdc)
 	      {
 		tty_printf ("MDC");
 		any=1;
 	      }
-	    if(!uid->ks_modify)
+	    if(!uid->flags.ks_modify)
 	      {
 		if(any)
 		  tty_printf (", ");
@@ -2393,9 +2393,9 @@
                                  prefs[i].type == PREFTYPE_ZIP ? 'Z':'?',
                                  prefs[i].value);
         }
-        if (uid->mdc_feature)
+        if (uid->flags.mdc)
             tty_printf (" [mdc]");
-        if (!uid->ks_modify)
+        if (!uid->flags.ks_modify)
             tty_printf (" [no-ks-modify]");
         tty_printf("\n");
     }
@@ -2534,9 +2534,9 @@
                             prefs[j].type == PREFTYPE_ZIP ? 'Z':'?',
                             prefs[j].value);
                   } 
-                if (uid->mdc_feature)
+                if (uid->flags.mdc)
                   printf (",mdc");
-                if (!uid->ks_modify)
+                if (!uid->flags.ks_modify)
                   printf (",no-ks-modify");
               } 
             putchar (':');

Modified: trunk/g10/keygen.c
===================================================================
--- trunk/g10/keygen.c	2005-11-10 21:30:27 UTC (rev 3927)
+++ trunk/g10/keygen.c	2005-11-10 22:50:46 UTC (rev 3928)
@@ -530,8 +530,8 @@
   uid->prefs[j].type=PREFTYPE_NONE;
   uid->prefs[j].value=0;
 
-  uid->mdc_feature=mdc_available;
-  uid->ks_modify=ks_modify;
+  uid->flags.mdc=mdc_available;
+  uid->flags.ks_modify=ks_modify;
 
   return uid;
 }

Modified: trunk/g10/packet.h
===================================================================
--- trunk/g10/packet.h	2005-11-10 21:30:27 UTC (rev 3927)
+++ trunk/g10/packet.h	2005-11-10 22:50:46 UTC (rev 3928)
@@ -183,28 +183,33 @@
   u32 len;
 };
 
-typedef struct {
-    int ref;              /* reference counter */
-    int len;		  /* length of the name */
-    struct user_attribute *attribs;
-    int numattribs;
-    byte *attrib_data;    /* if this is not NULL, the packet is an attribute */
-    unsigned long attrib_len;
-    byte *namehash;
-    int help_key_usage;
-    u32 help_key_expire;
-    int help_full_count;
-    int help_marginal_count;
-    int is_primary;       /* 2 if set via the primary flag, 1 if calculated */
-    int is_revoked;
-    int is_expired;
-    u32 expiredate;       /* expires at this date or 0 if not at all */
-    prefitem_t *prefs;    /* list of preferences (may be NULL)*/
-    int mdc_feature;
-    int ks_modify;
-    u32 created;          /* according to the self-signature */
-    byte selfsigversion;
-    char name[1];
+typedef struct
+{
+  int ref;              /* reference counter */
+  int len;	        /* length of the name */
+  struct user_attribute *attribs;
+  int numattribs;
+  byte *attrib_data;    /* if this is not NULL, the packet is an attribute */
+  unsigned long attrib_len;
+  byte *namehash;
+  int help_key_usage;
+  u32 help_key_expire;
+  int help_full_count;
+  int help_marginal_count;
+  int is_primary;       /* 2 if set via the primary flag, 1 if calculated */
+  int is_revoked;
+  int is_expired;
+  u32 expiredate;       /* expires at this date or 0 if not at all */
+  prefitem_t *prefs;    /* list of preferences (may be NULL)*/
+  u32 created;          /* according to the self-signature */
+  byte selfsigversion;
+  struct
+  {
+    /* TODO: Move more flags here */
+    unsigned mdc:1;
+    unsigned ks_modify:1;
+  } flags;
+  char name[1];
 } PKT_user_id;
 
 struct revoke_info

Modified: trunk/g10/pkclist.c
===================================================================
--- trunk/g10/pkclist.c	2005-11-10 21:30:27 UTC (rev 3927)
+++ trunk/g10/pkclist.c	2005-11-10 22:50:46 UTC (rev 3928)
@@ -1421,7 +1421,7 @@
         int mdc;
 
         if (pkr->pk->user_id) /* selected by user ID */
-            mdc = pkr->pk->user_id->mdc_feature;
+            mdc = pkr->pk->user_id->flags.mdc;
         else
             mdc = pkr->pk->mdc_feature;
         if (!mdc)




More information about the Gnupg-commits mailing list