[fpc-pascal] Code works on Linux x64 but not on Linux x86
Reinier Olislagers
reinierolislagers at gmail.com
Tue Feb 7 17:12:39 CET 2012
I have the following code, adapted from pasbzip.pas (bzip2 example)
uses ...bzip2..
const
BufferSize = 4096;
var
infile, outfile: Tbufstream;
decoder: Tbzip2_decode_stream;
a: array[1..BufferSize] of byte;
readsize: cardinal;
Status: boolean;
begin
Status := False;
result:=false;
...
try
infile.init(SourceFile, stopenread, 4096);
outfile.init(TargetFile, stcreate, 4096);
decoder.init(@infile);
if decoder.status <> stok then
begin
...
repeat
readsize := BufferSize;
decoder.Read(a, readsize);
Dec(readsize, decoder.short);
outfile.Write(a, readsize);
until decoder.status <> 0;
end;
infile.done;
outfile.done;
...
Code bombs at decoder.Read(a, readsize). readsize=0 according to debugger.
readsize=cardinal; according to help "an unsigned 32-bit integer".
However,
http://wiki.lazarus.freepascal.org/Multiplatform_Programming_Guide#32.2F64_bit
seems to imply Cardinal can vary between 32 bit and 64 bit.
Is that the culprit or am I doing anyth else wrong?
Thanks,
Reinier
More information about the fpc-pascal
mailing list