* fixed bzip2 units for big endian targets (not optimal, but simplest fix)

git-svn-id: trunk@35459 -
This commit is contained in:
Jonas Maebe 2017-02-19 22:27:49 +00:00
parent 1b42affa8f
commit 1c985f0a43
2 changed files with 16 additions and 16 deletions

View File

@ -417,7 +417,7 @@ begin
end; end;
while es>0 do while es>0 do
begin begin
tt^[t]:=n; tt^[t]:=ntole(cardinal(n));
dec(es); dec(es);
inc(t); inc(t);
end; end;
@ -462,7 +462,7 @@ begin
move_mtf_block; move_mtf_block;
end; end;
inc(cftab[seq_to_unseq[n]]); inc(cftab[seq_to_unseq[n]]);
tt^[t]:=cardinal(seq_to_unseq[n]); tt^[t]:=ntole(cardinal(seq_to_unseq[n]));
inc(t); inc(t);
if t>100000*blocksize then if t>100000*blocksize then
begin begin
@ -497,9 +497,9 @@ begin
q:=p+tt_count; q:=p+tt_count;
while p<>q do while p<>q do
begin begin
r:=@tt^[cftab[p^ and $ff]]; r:=@tt^[cftab[ntole(p^) and $ff]];
inc(cftab[p^ and $ff]); inc(cftab[ntole(p^) and $ff]);
r^:=r^ or a; r^:=r^ or ntole(a);
inc(a,256); inc(a,256);
inc(p); inc(p);
end; end;
@ -567,7 +567,7 @@ procedure Tbzip2_decode_stream.new_block;
begin begin
if decode_block then if decode_block then
nextrle:=@tt^[tt^[block_origin] shr 8] nextrle:=@tt^[ntole(tt^[block_origin]) shr 8]
else else
begin begin
error(streaderror,bzip2_endoffile); error(streaderror,bzip2_endoffile);
@ -582,7 +582,7 @@ procedure Tbzip2_decode_stream.consume_rle;inline;
begin begin
{ Pcardinal(nextrle)^:=Pcardinal(nextrle)^ shr 8;} { Pcardinal(nextrle)^:=Pcardinal(nextrle)^ shr 8;}
nextrle:=@tt^[Pcardinal(nextrle)^ shr 8]; nextrle:=@tt^[ntole(Pcardinal(nextrle)^) shr 8];
dec(decode_available); dec(decode_available);
if decode_available=0 then if decode_available=0 then
new_block; new_block;
@ -660,7 +660,7 @@ begin
error(streaderror,bzip2_endoffile); error(streaderror,bzip2_endoffile);
nextrle:=nil; nextrle:=nil;
end; end;
nextrle:=@tt^[tt^[block_origin] shr 8]; nextrle:=@tt^[ntole(tt^[block_origin]) shr 8];
end; end;
rle_read(bufptr,count); rle_read(bufptr,count);
end; end;

View File

@ -426,7 +426,7 @@ begin
error(SDecodingError,bzip2_data_error); error(SDecodingError,bzip2_data_error);
while es>0 do while es>0 do
begin begin
tt^[t]:=n; tt^[t]:=ntole(cardinal(n));
dec(es); dec(es);
inc(t); inc(t);
end; end;
@ -471,7 +471,7 @@ begin
move_mtf_block; move_mtf_block;
end; end;
inc(cftab[seq_to_unseq[n]]); inc(cftab[seq_to_unseq[n]]);
tt^[t]:=cardinal(seq_to_unseq[n]); tt^[t]:=ntole(cardinal(seq_to_unseq[n]));
inc(t); inc(t);
if t>100000*blocksize then if t>100000*blocksize then
error(SDecodingError,bzip2_data_error); error(SDecodingError,bzip2_data_error);
@ -503,9 +503,9 @@ begin
q:=p+tt_count; q:=p+tt_count;
while p<>q do while p<>q do
begin begin
r:=@tt^[cftab[p^ and $ff]]; r:=@tt^[cftab[ntole(p^) and $ff]];
inc(cftab[p^ and $ff]); inc(cftab[ntole(p^) and $ff]);
r^:=r^ or a; r^:=r^ or ntole(a);
inc(a,256); inc(a,256);
inc(p); inc(p);
end; end;
@ -563,7 +563,7 @@ Function TDecompressBzip2Stream.new_block : Boolean;
begin begin
Result:=decode_block; Result:=decode_block;
If result then If result then
nextrle:=@tt^[tt^[block_origin] shr 8] nextrle:=@tt^[ntole(tt^[block_origin]) shr 8]
else else
nextrle:=nil; nextrle:=nil;
end; end;
@ -575,7 +575,7 @@ Function TDecompressBzip2Stream.consume_rle : Boolean;inline;
begin begin
{ Pcardinal(nextrle)^:=Pcardinal(nextrle)^ shr 8;} { Pcardinal(nextrle)^:=Pcardinal(nextrle)^ shr 8;}
nextrle:=@tt^[Pcardinal(nextrle)^ shr 8]; nextrle:=@tt^[ntole(Pcardinal(nextrle)^) shr 8];
dec(decode_available); dec(decode_available);
if decode_available=0 then if decode_available=0 then
Result:=new_block Result:=new_block
@ -652,7 +652,7 @@ begin
nextrle:=nil; nextrle:=nil;
error(SDecodingError,bzip2_endoffile); error(SDecodingError,bzip2_endoffile);
end; end;
nextrle:=@tt^[tt^[block_origin] shr 8]; nextrle:=@tt^[ntole(tt^[block_origin]) shr 8];
end; end;
Result:=rle_read(bufptr,count); Result:=rle_read(bufptr,count);
end; end;