]> diplodocus.org Git - nmh/commitdiff
Change seqset_t to unsigned long to support more sequences on LP64 systems.
authorKen Hornstein <kenh@pobox.com>
Wed, 27 Mar 2013 18:22:40 +0000 (14:22 -0400)
committerKen Hornstein <kenh@pobox.com>
Wed, 27 Mar 2013 18:22:40 +0000 (14:22 -0400)
Also include necessary casts to make sequence macros worked properly.
Based on code contributed by M. Levinson.

h/mh.h
h/msh.h

diff --git a/h/mh.h b/h/mh.h
index c5246f29e0afdb4a5ae5e54f13e87af24e823297..c92543c76c27022fa70708828b36985b960bea77 100644 (file)
--- a/h/mh.h
+++ b/h/mh.h
@@ -134,14 +134,7 @@ extern struct swit anoyes[];       /* standard yes/no switches */
 /*
  * type for holding the sequence set of a message
  */
-typedef unsigned int seqset_t;
-
-/*
- * Determine the number of user defined sequences we
- * can have.  The first 5 sequence flags are for
- * internal nmh message flags.
- */
-#define        NUMATTRS  ((sizeof(seqset_t) * Nbby) - 5)
+typedef unsigned long seqset_t;
 
 /*
  * first free slot for user defined sequences
@@ -149,6 +142,13 @@ typedef unsigned int seqset_t;
  */
 #define        FFATTRSLOT  5
 
+/*
+ * Determine the number of user defined sequences we
+ * can have.  The first FFATTRSLOT sequence flags are for
+ * internal nmh message flags.
+ */
+#define        NUMATTRS  ((sizeof(seqset_t) * Nbby) - FFATTRSLOT)
+
 /*
  * internal messages attributes (sequences)
  */
@@ -254,18 +254,18 @@ struct msgs {
 #define set_deleted(mp,msgnum)    ((mp)->msgstats[(msgnum) - mp->lowoff] |= DELETED)
 
 #define in_sequence(mp,seqnum,msgnum) \
-           ((mp)->msgstats[(msgnum) - mp->lowoff] & (1 << (FFATTRSLOT + seqnum)))
+           ((mp)->msgstats[(msgnum) - mp->lowoff] & ((seqset_t)1 << (FFATTRSLOT + seqnum)))
 #define clear_sequence(mp,seqnum,msgnum) \
-           ((mp)->msgstats[(msgnum) - mp->lowoff] &= ~(1 << (FFATTRSLOT + seqnum)))
+           ((mp)->msgstats[(msgnum) - mp->lowoff] &= ~((seqset_t)1 << (FFATTRSLOT + seqnum)))
 #define add_sequence(mp,seqnum,msgnum) \
-           ((mp)->msgstats[(msgnum) - mp->lowoff] |= (1 << (FFATTRSLOT + seqnum)))
+           ((mp)->msgstats[(msgnum) - mp->lowoff] |= ((seqset_t)1 << (FFATTRSLOT + seqnum)))
 
 #define is_seq_private(mp,seqnum) \
-           ((mp)->attrstats & (1 << (FFATTRSLOT + seqnum)))
+           ((mp)->attrstats & ((seqset_t)1 << (FFATTRSLOT + seqnum)))
 #define make_seq_public(mp,seqnum) \
-           ((mp)->attrstats &= ~(1 << (FFATTRSLOT + seqnum)))
+           ((mp)->attrstats &= ~((seqset_t)1 << (FFATTRSLOT + seqnum)))
 #define make_seq_private(mp,seqnum) \
-           ((mp)->attrstats |= (1 << (FFATTRSLOT + seqnum)))
+           ((mp)->attrstats |= ((seqset_t)1 << (FFATTRSLOT + seqnum)))
 #define make_all_public(mp) \
            ((mp)->attrstats = 0)
 
diff --git a/h/msh.h b/h/msh.h
index 433be00e59f2d3d3fac99d38c1aced8b8fde932e..8111003f359ce3210bdf711b6c4a5e90cd04afdb 100644 (file)
--- a/h/msh.h
+++ b/h/msh.h
@@ -22,7 +22,7 @@ struct Cmd {
 #define        MHNCHK 0x0001   /* did nontext check           */
 #define        MHNYES 0x0002   /* .. and known to be non-text */
 
-#define CUR (1 << (FFATTRSLOT + NUMATTRS - 1))
+#define CUR ((seqset_t)1 << (FFATTRSLOT + NUMATTRS - 1))
 
 #ifdef BPOP
 # define VIRTUAL SELECT_EMPTY