浏览代码

* Fix endian issue.

git-svn-id: trunk@4567 -
daniel 19 年之前
父节点
当前提交
970431d476
共有 1 个文件被更改,包括 8 次插入1 次删除
  1. 8 1
      packages/base/paszlib/gzio.pas

+ 8 - 1
packages/base/paszlib/gzio.pas

@@ -362,12 +362,19 @@ var
   c : integer;
   c : integer;
 begin
 begin
   { x := cardinal(get_byte(s));  - you can't do this with TP, no unsigned longint }
   { x := cardinal(get_byte(s));  - you can't do this with TP, no unsigned longint }
-  { the following assumes a little endian machine and TP }
+{$ifdef ENDIAN_LITTLE}
   x[0] := Byte(get_byte(s));
   x[0] := Byte(get_byte(s));
   x[1] := Byte(get_byte(s));
   x[1] := Byte(get_byte(s));
   x[2] := Byte(get_byte(s));
   x[2] := Byte(get_byte(s));
   c := get_byte(s);
   c := get_byte(s);
   x[3] := Byte(c);
   x[3] := Byte(c);
+{$else}
+  x[3] := Byte(get_byte(s));
+  x[2] := Byte(get_byte(s));
+  x[1] := Byte(get_byte(s));
+  c := get_byte(s);
+  x[0] := Byte(c);
+{$endif}
   if (c = Z_EOF) then
   if (c = Z_EOF) then
     s^.z_err := Z_DATA_ERROR;
     s^.z_err := Z_DATA_ERROR;
   GetLong := cardinal(longint(x));
   GetLong := cardinal(longint(x));