Fix some cases where we're shifting a signed 1 left.
authorGuy Harris <guy@alum.mit.edu>
Thu, 30 Apr 2015 22:21:00 +0000 (15:21 -0700)
committerGuy Harris <guy@alum.mit.edu>
Thu, 30 Apr 2015 22:22:59 +0000 (22:22 +0000)
Shift 1U instead, to make sure it's unsigned; the result of, for
example, the result of shifting a signed value left is undefined if the
value times 2^{shift count} doesn't fit in the *signed* type of the
shifted value.  That means, in particular, that the result of shifting 1
left by {number of bits in an int - 1} is undefined.  (In *practice*,
it'll probably be -2^32, with the bit you want set, but that's not
guaranteed, and GCC 5.1 seems not to like it.)

Change-Id: I0d27565c382a04ceda9eec65f45a430ceb74cf53
Reviewed-on: https://code.wireshark.org/review/8255
Reviewed-by: Guy Harris <guy@alum.mit.edu>
epan/dissectors/packet-afp.c
epan/dissectors/packet-ceph.c
epan/dissectors/packet-fcels.c
epan/dissectors/packet-netperfmeter.c
epan/dissectors/packet-reload-framing.c
epan/dissectors/packet-rsvp.c
epan/dissectors/packet-rtps.c
epan/req_resp_hdrs.c
mkcap.c
plugins/wimaxasncp/packet-wimaxasncp.c
wiretap/k12.c

index 9b9b2cc0486858c1fbe9795169e35e28e5e7a934..2f89b82f20d9bc632fbccf9553012a20cc11f876 100644 (file)
@@ -71,21 +71,21 @@ void proto_reg_handoff_afp(void);
 
 /* from netatalk/include/afp.h */
 #define AFPTRANS_NONE          0
-#define AFPTRANS_DDP          (1 << 0)
-#define AFPTRANS_TCP          (1 << 1)
+#define AFPTRANS_DDP          (1U << 0)
+#define AFPTRANS_TCP          (1U << 1)
 #define AFPTRANS_ALL          (AFPTRANS_DDP | AFPTRANS_TCP)
 
 /* AFP Attention Codes -- 4 bits */
-#define AFPATTN_SHUTDOWN     (1 << 15)            /* shutdown/disconnect */
-#define AFPATTN_CRASH        (1 << 14)            /* server crashed */
-#define AFPATTN_MESG         (1 << 13)            /* server has message */
-#define AFPATTN_NORECONNECT  (1 << 12)            /* don't reconnect */
+#define AFPATTN_SHUTDOWN     (1U << 15)           /* shutdown/disconnect */
+#define AFPATTN_CRASH        (1U << 14)           /* server crashed */
+#define AFPATTN_MESG         (1U << 13)           /* server has message */
+#define AFPATTN_NORECONNECT  (1U << 12)           /* don't reconnect */
 /* server notification */
 #define AFPATTN_NOTIFY       (AFPATTN_MESG | AFPATTN_NORECONNECT)
 
 /* extended bitmap -- 12 bits. volchanged is only useful w/ a server
  * notification, and time is only useful for shutdown. */
-#define AFPATTN_VOLCHANGED   (1 << 0)             /* volume has changed */
+#define AFPATTN_VOLCHANGED   (1U << 0)            /* volume has changed */
 #define AFPATTN_TIME(x)      ((x) & 0xfff)        /* time in minutes */
 
 /* AFP functions */
@@ -566,18 +566,18 @@ static value_string_ext unicode_hint_vals_ext = VALUE_STRING_EXT_INIT(unicode_hi
   from Apple AFP3.0.pdf
   Table 1-2 p. 20
 */
-#define kFPVolAttributeBit             (1 << 0)
-#define kFPVolSignatureBit             (1 << 1)
-#define kFPVolCreateDateBit            (1 << 2)
-#define kFPVolModDateBit               (1 << 3)
-#define kFPVolBackupDateBit            (1 << 4)
-#define kFPVolIDBit                    (1 << 5)
-#define kFPVolBytesFreeBit             (1 << 6)
-#define kFPVolBytesTotalBit            (1 << 7)
-#define kFPVolNameBit                  (1 << 8)
-#define kFPVolExtBytesFreeBit          (1 << 9)
-#define kFPVolExtBytesTotalBit         (1 << 10)
-#define kFPVolBlockSizeBit             (1 << 11)
+#define kFPVolAttributeBit             (1U << 0)
+#define kFPVolSignatureBit             (1U << 1)
+#define kFPVolCreateDateBit            (1U << 2)
+#define kFPVolModDateBit               (1U << 3)
+#define kFPVolBackupDateBit            (1U << 4)
+#define kFPVolIDBit                    (1U << 5)
+#define kFPVolBytesFreeBit             (1U << 6)
+#define kFPVolBytesTotalBit            (1U << 7)
+#define kFPVolNameBit                  (1U << 8)
+#define kFPVolExtBytesFreeBit          (1U << 9)
+#define kFPVolExtBytesTotalBit         (1U << 10)
+#define kFPVolBlockSizeBit             (1U << 11)
 
 static int hf_afp_vol_bitmap_Attributes        = -1;
 static int hf_afp_vol_bitmap_Signature                 = -1;
@@ -755,70 +755,70 @@ static const value_string map_id_reply_type_vals[] = {
   volume attribute from Apple AFP3.0.pdf
   Table 1-3 p. 22
 */
-#define kReadOnly                              (1 << 0)
-#define kHasVolumePassword                     (1 << 1)
-#define kSupportsFileIDs                       (1 << 2)
-#define kSupportsCatSearch                     (1 << 3)
-#define kSupportsBlankAccessPrivs              (1 << 4)
-#define kSupportsUnixPrivs                     (1 << 5)
-#define kSupportsUTF8Names                     (1 << 6)
+#define kReadOnly                              (1U << 0)
+#define kHasVolumePassword                     (1U << 1)
+#define kSupportsFileIDs                       (1U << 2)
+#define kSupportsCatSearch                     (1U << 3)
+#define kSupportsBlankAccessPrivs              (1U << 4)
+#define kSupportsUnixPrivs                     (1U << 5)
+#define kSupportsUTF8Names                     (1U << 6)
 /* AFP3.1 */
-#define kNoNetworkUserIDs                      (1 << 7)
+#define kNoNetworkUserIDs                      (1U << 7)
 /* AFP3.2 */
-#define kDefaultPrivsFromParent                        (1 << 8)
-#define kNoExchangeFiles                       (1 << 9)
-#define kSupportsExtAttrs                      (1 << 10)
-#define kSupportsACLs                          (1 << 11)
+#define kDefaultPrivsFromParent                        (1U << 8)
+#define kNoExchangeFiles                       (1U << 9)
+#define kSupportsExtAttrs                      (1U << 10)
+#define kSupportsACLs                          (1U << 11)
 /* AFP3.2+ */
-#define kCaseSensitive                                 (1 << 12)
-#define kSupportsTMLockSteal                   (1 << 13)
+#define kCaseSensitive                                 (1U << 12)
+#define kSupportsTMLockSteal                   (1U << 13)
 
 /*
   directory bitmap from Apple AFP3.1.pdf
   Table 1-5 pp. 25-26
 */
-#define kFPAttributeBit                (1 << 0)
-#define kFPParentDirIDBit              (1 << 1)
-#define kFPCreateDateBit               (1 << 2)
-#define kFPModDateBit                  (1 << 3)
-#define kFPBackupDateBit               (1 << 4)
-#define kFPFinderInfoBit               (1 << 5)
-#define kFPLongNameBit                 (1 << 6)
-#define kFPShortNameBit                (1 << 7)
-#define kFPNodeIDBit                   (1 << 8)
-#define kFPOffspringCountBit           (1 << 9)
-#define kFPOwnerIDBit                  (1 << 10)
-#define kFPGroupIDBit                  (1 << 11)
-#define kFPAccessRightsBit             (1 << 12)
-#define kFPUTF8NameBit                         (1 << 13)
+#define kFPAttributeBit                (1U << 0)
+#define kFPParentDirIDBit              (1U << 1)
+#define kFPCreateDateBit               (1U << 2)
+#define kFPModDateBit                  (1U << 3)
+#define kFPBackupDateBit               (1U << 4)
+#define kFPFinderInfoBit               (1U << 5)
+#define kFPLongNameBit                 (1U << 6)
+#define kFPShortNameBit                (1U << 7)
+#define kFPNodeIDBit                   (1U << 8)
+#define kFPOffspringCountBit           (1U << 9)
+#define kFPOwnerIDBit                  (1U << 10)
+#define kFPGroupIDBit                  (1U << 11)
+#define kFPAccessRightsBit             (1U << 12)
+#define kFPUTF8NameBit                         (1U << 13)
 
 /* FIXME AFP3.0 bit 14, AFP3.1 bit 15 */
 
-#define kFPUnixPrivsBit                (1 << 15)
+#define kFPUnixPrivsBit                (1U << 15)
 
 /*
        directory Access Rights parameter AFP3.1.pdf
        table 1-7 p. 28
 */
 
-#define AR_O_SEARCH     (1 << 0)    /* owner has search access */
-#define AR_O_READ       (1 << 1)    /* owner has read access */
-#define AR_O_WRITE      (1 << 2)    /* owner has write access */
+#define AR_O_SEARCH     (1U << 0)   /* owner has search access */
+#define AR_O_READ       (1U << 1)   /* owner has read access */
+#define AR_O_WRITE      (1U << 2)   /* owner has write access */
 
-#define AR_G_SEARCH     (1 << 8)    /* group has search access */
-#define AR_G_READ       (1 << 9)    /* group has read access */
-#define AR_G_WRITE      (1 << 10)   /* group has write access */
+#define AR_G_SEARCH     (1U << 8)   /* group has search access */
+#define AR_G_READ       (1U << 9)   /* group has read access */
+#define AR_G_WRITE      (1U << 10)  /* group has write access */
 
-#define AR_E_SEARCH     (1 << 16)   /* everyone has search access */
-#define AR_E_READ       (1 << 17)   /* everyone has read access */
-#define AR_E_WRITE      (1 << 18)   /* everyone has write access */
+#define AR_E_SEARCH     (1U << 16)  /* everyone has search access */
+#define AR_E_READ       (1U << 17)  /* everyone has read access */
+#define AR_E_WRITE      (1U << 18)  /* everyone has write access */
 
-#define AR_U_SEARCH     (1 << 24)   /* user has search access */
-#define AR_U_READ       (1 << 25)   /* user has read access */
-#define AR_U_WRITE      (1 << 26)   /* user has write access */
+#define AR_U_SEARCH     (1U << 24)  /* user has search access */
+#define AR_U_READ       (1U << 25)  /* user has read access */
+#define AR_U_WRITE      (1U << 26)  /* user has write access */
 
-#define AR_BLANK        (1 << 28)   /* Blank Access Privileges (use parent dir privileges) */
-#define AR_U_OWN        (1 << 31)   /* user is the owner */
+#define AR_BLANK        (1U << 28)  /* Blank Access Privileges (use parent dir privileges) */
+#define AR_U_OWN        (1U << 31)  /* user is the owner */
 
 static int hf_afp_dir_ar           = -1;
 static int hf_afp_dir_ar_o_search  = -1;
@@ -884,33 +884,33 @@ kFPNodeIDBit                      (bit 8)
 kFPUTF8NameBit                         (bit 13)
 */
 
-#define kFPDataForkLenBit      (1 << 9)
-#define kFPRsrcForkLenBit      (1 << 10)
-#define kFPExtDataForkLenBit   (1 << 11)
-#define kFPLaunchLimitBit      (1 << 12)
+#define kFPDataForkLenBit      (1U << 9)
+#define kFPRsrcForkLenBit      (1U << 10)
+#define kFPExtDataForkLenBit   (1U << 11)
+#define kFPLaunchLimitBit      (1U << 12)
 
-#define kFPExtRsrcForkLenBit   (1 << 14)
+#define kFPExtRsrcForkLenBit   (1U << 14)
 
 /*
   file attribute AFP3.1.pdf
   Table 1-9 pp. 29-31
 */
-#define kFPInvisibleBit        (1 << 0)
-#define kFPMultiUserBit        (1 << 1)
-#define kFPSystemBit           (1 << 2)
-#define kFPDAlreadyOpenBit     (1 << 3)
-#define kFPRAlreadyOpenBit     (1 << 4)
-#define kFPWriteInhibitBit     (1 << 5)
-#define kFPBackUpNeededBit     (1 << 6)
-#define kFPRenameInhibitBit    (1 << 7)
-#define kFPDeleteInhibitBit    (1 << 8)
-#define kFPCopyProtectBit      (1 << 10)
-#define kFPSetClearBit                 (1 << 15)
+#define kFPInvisibleBit        (1U << 0)
+#define kFPMultiUserBit        (1U << 1)
+#define kFPSystemBit           (1U << 2)
+#define kFPDAlreadyOpenBit     (1U << 3)
+#define kFPRAlreadyOpenBit     (1U << 4)
+#define kFPWriteInhibitBit     (1U << 5)
+#define kFPBackUpNeededBit     (1U << 6)
+#define kFPRenameInhibitBit    (1U << 7)
+#define kFPDeleteInhibitBit    (1U << 8)
+#define kFPCopyProtectBit      (1U << 10)
+#define kFPSetClearBit                 (1U << 15)
 
 /* dir attribute */
-#define kIsExpFolder           (1 << 1)
-#define kMounted               (1 << 3)
-#define kInExpFolder           (1 << 4)
+#define kIsExpFolder           (1U << 1)
+#define kMounted               (1U << 3)
+#define kInExpFolder           (1U << 4)
 
 /* AFP 3.1 getsession token type */
 #define kLoginWithoutID         0
@@ -940,11 +940,11 @@ static const value_string token_type_vals[] = {
 static value_string_ext token_type_vals_ext = VALUE_STRING_EXT_INIT(token_type_vals);
 
 /* AFP 3.2 ACL bitmap */
-#define kFileSec_UUID          (1 << 0)
-#define kFileSec_GRPUUID       (1 << 1)
-#define kFileSec_ACL           (1 << 2)
-#define kFileSec_REMOVEACL     (1 << 3)
-#define kFileSec_Inherit       (1 << 4)
+#define kFileSec_UUID          (1U << 0)
+#define kFileSec_GRPUUID       (1U << 1)
+#define kFileSec_ACL           (1U << 2)
+#define kFileSec_REMOVEACL     (1U << 3)
+#define kFileSec_Inherit       (1U << 4)
 
 static int hf_afp_acl_list_bitmap              = -1;
 static int hf_afp_acl_list_bitmap_UUID         = -1;
@@ -971,40 +971,40 @@ static int hf_afp_ace_flags_limitinherit = -1;
 static int hf_afp_ace_flags_onlyinherit  = -1;
 
 /* AFP 3.2 ACE flags */
-#define ACE_ALLOW        (1 << 0)
-#define ACE_DENY         (1 << 1)
-#define ACE_INHERITED    (1 << 4)
-#define ACE_FILE_INHERIT  (1 << 5)
-#define ACE_DIR_INHERIT          (1 << 6)
-#define ACE_LIMIT_INHERIT (1 << 7)
-#define ACE_ONLY_INHERIT  (1 << 8)
+#define ACE_ALLOW        (1U << 0)
+#define ACE_DENY         (1U << 1)
+#define ACE_INHERITED    (1U << 4)
+#define ACE_FILE_INHERIT  (1U << 5)
+#define ACE_DIR_INHERIT          (1U << 6)
+#define ACE_LIMIT_INHERIT (1U << 7)
+#define ACE_ONLY_INHERIT  (1U << 8)
 
 static int ett_afp_ace_entries          = -1;
 static int ett_afp_ace_entry            = -1;
 
 /* AFP 3.2 ACL access right cf page 248*/
-#define KAUTH_VNODE_READ_DATA          (1 << 1)
+#define KAUTH_VNODE_READ_DATA          (1U << 1)
 #define KAUTH_VNODE_LIST_DIRECTORY     KAUTH_VNODE_READ_DATA
-#define KAUTH_VNODE_WRITE_DATA         (1 << 2)
+#define KAUTH_VNODE_WRITE_DATA         (1U << 2)
 #define KAUTH_VNODE_ADD_FILE           KAUTH_VNODE_WRITE_DATA
-#define KAUTH_VNODE_EXECUTE            (1 << 3)
+#define KAUTH_VNODE_EXECUTE            (1U << 3)
 #define KAUTH_VNODE_SEARCH             KAUTH_VNODE_EXECUTE
-#define KAUTH_VNODE_DELETE             (1 << 4)
-#define KAUTH_VNODE_APPEND_DATA                (1 << 5)
+#define KAUTH_VNODE_DELETE             (1U << 4)
+#define KAUTH_VNODE_APPEND_DATA                (1U << 5)
 #define KAUTH_VNODE_ADD_SUBDIRECTORY   KAUTH_VNODE_APPEND_DATA
-#define KAUTH_VNODE_DELETE_CHILD       (1 << 6)
-#define KAUTH_VNODE_READ_ATTRIBUTES    (1 << 7)
-#define KAUTH_VNODE_WRITE_ATTRIBUTES   (1 << 8)
-#define KAUTH_VNODE_READ_EXTATTRIBUTES (1 << 9)
-#define KAUTH_VNODE_WRITE_EXTATTRIBUTES        (1 << 10)
-#define KAUTH_VNODE_READ_SECURITY      (1 << 11)
-#define KAUTH_VNODE_WRITE_SECURITY     (1 << 12)
-#define KAUTH_VNODE_CHANGE_OWNER       (1 << 13)
-#define KAUTH_VNODE_SYNCHRONIZE                (1 << 20)
-#define KAUTH_VNODE_GENERIC_ALL                (1 << 21)
-#define KAUTH_VNODE_GENERIC_EXECUTE    (1 << 22)
-#define KAUTH_VNODE_GENERIC_WRITE      (1 << 23)
-#define KAUTH_VNODE_GENERIC_READ       (1 << 24)
+#define KAUTH_VNODE_DELETE_CHILD       (1U << 6)
+#define KAUTH_VNODE_READ_ATTRIBUTES    (1U << 7)
+#define KAUTH_VNODE_WRITE_ATTRIBUTES   (1U << 8)
+#define KAUTH_VNODE_READ_EXTATTRIBUTES (1U << 9)
+#define KAUTH_VNODE_WRITE_EXTATTRIBUTES        (1U << 10)
+#define KAUTH_VNODE_READ_SECURITY      (1U << 11)
+#define KAUTH_VNODE_WRITE_SECURITY     (1U << 12)
+#define KAUTH_VNODE_CHANGE_OWNER       (1U << 13)
+#define KAUTH_VNODE_SYNCHRONIZE                (1U << 20)
+#define KAUTH_VNODE_GENERIC_ALL                (1U << 21)
+#define KAUTH_VNODE_GENERIC_EXECUTE    (1U << 22)
+#define KAUTH_VNODE_GENERIC_WRITE      (1U << 23)
+#define KAUTH_VNODE_GENERIC_READ       (1U << 24)
 
 
 static int hf_afp_acl_access_bitmap                = -1;
index 8484be0c20a9aa447cd8ac7550423e980baa35d4..f953368652baa7262daf87ad3f1cc764a734915a 100644 (file)
@@ -847,63 +847,63 @@ enum c_banner {
 /** Feature Flags */
 /* Transmuted from ceph:/src/include/ceph_features.h */
 typedef enum _c_features {
-       C_FEATURE_UID                  = 1 <<  0,
-       C_FEATURE_NOSRCADDR            = 1 <<  1,
-       C_FEATURE_MONCLOCKCHECK        = 1 <<  2,
-       C_FEATURE_FLOCK                = 1 <<  3,
-       C_FEATURE_SUBSCRIBE2           = 1 <<  4,
-       C_FEATURE_MONNAMES             = 1 <<  5,
-       C_FEATURE_RECONNECT_SEQ        = 1 <<  6,
-       C_FEATURE_DIRLAYOUTHASH        = 1 <<  7,
-       C_FEATURE_OBJECTLOCATOR        = 1 <<  8,
-       C_FEATURE_PGID64               = 1 <<  9,
-       C_FEATURE_INCSUBOSDMAP         = 1 << 10,
-       C_FEATURE_PGPOOL3              = 1 << 11,
-       C_FEATURE_OSDREPLYMUX          = 1 << 12,
-       C_FEATURE_OSDENC               = 1 << 13,
-       C_FEATURE_OMAP                 = 1 << 14,
-       C_FEATURE_MONENC               = 1 << 15,
-       C_FEATURE_QUERY_T              = 1 << 16,
-       C_FEATURE_INDEP_PG_MAP         = 1 << 17,
-       C_FEATURE_CRUSH_TUNABLES       = 1 << 18,
-       C_FEATURE_CHUNKY_SCRUB         = 1 << 19,
-       C_FEATURE_MON_NULLROUTE        = 1 << 20,
-       C_FEATURE_MON_GV               = 1 << 21,
-       C_FEATURE_BACKFILL_RESERVATION = 1 << 22,
-       C_FEATURE_MSG_AUTH             = 1 << 23,
-       C_FEATURE_RECOVERY_RESERVATION = 1 << 24,
-       C_FEATURE_CRUSH_TUNABLES2      = 1 << 25,
-       C_FEATURE_CREATEPOOLID         = 1 << 26,
-       C_FEATURE_REPLY_CREATE_INODE   = 1 << 27,
-       C_FEATURE_OSD_HBMSGS           = 1 << 28,
-       C_FEATURE_MDSENC               = 1 << 29,
-       C_FEATURE_OSDHASHPSPOOL        = 1 << 30,
-       C_FEATURE_MON_SINGLE_PAXOS     = 1 << 31,
-       C_FEATURE_OSD_SNAPMAPPER       = 1 <<  0,
-       C_FEATURE_MON_SCRUB            = 1 <<  1,
-       C_FEATURE_OSD_PACKED_RECOVERY  = 1 <<  2,
-       C_FEATURE_OSD_CACHEPOOL        = 1 <<  3,
-       C_FEATURE_CRUSH_V2             = 1 <<  4,
-       C_FEATURE_EXPORT_PEER          = 1 <<  5,
-       C_FEATURE_OSD_ERASURE_CODES    = 1 <<  6,
-       C_FEATURE_OSD_TMAP2OMAP        = 1 <<  6,
-       C_FEATURE_OSDMAP_ENC           = 1 <<  7,
-       C_FEATURE_MDS_INLINE_DATA      = 1 <<  8,
-       C_FEATURE_CRUSH_TUNABLES3      = 1 <<  9,
-       C_FEATURE_OSD_PRIMARY_AFFINITY = 1 <<  9,
-       C_FEATURE_MSGR_KEEPALIVE2      = 1 << 10,
-       C_FEATURE_RESERVED             = 1 << 31
+       C_FEATURE_UID                  = 1U <<  0,
+       C_FEATURE_NOSRCADDR            = 1U <<  1,
+       C_FEATURE_MONCLOCKCHECK        = 1U <<  2,
+       C_FEATURE_FLOCK                = 1U <<  3,
+       C_FEATURE_SUBSCRIBE2           = 1U <<  4,
+       C_FEATURE_MONNAMES             = 1U <<  5,
+       C_FEATURE_RECONNECT_SEQ        = 1U <<  6,
+       C_FEATURE_DIRLAYOUTHASH        = 1U <<  7,
+       C_FEATURE_OBJECTLOCATOR        = 1U <<  8,
+       C_FEATURE_PGID64               = 1U <<  9,
+       C_FEATURE_INCSUBOSDMAP         = 1U << 10,
+       C_FEATURE_PGPOOL3              = 1U << 11,
+       C_FEATURE_OSDREPLYMUX          = 1U << 12,
+       C_FEATURE_OSDENC               = 1U << 13,
+       C_FEATURE_OMAP                 = 1U << 14,
+       C_FEATURE_MONENC               = 1U << 15,
+       C_FEATURE_QUERY_T              = 1U << 16,
+       C_FEATURE_INDEP_PG_MAP         = 1U << 17,
+       C_FEATURE_CRUSH_TUNABLES       = 1U << 18,
+       C_FEATURE_CHUNKY_SCRUB         = 1U << 19,
+       C_FEATURE_MON_NULLROUTE        = 1U << 20,
+       C_FEATURE_MON_GV               = 1U << 21,
+       C_FEATURE_BACKFILL_RESERVATION = 1U << 22,
+       C_FEATURE_MSG_AUTH             = 1U << 23,
+       C_FEATURE_RECOVERY_RESERVATION = 1U << 24,
+       C_FEATURE_CRUSH_TUNABLES2      = 1U << 25,
+       C_FEATURE_CREATEPOOLID         = 1U << 26,
+       C_FEATURE_REPLY_CREATE_INODE   = 1U << 27,
+       C_FEATURE_OSD_HBMSGS           = 1U << 28,
+       C_FEATURE_MDSENC               = 1U << 29,
+       C_FEATURE_OSDHASHPSPOOL        = 1U << 30,
+       C_FEATURE_MON_SINGLE_PAXOS     = 1U << 31,
+       C_FEATURE_OSD_SNAPMAPPER       = 1U <<  0,
+       C_FEATURE_MON_SCRUB            = 1U <<  1,
+       C_FEATURE_OSD_PACKED_RECOVERY  = 1U <<  2,
+       C_FEATURE_OSD_CACHEPOOL        = 1U <<  3,
+       C_FEATURE_CRUSH_V2             = 1U <<  4,
+       C_FEATURE_EXPORT_PEER          = 1U <<  5,
+       C_FEATURE_OSD_ERASURE_CODES    = 1U <<  6,
+       C_FEATURE_OSD_TMAP2OMAP        = 1U <<  6,
+       C_FEATURE_OSDMAP_ENC           = 1U <<  7,
+       C_FEATURE_MDS_INLINE_DATA      = 1U <<  8,
+       C_FEATURE_CRUSH_TUNABLES3      = 1U <<  9,
+       C_FEATURE_OSD_PRIMARY_AFFINITY = 1U <<  9,
+       C_FEATURE_MSGR_KEEPALIVE2      = 1U << 10,
+       C_FEATURE_RESERVED             = 1U << 31
 } c_features;
 
 /** Connect Message Flags */
 typedef enum _c_flags {
-       C_FLAG_LOSSY = 1 << 0
+       C_FLAG_LOSSY = 1U << 0
 } c_flags;
 
 typedef enum _c_pgpool_flags {
-       C_PGPOOL_FLAG_HASHPSPOOL   = 1 << 0, /* hash pg seed and pool together (instead of adding) */
-       C_PGPOOL_FLAG_FULL         = 1 << 1, /* pool is full */
-       C_PGPOOL_FLAG_FAKE_EC_POOL = 1 << 2 /* require ReplicatedPG to act like an EC pg */
+       C_PGPOOL_FLAG_HASHPSPOOL   = 1U << 0, /* hash pg seed and pool together (instead of adding) */
+       C_PGPOOL_FLAG_FULL         = 1U << 1, /* pool is full */
+       C_PGPOOL_FLAG_FAKE_EC_POOL = 1U << 2 /* require ReplicatedPG to act like an EC pg */
 } c_pgpool_flags;
 
 /** Macros to create value_stings.
index 5d657df42615957773ae318cf7245121e40b1566..d38c3c2074e3737f308e4755a55c19704795d015 100644 (file)
@@ -287,9 +287,9 @@ static const true_false_string tfs_fcels_estat_seq_init = {
 };
 
 
-#define FC_ESB_ST_RESP      (1 << 31)   /* responder to exchange */
-#define FC_ESB_ST_SEQ_INIT  (1 << 30)   /* holds sequence initiative */
-#define FC_ESB_ST_COMPLETE  (1 << 29)   /* exchange is complete */
+#define FC_ESB_ST_RESP      (1U << 31)   /* responder to exchange */
+#define FC_ESB_ST_SEQ_INIT  (1U << 30)   /* holds sequence initiative */
+#define FC_ESB_ST_COMPLETE  (1U << 29)   /* exchange is complete */
 
 static const value_string fc_els_proto_val[] = {
     {FC_ELS_LSRJT        , "LS_RJT"},
index 698608600a9883154ced4d7b4f6e8f87c1a8e024..8c77f25c395f16ff1cda56924a7d8d4ca5649b23 100644 (file)
@@ -281,8 +281,8 @@ dissect_npmp_add_flow_message(tvbuff_t *message_tvb, proto_tree *message_tree)
 
   retranstrials = tvb_get_ntohl(message_tvb, offset_addflow_retranstrials);
   proto_tree_add_uint_format_value(message_tree, hf_addflow_retranstrials, message_tvb, offset_addflow_retranstrials, length_addflow_retranstrials,
-                                   retranstrials, (retranstrials & (1 << 31)) ? "%u ms" : "%u trials",
-                                   retranstrials &~ (1 << 31));
+                                   retranstrials, (retranstrials & (1U << 31)) ? "%u ms" : "%u trials",
+                                   retranstrials &~ (1U << 31));
 
   ADD_FIELD_UINT(message_tree, addflow_frameraterng);
   ADD_FIELD_UINT(message_tree, addflow_framerate1);
index 9ec997dc7a785b7390da73ef3c62de1bc6ed16a9..1eeddd9bc7642363d0a69289a5c086797f88d4ae 100644 (file)
@@ -374,7 +374,7 @@ dissect_reload_framing_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
       received = tvb_get_ntohl(tvb, offset);
       while ((received<<indx) != 0) {
         if (indx>=32) break;
-        if (received &(0x1<<(31-indx))) {
+        if (received &(1U<<(31-indx))) {
           if (indx==0) {
             received_tree = proto_item_add_subtree(ti_received, ett_reload_framing_received);
             ti_parsed_received = proto_tree_add_item(received_tree, hf_reload_framing_parsed_received, tvb, offset, 4, ENC_NA);
@@ -382,7 +382,7 @@ dissect_reload_framing_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
             last_received = indx;
           }
           else {
-            if (received &(0x1<<(31-indx+1))) {
+            if (received &(1U<<(31-indx+1))) {
               indx++;
               /* range: skip */
               continue;
@@ -404,9 +404,9 @@ dissect_reload_framing_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
           }
         }
         else if (indx>0) {
-          if ((received &(0x1<<(31-indx+1))) && (received &(0x1<<(31-indx+2)))) {
+          if ((received &(1U<<(31-indx+1))) && (received &(1U<<(31-indx+2)))) {
             /* end of a series */
-            if ((received &(0x1<<(31-indx+3)))) {
+            if ((received &(1U<<(31-indx+3)))) {
               proto_item_append_text(ti_parsed_received,"-%u",(sequence-32+indx-1));
             }
             else {
@@ -422,9 +422,9 @@ dissect_reload_framing_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
         indx++;
       }
       if (last_received>=0) {
-        if ((received &(0x1<<(31-indx+1))) && (received &(0x1<<(31-indx+2)))) {
+        if ((received &(1U<<(31-indx+1))) && (received &(1U<<(31-indx+2)))) {
           /* end of a series */
-          if ((received &(0x1<<(31-indx+3)))) {
+          if ((received &(1U<<(31-indx+3)))) {
             proto_item_append_text(ti_parsed_received,"-%u",(sequence-32+indx-1));
           }
           else {
index cc389ee08ce325e12a9dec92041790acefb836d6..6f939c1937b63fa514dbcbf1587ab6e27d187807 100644 (file)
@@ -3108,9 +3108,9 @@ dissect_rsvp_error(proto_item *ti, packet_info* pinfo, proto_tree *rsvp_object_t
         proto_tree_add_item(rsvp_error_subtree, hf_rsvp_error_flags_in_place,
                                  tvb, offset3, 1, ENC_BIG_ENDIAN);
         proto_item_append_text(ti2, " %s %s %s",
-                               (error_flags & (1<<2))  ? "Path-State-Removed" : "",
-                               (error_flags & (1<<1))  ? "NotGuilty" : "",
-                               (error_flags & (1<<0))  ? "InPlace" : "");
+                               (error_flags & (1U<<2))  ? "Path-State-Removed" : "",
+                               (error_flags & (1U<<1))  ? "NotGuilty" : "",
+                               (error_flags & (1U<<0))  ? "InPlace" : "");
         error_code = tvb_get_guint8(tvb, offset3+1);
         proto_tree_add_item(rsvp_object_tree, hf_rsvp_error_error_code, tvb, offset3+1, 1, ENC_BIG_ENDIAN);
         error_val = dissect_rsvp_error_value(rsvp_object_tree, tvb, offset3+2, error_code);
@@ -3401,8 +3401,8 @@ dissect_rsvp_eth_tspec_tlv(proto_item *ti, packet_info* pinfo, proto_tree *rsvp_
             proto_tree_add_item(ethspec_profile_subtree, hf_rsvp_eth_tspec_tlv_coupling_flag,
                              tvb, offset+tlv_off+4, 1, ENC_BIG_ENDIAN);
             proto_item_append_text(ti3, " %s %s",
-                                   (profile & (1<<1))  ? "CM" : "",
-                                   (profile & (1<<0))  ? "CF" : "");
+                                   (profile & (1U<<1))  ? "CM" : "",
+                                   (profile & (1U<<0))  ? "CF" : "");
             proto_tree_add_item(rsvp_ethspec_subtree, hf_rsvp_eth_tspec_index, tvb, offset+tlv_off+5, 1, ENC_NA);
             proto_tree_add_item(rsvp_ethspec_subtree, hf_rsvp_eth_tspec_reserved, tvb, offset+tlv_off+6, 2, ENC_BIG_ENDIAN);
             proto_tree_add_item(rsvp_ethspec_subtree, hf_rsvp_eth_tspec_cir, tvb, offset+tlv_off+8, 4, ENC_BIG_ENDIAN);
@@ -3460,8 +3460,8 @@ dissect_rsvp_eth_tspec_tlv(proto_item *ti, packet_info* pinfo, proto_tree *rsvp_
             proto_tree_add_item(ethspec_profile_subtree, hf_rsvp_eth_tspec_tlv_coupling_flag,
                              tvb, offset+tlv_off+4, 1, ENC_BIG_ENDIAN);
             proto_item_append_text(ti3, " %s %s",
-                                   (profile & (1<<1))  ? "CM" : "",
-                                   (profile & (1<<0))  ? "CF" : "");
+                                   (profile & (1U<<1))  ? "CM" : "",
+                                   (profile & (1U<<0))  ? "CF" : "");
             proto_tree_add_item(rsvp_ethspec_subtree, hf_rsvp_eth_tspec_index, tvb, offset+tlv_off+5, 1, ENC_BIG_ENDIAN);
             proto_tree_add_item(rsvp_ethspec_subtree, hf_rsvp_eth_tspec_reserved, tvb, offset+tlv_off+6, 2, ENC_BIG_ENDIAN);
             proto_tree_add_item(rsvp_ethspec_subtree, hf_rsvp_eth_tspec_cir, tvb, offset+tlv_off+8, 4, ENC_BIG_ENDIAN);
@@ -5370,14 +5370,14 @@ dissect_rsvp_admin_status(proto_tree *ti, proto_tree *rsvp_object_tree,
         proto_tree_add_bitmask(rsvp_object_tree, tvb, offset2, hf_rsvp_admin_status_bits, TREE(TT_ADMIN_STATUS_FLAGS), status_flags, ENC_BIG_ENDIAN);
 
         proto_item_set_text(ti, "ADMIN-STATUS: %s%s%s%s%s%s%s%s",
-                            (status & (1<<31)) ? "Reflect " : "",
-                            (status & (1<<6)) ? "Handover " : "",
-                            (status & (1<<5)) ? "Lockout " : "",
-                            (status & (1<<4)) ? "Inhibit " : "",
-                            (status & (1<<3)) ? "Call " : "",
-                            (status & (1<<2)) ? "Testing " : "",
-                            (status & (1<<1)) ? "Admin-Down " : "",
-                            (status & (1<<0)) ? "Deleting " : "");
+                            (status & (1U<<31)) ? "Reflect " : "",
+                            (status & (1U<<6)) ? "Handover " : "",
+                            (status & (1U<<5)) ? "Lockout " : "",
+                            (status & (1U<<4)) ? "Inhibit " : "",
+                            (status & (1U<<3)) ? "Call " : "",
+                            (status & (1U<<2)) ? "Testing " : "",
+                            (status & (1U<<1)) ? "Admin-Down " : "",
+                            (status & (1U<<0)) ? "Deleting " : "");
         break;
 
     default:
index e23a2581a71d74f0504528c4738a2818217b70d8..1fc37ffb25f607b0f828b5c6a426618c12751af1 100644 (file)
@@ -2554,7 +2554,7 @@ static int rtps_util_add_bitmap(proto_tree *tree,
     data = NEXT_guint32(tvb, offset, little_endian);
     offset += 4;
     for (j = 0; j < 32; ++j) {
-      datamask = (1 << (31-j));
+      datamask = (1U << (31-j));
       wmem_strbuf_append_c(temp_buff, ((data & datamask) == datamask) ? '1':'0');
       ++idx;
       if ((idx >= num_bits) || (wmem_strbuf_get_len(temp_buff) >= (ITEM_LABEL_LENGTH - 1))) {
@@ -2644,7 +2644,7 @@ static int rtps_util_add_fragment_number_set(proto_tree *tree, packet_info *pinf
     data = NEXT_guint32(tvb, offset, little_endian);
     offset += 4;
     for (j = 0; j < 32; ++j) {
-      datamask = (1 << (31-j));
+      datamask = (1U << (31-j));
       wmem_strbuf_append_c(temp_buff, ((data & datamask) == datamask) ? '1':'0');
       ++idx;
       if ((idx >= num_bits) || (wmem_strbuf_get_len(temp_buff) >= (ITEM_LABEL_LENGTH - 1))) {
@@ -2700,7 +2700,7 @@ static void rtps_util_decode_flags(proto_tree *tree, tvbuff_t *tvb, gint offset,
   flags_tree = proto_item_add_subtree(ti, ett_rtps_flags);
 
   for (i = 0; i < 8; ++i) {
-    int is_set = (flags & (1 << (7-i)));
+    int is_set = (flags & (1U << (7-i)));
 
     for (j = 0; j < 8; ++j) {
       flags_str[j] = (i == j) ? (is_set ? '1' : '0') : '.';
@@ -2732,7 +2732,7 @@ static void rtps_util_decode_flags_16bit(proto_tree *tree, tvbuff_t *tvb, gint o
   flags_tree = proto_item_add_subtree(ti, ett_rtps_flags);
 
   for (i = 0; i < 16; ++i) {
-    int is_set = (flags & (1 << (15-i)));
+    guint is_set = (flags & (1U << (15-i)));
 
     for (j = 0; j < 16; ++j) {
       flags_str[j] = (i == j) ? (is_set ? '1' : '0') : '.';
index c7d7319fb2b3f1d16eb4e7d202a0a9e0e2566e3e..fff245e590b113c83f9d81211ab45d00f669ed6c 100644 (file)
@@ -288,7 +288,7 @@ req_resp_hdrs_do_reassembly(tvbuff_t *tvb, const int offset, packet_info *pinfo,
                                         */
                                        return TRUE;
                                }
-                               if (chunk_size > (guint)1<<31) {
+                               if (chunk_size > 1U<<31) {
                                        /* Chunk size is unreasonable. */
                                        /* XXX What /is/ reasonable? */
                                        return TRUE;
diff --git a/mkcap.c b/mkcap.c
index a7cefdf92ee1b5cb0c5b9ce0af1156b5c47b91ed..0f0a7a58ee27bb757d7589ee0dc45ff6fa7fb4e9 100644 (file)
--- a/mkcap.c
+++ b/mkcap.c
@@ -153,7 +153,7 @@ int next_ack_due()
   int ack_lost = 0, seg_lost = 0;
 
   if (next_slot == first_slot)
-    return (((unsigned int)(1<<31)) - 1);
+    return ((1U<<31) - 1);
 
   /*
    * Figure out if we need to issue an ACK. We skip all outstanding packets
@@ -178,7 +178,7 @@ int next_ack_due()
   }
 
   if (slot == next_slot)
-    return (((unsigned int)(1<<31)) - 1);
+    return ((1U<<31) - 1);
 
   /*
    * If there is only one slot occupied, or a segment was lost then
@@ -206,7 +206,7 @@ int next_ack_due()
       if (((first_slot + 1 + 2 * ack_lost) % SEG_HIST_SIZE) >= next_slot)
         /* XXX: FIXME, what about when the window is closed */
         /* XXX: FIXME, use the correct value for this       */
-        return (((unsigned int)(1<<31)) - 1);
+        return ((1U<<31) - 1);
       else
         return seg_hist[(first_slot + 1 + 2 * ack_lost) % SEG_HIST_SIZE].ts +
           ack_delay + jitter;
index 5bb42a011347dd1e5f6303b635735406fcac296c..0d9e4db7ba6b8a136da5c626d5ca39917233e3fb 100644 (file)
@@ -115,9 +115,9 @@ static expert_field ei_wimaxasncp_length_bad = EI_INIT;
 /* Offset to end of the length field in the headder. */
 #define WIMAXASNCP_HEADER_LENGTH_END 6
 
-#define WIMAXASNCP_BIT32(n) (1 << (31 - (n)))
-#define WIMAXASNCP_BIT16(n) (1 << (15 - (n)))
-#define WIMAXASNCP_BIT8(n)  (1 << ( 7 - (n)))
+#define WIMAXASNCP_BIT32(n) (1U << (31 - (n)))
+#define WIMAXASNCP_BIT16(n) (1U << (15 - (n)))
+#define WIMAXASNCP_BIT8(n)  (1U << ( 7 - (n)))
 
 #define WIMAXASNCP_FLAGS_T  WIMAXASNCP_BIT8(6)
 #define WIMAXASNCP_FLAGS_R  WIMAXASNCP_BIT8(7)
@@ -881,7 +881,7 @@ static void wimaxasncp_dissect_tlv_value(
                 for (i = 0; i < 8; ++i)
                 {
                     guint8 mask;
-                    mask = 1 << (7 - i);
+                    mask = 1U << (7 - i);
 
                     if (value & mask)
                     {
@@ -936,7 +936,7 @@ static void wimaxasncp_dissect_tlv_value(
                 for (i = 0; i < 16; ++i)
                 {
                     guint16 mask;
-                    mask = 1 << (15 - i);
+                    mask = 1U << (15 - i);
 
                     if (value & mask)
                     {
@@ -991,7 +991,7 @@ static void wimaxasncp_dissect_tlv_value(
                 for (i = 0; i < 32; ++i)
                 {
                     guint32 mask;
-                    mask = 1 << (31 - i);
+                    mask = 1U << (31 - i);
 
                     if (value & mask)
                     {
@@ -2235,7 +2235,7 @@ dissect_wimaxasncp(
             for (j = 0; j < 8; ++j)
             {
                 guint8 mask;
-                mask = 1 << (7 - j);
+                mask = 1U << (7 - j);
 
                 /* Only add flags that are set */
                 if (ui8 & mask)
index a75dd0015e91f345a450b967e59f7cf8aef8f7ec..58f0301030a50b2ede48be436ed8b01c57700f40 100644 (file)
@@ -1007,7 +1007,7 @@ wtap_open_return_val k12_open(wtap *wth, int *err, gchar **err_info) {
                         rec->input_info.ds0mask = 0x00000000;
                         if (hwpart_len > K12_SRCDESC_DS0_MASK) {
                             for (i = 0; i < hwpart_len - K12_SRCDESC_DS0_MASK; i++) {
-                                rec->input_info.ds0mask |= ( *(read_buffer + K12_SRCDESC_HWPART + K12_SRCDESC_DS0_MASK + i) == 0xff ) ? 0x1<<(31-i) : 0x0;
+                                rec->input_info.ds0mask |= ( *(read_buffer + K12_SRCDESC_HWPART + K12_SRCDESC_DS0_MASK + i) == 0xff ) ? 1U<<(31-i) : 0x0;
                             }
                         }
                         break;