cross-platform compress & decompress

Wouter wouter.abraham at
Tue Dec 2 07:48:35 EST 2003

On 02 Dec 2003, at 03:38, use-revolution-request at wrote:

> Message: 4
> Date: Mon, 1 Dec 2003 16:36:59 -0800
> From: Mark Brownell <gizmotron at>
> Subject: Re: cross-platform compress & decompress
> To: How to use Revolution <use-revolution at>
> Message-ID: <A4055414-245F-11D8-8671-000A95859272 at>
> Content-Type: text/plain; charset=US-ASCII; format=flowed


> I have tried compressing and decompressing the whole file as the first
> test. I tried compressing the data from a variable as a second test.
> I've looked at the same data in a text editor on both platforms and I
> did a comparison of charToNum() of the compressed data on both
> platforms. This was the exact same problem I had with blowfish I think.
> I solved it by constricting cross-platform data transfers to less than
> ascii 127; even though the data can represent up to ascii 255. My
> blowfish algorithm does it all as numerical values until the final
> rendering. I had to drop binaryEncode() & binaryDecode() in order to
> get numerical only results within the process. That's why I think it's
> something like upper ascii character values across platforms.

The < put binaryDecode("N",str,halfBlock) into numConverted >
in your blowfish handler can produce an unsigned integer on
the Windows platform where as on the Mac a signed integer is
  produced. This is probably an engine related problem.
To test this try the following on both platforms and compare:

on mouseUp
   put num2char("169,170,171,172") into x
   ## N - decode signed four-byte integers in network order
   put binaryDecode("N",x,halfBlock1) into numConverted
   ## I - decode unsigned four-byte integers in host order
   put binaryDecode("I",x,halfBlock2) into numConverted
   put halfblock1 && halfblock2
end mouseUp

function num2char sx
   repeat for each item i in sx
     put numtochar(i)  after z
   end repeat
   return z
end num2char


More information about the Use-livecode mailing list