On 20/09/2021 23:36, Jacek Caban wrote:
Hi Gabriel,
On 9/20/21 4:46 PM, Gabriel Ivăncescu wrote:
+ memcpy(tmp, prefix, sizeof(prefix)); + p = tmp + ARRAY_SIZE(prefix); + if(*str) { + *p++ = *str++; /* copy first uppercase char */ + while(*str) + *p++ = tolower(*str++); + } + memcpy(p, suffix, sizeof(suffix));
This is very fragile, it would use "HTMLIframeElement" for example. We could probably store a name of the object in dispex_static_data_t.
Thanks,
Jacek
But where would we even get the name from? In HTMLElement_Create, get_tag_desc is used for specific tags, which is similar, but the "fallback" goes to HTMLGenericElement_Create, since not all tags are included there. For example the "div" tag is not.
What do you think about using get_tag_desc instead (in toString), and extending that table to handle all supported tags? (of course, for "generic" tags, I'll use a NULL constructor).
Unless there's a better way to retrieve its name I'm not aware of? I don't think it's needed to store it in dispex_static_data_t if we can just look it up on demand though.
Thanks, Gabriel