[patch v3] PS3: Fix printing of os-area magic numbers

Geert Uytterhoeven Geert.Uytterhoeven at sonycom.com
Sun Dec 23 20:51:19 EST 2007


On Sat, 22 Dec 2007, Geoff Levand wrote:
> +static void dump_field(char *s, const u8 *f, unsigned int size)
> +{
> +#if defined(DEBUG)
> +	unsigned int i;
> +
> +	for (i = 0; i < size; i++)
> +		s[i] = isprint(f[i]) ? f[i] : '.';
> +	s[i] = 0;
> +#endif
> +}

Sorry for nitpicking again.

Usually the _length_ of a C-string is the number of characters, while the
_size_ of a C-string includes the zero-terminator.

In dump_field() it writes size+1 bytes to s.

With kind regards,
 
Geert Uytterhoeven
Software Architect

Sony Network and Software Technology Center Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium
 
Phone:    +32 (0)2 700 8453	
Fax:      +32 (0)2 700 8622	
E-mail:   Geert.Uytterhoeven at sonycom.com	
Internet: http://www.sony-europe.com/
 	
Sony Network and Software Technology Center Europe	
A division of Sony Service Centre (Europe) N.V.	
Registered office: Technologielaan 7 · B-1840 Londerzeel · Belgium	
VAT BE 0413.825.160 · RPR Brussels	
Fortis Bank Zaventem · Swift GEBABEBB08A · IBAN BE39001382358619


More information about the Linuxppc-dev mailing list