Thanks Juan, I made the updates to the Smalltalk source (VMMaker and VMMaker.oscog packages) and pushed the generated C code to the github and SVN repositories.

CC to the vm-dev list for info.

Dave


On 2024-03-18 18:16, Juan Vuletich via Cuis-dev wrote:

Hi Dave,

On 3/18/2024 12:35 PM, lewis--- via Cuis-dev wrote:

 Hi Juan,

On 2024-03-17 18:17, Juan Vuletich via Cuis-dev wrote:

Hi Dave,

On 3/16/2024 6:22 PM, lewis--- via Cuis-dev wrote:As I said in a separate email, Vanessa found the origin of the problem, and the fix is now at GitHub.

Still, as you say, the primitive fails, both in Cuis and Squeak, but only the first time it is called. The lines are read in reverse order, so the line that is first copied is actually the last one.

In #read24BmpLine:into:startingAt:width:, at the start of the fallback code, I added this line: `{formBitsIndex+width. formBits size} print.`. Then tried to load Hilaire's BMP. In the Transcript I got #(63601 63600). So, in BMPReadWriterPlugin.c, the lines that read:

    if (!(((formBitsIndex + width) <= formBitsSize)
         && ((width * 3) <= pixelLineSize))) {
        return primitiveFail();

should actually read

    if (!(((formBitsIndex + width - 1) <= formBitsSize)
         && ((width * 3) <= pixelLineSize))) {
        return primitiveFail();

and the primitive will not fail.

It is a minor bug, with no practical consequences, so this is not really important. But I found this while investigating the BMP read failure, and I thought it was worth commenting.

Thanks,


The expression appears in both BMPReadWriterPlugin>>primitiveRead24BmpLine and BMPReadWriterPlugin>>primitiveWrite24BmpLine. Can you please confirm my assumption that the same fix should be applied to both methods? Sorry if this is obvious but I just want to be sure.

Thanks!

Dave


Yep. Checking the code in both methods it is pretty clear that they are analogous. In any case, I did some quick testing, and in both cases the primitive fails exactly once and for the same value of the parameters. The tweak should be same in both cases.

Thanks!
-- 
Juan Vuletich
cuis.st
github.com/jvuletich
researchgate.net/profile/Juan-Vuletich
independent.academia.edu/JuanVuletich
patents.justia.com/inventor/juan-manuel-vuletich
linkedin.com/in/juan-vuletich-75611b3
twitter.com/JuanVuletich