[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wine-devel
Subject:    RE: FW: Edit Paste operation does not behave same as MS Windows
From:       Krishna Murthy <Krishna.Murthy () guptaworldwide ! com>
Date:       2004-05-28 1:31:52
Message-ID: 37801DCF8DF6D111AA3800A0C9B3CCB704F2A555 () hqexchange ! centurasoft ! com
[Download RAW message or body]

This means it is sufficient to return FALSE in EDIT_MakeFit if the honor
limit is not set and size exceeds the buffer limit? 

static BOOL EDIT_MakeFit(EDITSTATE *es, UINT size, BOOL honor_limit)
{
	HLOCAL hNew32W;

	if ((!honor_limit) && (es->buffer_limit > 0) && (size >
es->buffer_limit)) {
		EDIT_NOTIFY_PARENT(es, EN_MAXTEXT, "EN_MAXTEXT");
		return FALSE;
	}
... 
}

I will verify with this change and if works in all condition, will submit
the patch.
Thanks for your help,
Krishna


-----Original Message-----
From: Alexandre Julliard [mailto:julliard@winehq.org] 
Sent: Thursday, May 27, 2004 5:12 PM
To: Krishna Murthy
Cc: wine-devel@winehq.org
Subject: Re: FW: Edit Paste operation does not behave same as MS Windows

Krishna Murthy <Krishna.Murthy@guptaworldwide.com> writes:

> Actually the logic truncates the data which exceeded the buffer. If 
> the honor limit is set and the size exceeded, the EDIT_MakeFit will return
TRUE.
> The following code after the EDIT_MakeFit will try to take limit to 
> the buffer size.
>
> +	/* Only replace or insert that many characters that can fit into the
> +	edit control. Do this only if honor_limit is TRUE */
> +	if(honor_limit && strl > es->buffer_limit)
> +		strl = es->buffer_limit - (tl - (e-s));

That only takes into account the limit, not the current buffer size. It's
very possible that you need to grow the buffer even when the limit is not
exceeded. Also you only check the length of the inserted string against the
limit, you should check the total resulting length instead.

--
Alexandre Julliard
julliard@winehq.org

[Attachment #3 (text/html)]

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2653.12">
<TITLE>RE: FW: Edit Paste operation does not behave same as MS Windows</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=2>This means it is sufficient to return FALSE in EDIT_MakeFit if the \
honor limit is not set and size exceeds the buffer limit? </FONT></P>

<P><FONT SIZE=2>static BOOL EDIT_MakeFit(EDITSTATE *es, UINT size, BOOL \
honor_limit)</FONT> <BR><FONT SIZE=2>{</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2>HLOCAL hNew32W;</FONT>
</P>

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2>if ((!honor_limit) \
&amp;&amp; (es-&gt;buffer_limit &gt; 0) &amp;&amp; (size &gt; es-&gt;buffer_limit)) \
{</FONT> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2>EDIT_NOTIFY_PARENT(es, \
EN_MAXTEXT, &quot;EN_MAXTEXT&quot;);</FONT> \
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2>return FALSE;</FONT> \
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2>}</FONT> <BR><FONT \
SIZE=2>... </FONT> <BR><FONT SIZE=2>}</FONT>
</P>

<P><FONT SIZE=2>I will verify with this change and if works in all condition, will \
submit the patch.</FONT> <BR><FONT SIZE=2>Thanks for your help,</FONT>
<BR><FONT SIZE=2>Krishna</FONT>
</P>
<BR>

<P><FONT SIZE=2>-----Original Message-----</FONT>
<BR><FONT SIZE=2>From: Alexandre Julliard [<A \
HREF="mailto:julliard@winehq.org">mailto:julliard@winehq.org</A>] </FONT> <BR><FONT \
SIZE=2>Sent: Thursday, May 27, 2004 5:12 PM</FONT> <BR><FONT SIZE=2>To: Krishna \
Murthy</FONT> <BR><FONT SIZE=2>Cc: wine-devel@winehq.org</FONT>
<BR><FONT SIZE=2>Subject: Re: FW: Edit Paste operation does not behave same as MS \
Windows</FONT> </P>

<P><FONT SIZE=2>Krishna Murthy &lt;Krishna.Murthy@guptaworldwide.com&gt; \
writes:</FONT> </P>

<P><FONT SIZE=2>&gt; Actually the logic truncates the data which exceeded the buffer. \
If </FONT> <BR><FONT SIZE=2>&gt; the honor limit is set and the size exceeded, the \
EDIT_MakeFit will return TRUE.</FONT> <BR><FONT SIZE=2>&gt; The following code after \
the EDIT_MakeFit will try to take limit to </FONT> <BR><FONT SIZE=2>&gt; the buffer \
size.</FONT> <BR><FONT SIZE=2>&gt;</FONT>
<BR><FONT SIZE=2>&gt; +&nbsp;&nbsp;&nbsp;&nbsp; /* Only replace or insert that many \
characters that can fit into the</FONT> <BR><FONT SIZE=2>&gt; \
+&nbsp;&nbsp;&nbsp;&nbsp; edit control. Do this only if honor_limit is TRUE */</FONT> \
<BR><FONT SIZE=2>&gt; +&nbsp;&nbsp;&nbsp;&nbsp; if(honor_limit &amp;&amp; strl &gt; \
es-&gt;buffer_limit)</FONT> <BR><FONT SIZE=2>&gt; +&nbsp;&nbsp;&nbsp;&nbsp; \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strl = es-&gt;buffer_limit - (tl - \
(e-s));</FONT> </P>

<P><FONT SIZE=2>That only takes into account the limit, not the current buffer size. \
It's very possible that you need to grow the buffer even when the limit is not \
exceeded. Also you only check the length of the inserted string against the limit, \
you should check the total resulting length instead.</FONT></P>

<P><FONT SIZE=2>--</FONT>
<BR><FONT SIZE=2>Alexandre Julliard</FONT>
<BR><FONT SIZE=2>julliard@winehq.org</FONT>
</P>

</BODY>
</HTML>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic