Thread (5 messages) 5 messages, 2 authors, 2013-12-16

Re: [PATCH 2/2] Input: joystick - use sizeof(VARIABLE) in documentation

From: Antonio Ospite <hidden>
Date: 2013-12-16 10:07:11

On Mon, 16 Dec 2013 01:51:41 -0800
Dmitry Torokhov [off-list ref] wrote:
Hi Antonio,

On Mon, Dec 16, 2013 at 09:57:15AM +0100, Antonio Ospite wrote:
quoted
@@ -181,7 +181,7 @@ at a time using the typical read(2) functionality. For that, you would
 replace the read above with something like
 
 	struct js_event mybuffer[0xff];
-	int i = read (fd, mybuffer, sizeof(struct mybuffer));
+	int i = read (fd, mybuffer, ARRAY_SIZE(mybuffer));
 
This is wrong, as ARRAY_SIZE(mybuffer) would be 0xff and not the size of
buffer in bytes. I'll fix it up.

Thanks.
You're right of course, thank you.

Ciao,
   Antonio

-- 
Antonio Ospite
http://ao2.it

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help