comctl32: cchTextMax needs to be set for LVS_OWNERDATA as it uses LVN_GETDISPINFO notifications

Jeff Latimer lats at yless4u.com.au
Sat Jan 2 17:24:16 CST 2010


On 03/01/10 08:29, Jeff Latimer wrote:
> On 03/01/10 01:12, Nikolay Sivov wrote:
>> On 1/2/2010 13:52, Jeff Latimer wrote:
>>> On 02/01/10 21:34, Nikolay Sivov wrote:
>>>> On 1/2/2010 12:48, Jeff Latimer wrote:
>>>>> ---
>>>>>  dlls/comctl32/listview.c |    1 +
>>>>>  1 files changed, 1 insertions(+), 0 deletions(-)
>>>>
>>>>> +    dispInfo.item.cchTextMax = textlenT(pszText, isW)+2;
>>>> What does this '2' mean?
>>> +1 adds the trailing null and +2 allows for the original text to be 
>>> greater than the edited text.
>> I'm ok with +1 probably, but what about comparison? Why can't it be 
>> greater without this change?
>>> I thought that one extra byte would allow the test to complete in 
>>> all cases.
>> Don't know about tests, but it looks like you're hiding a real 
>> problem with this change.
> I not sure what you mean here.  My thinking is that the existing text 
> is X characters long.  The new text will be Y.  If X is greater that Y 
> (ie. the new text has had the trailing characters deleted) then all I 
> need is to prove that there is one extra character in the existing 
> text to continue through to the update.  Given this, I don't need to 
> go to the expense of calculating the exact value of X as it is not 
> necessary.
Rereading MSDN, +1 will probably work ok.  If the buffer is short then 
the characters copied will not contain the terminating null, hence will 
not match but one won't be a string.  Will develop a test.



More information about the wine-devel mailing list