<div dir="ltr"><div>I have a change where I massively decalred the bitblt operands as unsigned int.<br></div>I did not push it so far, but I&#39;ll try to see if it solves the symptoms.<br></div><div class="gmail_extra"><br><div class="gmail_quote">2016-03-31 3:16 GMT+02:00 Levente Uzonyi <span dir="ltr">&lt;<a href="mailto:leves@caesar.elte.hu" target="_blank">leves@caesar.elte.hu</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Eliot,<br>
<br>
I made a snippet to read the source of the method as an array of integers from the .mcz in the package cache:<br>
<br>
(MCMczReader versionFromFile: &#39;package-cache/Multilingual-ul.210.mcz&#39;) snapshot definitions<br>
        detect: [ :each |<br>
                each isMethodDefinition<br>
                        and: [ each className = #JapaneseEnvironment<br>
                                and: [ each selector = #flapTabTextFor:in: ] ] ]<br>
        ifFound: [ :definition |<br>
                Array streamContents: [ :stream |<br>
                        | source |<br>
                        source := definition source.<br>
                        1 to: source size do: [ :index |<br>
                                stream nextPut: (source basicAt: index) ] ] ]<br>
        ifNone: [ self error ]<br>
<br>
In MCMczReader &gt;&gt; #loadDefinitions, if you change this line<br>
<br>
                [:m | [^definitions := (DataStream on: m contentStream) next definitions]<br>
<br>
to this<br>
<br>
                [:m | [ self error. ^definitions := (DataStream on: m contentStream) next definitions]<br>
<br>
then the definition will be read from the sources instead of the binary snapshot, and you&#39;ll get the correct source code.<br>
<br>
First I disabled all the ZipPlugin primitives to see if those are responsible for this issue, but they turned out to be okay.<br>
Then I dag into DataStream, and I came to the conclusion that the issue is in BitBlt. The mangled characters appear when PositionableStream &gt;&gt; #nextWordsInto: applies some BitBlt magic to convert the read bytes into a WideString.<br>
<br>
Here&#39;s a snippet triggering the error:<br>
<br>
| wideString source pos blt expectedWideString |<br>
source := #[1 64 255 14 1 64 48 251].<br>
expectedWideString := WideString fromByteArray: source.<br>
wideString := WideString new: source size // 4.<br>
pos := 0.<br>
blt := (BitBlt<br>
        toForm: (Form new hackBits: wideString))<br>
        sourceForm: (Form new hackBits: source).<br>
blt<br>
        combinationRule: Form over;<br>
        sourceX: 0;<br>
        sourceY: pos // 4;<br>
        height: wideString byteSize // 4;<br>
        width: 4;<br>
        destX: 0;<br>
        destY: 0;<br>
        copyBits.<br>
wideString restoreEndianness.<br>
self assert: wideString = expectedWideString<span class="HOEnZb"><font color="#888888"><br>
<br>
Levente<br>
<br>
</font></span></blockquote></div><br></div>