[MPlayer-dev-eng] [PATCH 1/4] String handling audit/cleanup

Rich Felker dalias at aerifal.cx
Fri Mar 2 22:13:14 CET 2007


On Fri, Mar 02, 2007 at 09:31:41PM +0100, Alex Beregszaszi wrote:
> Hi,
> 
> As a general rule I would consider sending such patches in one diff file
> for a directory.
> 
> in cpudetect.c:
> 
> -       sprintf(vendor,"%.4s%.4s%.4s",(char*)(regs+1),(char*)(regs
> +3),(char*)(regs+2));
> +       snprintf(vendor, sizeof vendor, "%.4s%.4s%.4s",(char*)(regs
> +1),(char*)(regs+3),(char*)(regs+2));
> 
> change this to sizeof(vendor)

Is there a reason you prefer this style? It's correct as written.
Parentheses with sizeof are for sizeof(type) as opposed to
sizeof lvalue.

Rich



More information about the MPlayer-dev-eng mailing list