Re: Tab control TCM_SETITEMEXTRA (bugzilla #1046)
Jon Griffiths <jon_p_griffiths(a)yahoo.com> writes:
@@ -2557,8 +2562,10 @@ infoPtr->items[iItem].iImage = pti->iImage;
if (pti->mask & TCIF_PARAM) - infoPtr->items[iItem].lParam = pti->lParam; - + memcpy(&infoPtr->items[iItem].lParam, &pti->lParam, infoPtr->cbInfo); + else + memset(&infoPtr->items[iItem].lParam, 0, infoPtr->cbInfo);
That doesn't look right at all, lParam is not at the end of the structure. And the variable-size info should really be a byte array or something similar, not an LPARAM. -- Alexandre Julliard julliard(a)winehq.org
Hi,
That doesn't look right at all, lParam is not at the end of the structure.
Mybad, fixed in updated patch sent to wine-patches.
And the variable-size info should really be a byte array or something similar, not an LPARAM.
It makes no difference; hardly anyone changes the the extra space and by default it's declared as an LPARAM in the TCITEM struct. If I declare it as BYTE[1] we still need to subtract its size and add in cBytes so the TAB_ITEM_SIZE() macros is still needed. And the default initialisation will still use sizeof(LPARAM) anyway. Cheers, Jon ===== "Don't wait for the seas to part, or messiahs to come; Don't you sit around and waste this chance..." - Live jon_p_griffiths(a)yahoo.com __________________________________ Do you Yahoo!? Friends. Fun. Try the all-new Yahoo! Messenger. http://messenger.yahoo.com/
Jon Griffiths <jon_p_griffiths(a)yahoo.com> writes:
It makes no difference; hardly anyone changes the the extra space and by default it's declared as an LPARAM in the TCITEM struct. If I declare it as BYTE[1] we still need to subtract its size and add in cBytes so the TAB_ITEM_SIZE() macros is still needed. And the default initialisation will still use sizeof(LPARAM) anyway.
It makes a big difference in code readability. It's pretty clear that a BYTE[1] array is a variable size thing; nobody expects an LPARAM to be variable size. Yes, Microsoft got it wrong in TCITEM, but that's not a reason to make the same mistake in our internal structures. -- Alexandre Julliard julliard(a)winehq.org
It makes a big difference in code readability.
I disagree, but for two lines of code, who cares. I've sent a new version to wine-patches. Cheers, Jon ===== "Don't wait for the seas to part, or messiahs to come; Don't you sit around and waste this chance..." - Live jon_p_griffiths(a)yahoo.com __________________________________ Do you Yahoo!? Friends. Fun. Try the all-new Yahoo! Messenger. http://messenger.yahoo.com/
On June 4, 2004 01:36 am, Jon Griffiths wrote:
It makes a big difference in code readability.
I disagree, but for two lines of code, who cares. I've sent a new version to wine-patches.
I agree with Alexandre. Putting char buffer[1] at the end of a structure is a standard technique for expandable structures.
Cheers, Jon
===== "Don't wait for the seas to part, or messiahs to come; Don't you sit around and waste this chance..." - Live
jon_p_griffiths(a)yahoo.com
__________________________________ Do you Yahoo!? Friends. Fun. Try the all-new Yahoo! Messenger. http://messenger.yahoo.com/
-- Bill Medland mailto:billmedland(a)mercuryspeed.com http://webhome.idirect.com/~kbmed
participants (3)
-
Alexandre Julliard -
Bill Medland -
Jon Griffiths