From: DeaDDooMER Date: Sun, 6 Oct 2019 20:41:59 +0000 (+0300) Subject: fix network on big-endian machines X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=d8d321d9c14f9737beb8bf9b41125f3c1f4b6fe6;p=d2df-sdl.git fix network on big-endian machines --- diff --git a/src/engine/e_msg.pas b/src/engine/e_msg.pas index 6a6ca61..f5711ec 100644 --- a/src/engine/e_msg.pas +++ b/src/engine/e_msg.pas @@ -177,31 +177,37 @@ end; procedure TMsg.Write(V: Word); overload; begin + V := NtoLE(V); WriteData(@V, 2); end; procedure TMsg.Write(V: LongWord); overload; begin + V := NtoLE(V); WriteData(@V, 4); end; procedure TMsg.Write(V: ShortInt); overload; begin + V := NtoLE(V); WriteData(@V, 1); end; procedure TMsg.Write(V: SmallInt); overload; begin + V := NtoLE(V); WriteData(@V, 2); end; procedure TMsg.Write(V: LongInt); overload; begin + V := NtoLE(V); WriteData(@V, 4); end; procedure TMsg.Write(V: Int64); overload; begin + V := NtoLE(V); WriteData(@V, 8); end; @@ -279,36 +285,42 @@ function TMsg.ReadWord(): Word; begin Result := 0; ReadData(@Result, 2); + Result := LEtoN(Result); end; function TMsg.ReadLongWord(): LongWord; begin Result := 0; ReadData(@Result, 4); + Result := LEtoN(Result); end; function TMsg.ReadShortInt(): ShortInt; begin Result := 0; ReadData(@Result, 1); + Result := LEtoN(Result); end; function TMsg.ReadSmallInt(): SmallInt; begin Result := 0; ReadData(@Result, 2); + Result := LEtoN(Result); end; function TMsg.ReadLongInt(): LongInt; begin Result := 0; ReadData(@Result, 4); + Result := LEtoN(Result); end; function TMsg.ReadInt64(): Int64; begin Result := 0; ReadData(@Result, 8); + Result := LEtoN(Result); end; function TMsg.ReadString(): string;