msdmo: Array parameter is passed to function as pointer so loses size information

John Klehm xixsimplicityxix at gmail.com
Wed Apr 9 13:38:01 CDT 2008


On Wed, Apr 9, 2008 at 11:54 AM, Andrew Talbot
<Andrew.Talbot at talbotville.com> wrote:
> Robert Shearman wrote:
>  > This is incorrect. count is the size in bytes of the buffer passed in
>  > (szName) and so should be sizeof(szName) not
>  > sizeof(szName)/sizeof(szName[0]) (i.e. 80).
>  >
>
Andrew T is right about arrays being decayed to pointers when passed
into functions, so sizeof(szName) is going to reuturn 4 or 8 or
whatever.  If count needs to be the size of the buffer shouldn't it
be:

count = NAME_SIZE * sizeof(WCHAR);

but probably better would be DMO_MAX_NAME_SIZE and be in a header
somewhere (dmo.h?)?

Regards,
John



More information about the wine-devel mailing list