Re: [PATCH 3/3] mshtml: Added support for indexed access to form elements
Jacek Caban <jacek(a)codeweavers.com> writes:
+ /* FIXME: Implement in more generic and safe way */ + for(ptr = name; *ptr && isdigitW(*ptr); ptr++) + i = i*10 + (*ptr-'0');
What's wrong with strtoulW? -- Alexandre Julliard julliard(a)winehq.org
On 3/3/11 2:45 PM, Alexandre Julliard wrote:
Jacek Caban<jacek(a)codeweavers.com> writes:
+ /* FIXME: Implement in more generic and safe way */ + for(ptr = name; *ptr&& isdigitW(*ptr); ptr++) + i = i*10 + (*ptr-'0'); What's wrong with strtoulW?
We don't want to use strings like "+1" or with leasing spaces for indexed access. The comment was more about considering moving it to IDispatchEx implementation layer than parsing itself. BTW, it's a really broken design of IDispatchEx. When a scripts accesses property by integer index, the integer is converted to string and passed to GetDispID, which parses it back. Thanks, Jacek
Jacek Caban <jacek(a)codeweavers.com> writes:
On 3/3/11 2:45 PM, Alexandre Julliard wrote:
Jacek Caban<jacek(a)codeweavers.com> writes:
+ /* FIXME: Implement in more generic and safe way */ + for(ptr = name; *ptr&& isdigitW(*ptr); ptr++) + i = i*10 + (*ptr-'0'); What's wrong with strtoulW?
We don't want to use strings like "+1" or with leasing spaces for indexed access.
You can check the first character before passing it to strtoulW, that would already be better than doing it all by hand. Note that isdigitW won't do the right thing, not all Unicode digits are between '0' and '9'. -- Alexandre Julliard julliard(a)winehq.org
participants (2)
-
Alexandre Julliard -
Jacek Caban