That warning is bogus; squelch it with an otherwise-unnecessary cast.
authorGuy Harris <guy@alum.mit.edu>
Fri, 22 Jan 2016 22:43:25 +0000 (14:43 -0800)
committerGuy Harris <guy@alum.mit.edu>
Fri, 22 Jan 2016 22:43:57 +0000 (22:43 +0000)
The compiler being used for the 64-bit OS X build is buggy; throw in an
otherwise-unnecessary cast to squelch its bogus warning.

Change-Id: Ie2104ba861493870191530ca391a089ca3951929
Reviewed-on: https://code.wireshark.org/review/13489
Reviewed-by: Guy Harris <guy@alum.mit.edu>
epan/dissectors/packet-isakmp.c

index 983f7913f318f330492dbde2fe77c965cbb68b9a..8bfb80ea5317382367b616a5cffdf38c55d67cb7 100644 (file)
@@ -5158,13 +5158,20 @@ static guint ikev2_key_hash_func(gconstpointer k) {
 
   hash = 0;
 
-  /* XOR our icookie down to the size of a guint */
-  key_segcount = ((size_t)key->spii_len) / sizeof(guint);
+  /*
+   * XOR our icookie down to the size of a guint.
+   *
+   * The cast to guint suppresses a warning 64-bit-to-32-bit narrowing
+   * from some buggy C compilers (I'm looking at *you*,
+   * i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1
+   * (Based on Apple Inc. build 5658) (LLVM build 2336.11.00).)
+   */
+  key_segcount = key->spii_len / (guint)sizeof(guint);
   key_segs = (guint *)key->spii;
   for (i = 0; i < key_segcount; i++) {
     hash ^= key_segs[i];
   }
-  key_segcount = ((size_t)key->spir_len) / sizeof(guint);
+  key_segcount = key->spir_len / (guint)sizeof(guint);
   key_segs = (guint *)key->spir;
   for (i = 0; i < key_segcount; i++) {
     hash ^= key_segs[i];