<div dir="ltr"><div>Attaching a fix. Not entirely sure what the right process to submit fixes is, this is my first. Apparently you use git but not pull requests?</div><div><br></div><div dir="ltr">Anyways, the error happened because the code used </div><div dir="ltr"> stream nextInto: pixelLine</div><div dir="ltr">which calls "next:into:startingAt:" which does not read across chunk boundaries from the file primitive.</div><div dir="ltr"><br></div><div>My fix changes the code to use </div><div> stream readInto: pixelLine startingAt: 1 count: pixelLine size<br></div><div dir="ltr">which uses "nextBytes:into:startingAt:" which reads across chunk boundaries by fetching more contents from the file.</div><div dir="ltr"><br></div><div>In Squeak, "nextInto:" calls "readInto:startingAt:count:<span class="gmail-Apple-converted-space">" that's why it keeps working there.</span></div><div><br></div><div dir="ltr"><div>Vanessa </div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Mar 16, 2024 at 4:30 PM Vanessa Freudenberg <<a href="mailto:vanessa@codefrau.net">vanessa@codefrau.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">FWIW, dropping <span style="font-family:Verdana,Geneva,sans-serif">splash.bmp into Cuis-6.2 running on SqueakJS works just fin</span><span style="font-family:Verdana,Geneva,sans-serif">e (try here: </span><a href="https://tinyurl.com/squeakjs-cuis62" target="_blank">https://tinyurl.com/squeakjs-cuis62</a>)</div><div dir="ltr"><span style="font-family:Verdana,Geneva,sans-serif"><br></span></div><div><span style="font-family:Verdana,Geneva,sans-serif">As does Dave's expression.</span></div><div dir="ltr"><span style="font-family:Verdana,Geneva,sans-serif"><br></span></div><div><span style="font-family:Verdana,Geneva,sans-serif">SqueakJS does not have </span>BMPReadWriterPlugin so the primitive fails. The fallback code works fine.</div><div dir="ltr"><span style="font-family:Verdana,Geneva,sans-serif"><br></span></div><div><span style="font-family:Verdana,Geneva,sans-serif">Vanessa</span></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Mar 16, 2024 at 2:28 PM lewis--- via Cuis-dev <<a href="mailto:cuis-dev@lists.cuis.st" target="_blank">cuis-dev@lists.cuis.st</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div style="font-size:10pt;font-family:Verdana,Geneva,sans-serif">
<p>Hi Hilaire,</p>
<p>I compared the behavior in Squeak with both opensmalltalk-vm and with V3 interpreter VM.</p>
<p>In Squeak:<br>ImageReadWriter formFromFileNamed: 'splash.bmp'. "==> Form(400x300x32)"</p>
<p>In Cuis (with the same VM):<br>ImageReadWriter formFromFileEntry: 'splash.bmp' asFileEntry. "==> Error"</p>
<p>I see two possible issues here.<br>1) The call to #primitiveRead24BmpLine is failing in both Squeak and Cuis. This may be a problem in the VM plugin (or maybe it is expected in this case, I am not sure).</p>
<p>2) In the primitive fallback code in method #read24BmpLine:into:startingAt:width: the error happens at the "formBits at: (bitsIndex := bitsIndex+1) put: rgb". The formBits is a BitMap, so maybe the some difference between Squeak and Cuis here.</p>
<p>I also tried Squeak with a V3 image and interpreter VM, and the results are the same as with opensmalltalk-vm. The form is created successfully, and the #primitiveRead24BmpLine call fails and goes to the fallback code.</p>
<p>At this point I cannot say if there primitive failure is a problem in the VM plugin, or if the primitive failure is normal and expected for this particular case. But I can say that the actual Error in Cuis must be something related to the fallback code when it updates the formBits BitMap.</p>
<p>Dave</p>
<div id="m_1896589774351999418m_-166946647409118544signature"></div>
<p><br></p>
<p id="m_1896589774351999418m_-166946647409118544reply-intro">On 2024-03-16 18:47, Hilaire Fernandes via Cuis-dev wrote:</p>
<blockquote type="cite" style="padding:0px 0.4em;border-left-width:2px;border-left-style:solid;border-left-color:rgb(16,16,255);margin:0px">
<div id="m_1896589774351999418m_-166946647409118544replybody1">
<div>
<p><span style="font-size:large">Hi folks, <br></span></p>
<p><span style="font-size:large">It looks like the BMP reader is broken.</span></p>
<p><span style="font-size:large">ImageReadWriter formFromFileEntry: 'splash.bmp'.<br></span></p>
<p><span style="font-size:large">Could it be a VM issue? Seem to occure in a plugin. I am not forwarding to VM mailing list for now, waiting for more advices.<br></span></p>
<p><span style="font-size:large">See screen capture and bmp example known to load previously.<br></span></p>
<pre>--
GNU Dr. Geo
<a href="http://gnu.org/s/dr-geo/" rel="noopener noreferrer" target="_blank">http://gnu.org/s/dr-geo/</a>
<a href="http://gnu-drgeo.blogspot.com/" rel="noopener noreferrer" target="_blank">http://gnu-drgeo.blogspot.com/</a></pre>
</div>
</div>
<br>
<div style="margin:0px;padding:0px;font-family:monospace"> </div>
</blockquote>
</div>
-- <br>
Cuis-dev mailing list<br>
<a href="mailto:Cuis-dev@lists.cuis.st" target="_blank">Cuis-dev@lists.cuis.st</a><br>
<a href="https://lists.cuis.st/mailman/listinfo/cuis-dev" rel="noreferrer" target="_blank">https://lists.cuis.st/mailman/listinfo/cuis-dev</a><br>
</blockquote></div></div>
</blockquote></div></div>