Messages in this thread | | | Date | Sat, 03 Jul 2004 21:39:24 +0000 | From | Joel Soete <> | Subject | Re: Some cleanup patches for: '...lvalues is deprecated' |
| |
Thanks first for your attention ;)
Vojtech Pavlik wrote: > On Sat, Jul 03, 2004 at 12:53:21PM +0000, Joel Soete wrote: > >>Hi Marcelo, >> >>Please appolgies first for wrong presentation of previous post (that was >>the first and certainly the last time that I used the 'forwarding' option >>of this webmail interface :( ). >> >>Here are some backport to clean up some warning of type: use of cast >>experssion >>as lvalues is deprecated. >>--- linux-2.4.27-rc2-pa4mm/kernel/sysctl.c.Orig 2004-06-29 >>09:03:42.000000000 +0200 >>+++ linux-2.4.27-rc2-pa4mm/kernel/sysctl.c 2004-06-29 >>10:10:31.588030256 +0200 >>@@ -890,7 +890,7 @@ >> if (!isspace(c)) >> break; >> left--; >>- ((char *) buffer)++; >>+ buffer += sizeof(char); > > > This (although correct in the end) is a wrong thing to do. > > It seems to look like the intention is to move the pointer by a char's > size, however your change is equivalent to: > > buffer += 1; > > And if buffer wasn't void*, which it fortunately is, it would, unlike > the older construction, move the pointer by a different size. > Very interesting but well I am not enough fluent in C to understand this fine detail :( Can you explain me by an example (let say a long*) what would did "((char *) buffer)++;" versus "buffer += sizeof(char);" (Don't worry, if don't have time, I will perfectly understand and will experiment by myself)
> So just use > > buffer++; > > here, and the intent is then clear. > Yes ;) > >>--- linux-2.4.27-rc2-pa4mm/drivers/video/fbcon.c.Orig 2004-06-29 >>10:47:31.901491304 +0200 >>+++ linux-2.4.27-rc2-pa4mm/drivers/video/fbcon.c 2004-06-29 >>11:13:31.846343640 +0200 >>@@ -1877,7 +1877,10 @@ >> font length must be multiple of 256, at least. And 256 is multiple >> of 4 */ >> k = 0; >>- while (p > new_data) k += *--(u32 *)p; >>+ while (p > new_data) { >>+ p = (u8 *)((u32 *)p - 1); >>+ k += *(u32 *)p; >>+ } > > > > How about > > p -= 4; > k += *(u32 *)p; > :)
Thanks again, Joel - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |