Skip to contentSkip to conversation

don't use unsigned ints for signed data, print_mcs_index()

PATCH New nick black 1 participant 1 message Dec 7, 2011

lore
Share & tools
lore

nick black

author
#0 lore raw

PATCH 1/1 don't use unsigned ints for signed data, print_mcs_index()

Johannes et al,

Trivial patch. Don't use unsigned ints for clearly signed data. Though the code as stands works, it's brittle in the face of change, and generates compiler warnings. Please apply. Taken against Debian's iw-3.1. Thanks!

util.c +4 -4
diff -ur iw-3.1-orig/util.c iw-3.1/util.c
@@ -384,7 +384,7 @@
 
 static void print_mcs_index(const __u8 *mcs)
 {
-	unsigned int mcs_bit, prev_bit = -2, prev_cont = 0;
+	int mcs_bit, prev_bit = -2, prev_cont = 0;
 
 	for (mcs_bit = 0; mcs_bit <= 76; mcs_bit++) {
 		unsigned int mcs_octet = mcs_bit/8;
@@ -458,7 +458,7 @@
 	if (max_ampdu_length) {
 		printf("\t\tMaximum RX AMPDU length %d bytes (exponent: 0x0%02x)\n",
 		       max_ampdu_length, exponent);
-        } else {
+	} else {
 		printf("\t\tMaximum RX AMPDU length: unrecognized bytes "
 		       "(exponent: %d)\n", exponent);
 	}
@@ -466,8 +466,8 @@
 
 void print_ampdu_spacing(__u8 spacing)
 {
-        printf("\t\tMinimum RX AMPDU time spacing: %s (0x%02x)\n",
-               print_ampdu_space(spacing), spacing);
+	printf("\t\tMinimum RX AMPDU time spacing: %s (0x%02x)\n",
+	       print_ampdu_space(spacing), spacing);
 }
 
 void print_ht_capability(__u16 cap)
Signature · 3 lines
                                       nick black <[email protected]>
"A main cause of the Roman Empire's fall was that–lacking zero–they had
       no way to indicate successful termination of their C programs."