wined3d: Use a safer, more compliant method to parse extension strings

Chris Robinson chris.kcat at gmail.com
Sun Aug 5 20:04:04 CDT 2007


On Sunday 05 August 2007 02:23:11 pm Vitaliy Margolen wrote:
> Chris Robinson wrote:
> > +
> > +    /* End */
> > +    {NULL, 0}
> >  };
>
> [..]
>
> > -            for (i = 0; i < (sizeof(EXTENSION_MAP) /
> > sizeof(*EXTENSION_MAP)); ++i) { +            for (i = 0;
> > EXTENSION_MAP[i].extension_string; ++i) {
>
> What was the reason for this change? It's a static const array why do you
> want to treat it as a dynamically sized one?

Because at the time, I was attempting to track down memory corruption, and I 
didn't trust that the compiler wasn't adding an extra element to the list 
(due to the last specified element ending with a comma to signify another, 
and the array size not being explicit). Ending the array with a NULL would 
gaurantee you can't overrun it in either case.



More information about the wine-devel mailing list