[MPlayer-cvslog] r32918 - trunk/gui/skin/font.c

Nicolas George nicolas.george at normalesup.org
Thu Feb 17 13:30:46 CET 2011


Le nonidi 29 pluviôse, an CCXIX, Ingo Brückl a écrit :
> I'm not sure what you mean by this. The four (already changed to six) bytes
> uchar[]?

	type buf[42];
	...
	frobnicate(buf, 42);
	...

will break if you change the size of the buffer in one place but not the
other.

Two usual ways to solve this are:

	#define BUF_SIZE 42
	type buf[BUF_SIZE];
	frobnicate(buf, BUF_SIZE);

	type buf[42];
	frobnicate(buf, sizeof(buf) / sizeof(*buf));

In this particular case, the sizeof solution is probably better, especially
since sizeof(char)=1.

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-cvslog/attachments/20110217/53a1aaa7/attachment.pgp>


More information about the MPlayer-cvslog mailing list