linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] don't use unsigned ints for signed data, print_mcs_index()
@ 2011-12-07  5:55 nick black
  0 siblings, 0 replies; 2+ messages in thread
From: nick black @ 2011-12-07  5:55 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless

[-- Attachment #1: Type: text/plain, Size: 1547 bytes --]

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!

diff -ur iw-3.1-orig/util.c iw-3.1/util.c
--- iw-3.1-orig/util.c	2011-12-07 00:43:05.495669921 -0500
+++ iw-3.1/util.c	2011-12-07 00:51:45.558545571 -0500
@@ -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)

-- 
                                       nick black <nickblack@linux.com>
"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."

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [[PATCH] don't use unsigned ints for signed data, print_mcs_index()]
@ 2011-12-07  6:01 nick black
  0 siblings, 0 replies; 2+ messages in thread
From: nick black @ 2011-12-07  6:01 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless

(unsigned this time per
http://linuxwireless.org/en/developers/Documentation/SubmittingPatches,
sorry about that)

diff -ur iw-3.1-orig/util.c iw-3.1/util.c
--- iw-3.1-orig/util.c	2011-12-07 00:43:05.495669921 -0500
+++ iw-3.1/util.c	2011-12-07 00:51:45.558545571 -0500
@@ -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)

-- 
                                       nick black <nickblack@linux.com>
"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."

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-12-07  6:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-07  6:01 [[PATCH] don't use unsigned ints for signed data, print_mcs_index()] nick black
  -- strict thread matches above, loose matches on Subject: below --
2011-12-07  5:55 [PATCH] don't use unsigned ints for signed data, print_mcs_index() nick black

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).