RICHED20: EM_GETTEXTEX with GT_USECRLF should not leave a single CR when running out of space

Alex Villací­s Lasso a_villacis at palosanto.com
Thu Dec 6 09:47:59 CST 2007


This was spotted while trying to fix bug #10577.

Tests show that EM_GETTEXTEX, when sent to a riched20 control with the 
GT_USECRLF flag, will refuse to write a partial CRLF at the end of the 
buffer if that would result in a single CR character at the very end of 
the buffer. That is, if the control contains "abc\r", and a buffer of 
size 5 is provided to EM_GETTEXTEX+GT_USECRLF, the buffer contents after 
the message returns should *not* be "abc\r\0" as implemented in builtin, 
but "abc\0". The attached patch fixes and tests this behavior.

Changelog:
* EM_GETTEXTEX with GT_USECRLF must refuse to truncate a trailing CRLF into
  a single CR at the end of the buffer.
* Tests for fixed behavior.

-- 
perl -e '$x=2.4;print sprintf("%.0f + %.0f = %.0f\n",$x,$x,$x+$x);'

-------------- next part --------------
A non-text attachment was scrubbed...
Name: wine-riched20-EM_GETTEXTEX-CRLF-no-truncation.patch
Type: text/x-patch
Size: 2334 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20071206/8cc88c8e/attachment-0001.bin 


More information about the wine-patches mailing list