<br><br><div class="gmail_quote">On Tue, Nov 9, 2010 at 7:30 PM, David T. Lewis <span dir="ltr">&lt;<a href="mailto:lewis@mail.msen.com">lewis@mail.msen.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
On Mon, Nov 08, 2010 at 06:41:57PM -0800, Andreas Raab wrote:<br>
<div class="im">&gt;<br>
&gt; On 11/8/2010 5:08 PM, Levente Uzonyi wrote:<br>
&gt; &gt;The problem is that the method expects ByteStrings as arguments, but it<br>
&gt; &gt;won&#39;t fail if one of them is a WideString. Instead it returns wrong<br>
&gt; &gt;results. Here&#39;s an example (in Squeak):<br>
&gt; &gt;<br>
&gt; &gt;ByteString new<br>
&gt; &gt;findSubstring: &#39;b&#39;<br>
&gt; &gt;in: &#39;abc&#39; asWideString<br>
&gt; &gt;startingAt: 1<br>
&gt; &gt;matchTable: ((0 to: 255) as: ByteArray). &quot;===&gt; 0&quot;<br>
&gt; &gt;<br>
&gt; &gt;The result is 0, while it should be 2. The problem is worked around in<br>
&gt; &gt;Squeak by making sure that the primitive is not used in this case.<br>
&gt; &gt;<br>
&gt; &gt;&#39;abc&#39; asWideString<br>
&gt; &gt;findString: &#39;b&#39;<br>
&gt; &gt;startingAt: 1<br>
&gt; &gt;caseSensitive: true. &quot;===&gt; 2&quot;<br>
&gt; &gt;<br>
&gt; &gt;Though a naive user can still use the method as shown here.<br>
&gt;<br>
</div>&gt; Thanks. Looks like a problem in extracting string arguments in<br>
&gt; translated primitives. With Squeaksource being down again (should we<br>
&gt; move VMMaker to <a href="http://source.squeak.org" target="_blank">source.squeak.org</a>?) I&#39;ve attached a change set with a<br>
&gt; fix. This adds an additional check for char* arguments in translated<br>
&gt; prims to ensure that they&#39;re actually byte objects.<br>
<br>
Andreas,<br>
<br>
Your fix does indeed resolve the underlying problem. I added it<br>
to VMMaker (with a note to Eliot to do likewise with oscog), and<br>
also added unit tests based on Levente&#39;s example. This should<br>
allow the various WideString workarounds to be removed once the<br>
updated VMs are in circulation.<br></blockquote><div><br></div><div>OK, it&#39;s in my working version.  It&#39;ll percolate out to oscog soon.</div><div><br></div><div>Thanks!</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<br>
Thanks,<br>
Dave<br>
<br>
</blockquote></div><br>