hedgewars/uIO.pas
changeset 6453 11c578d30bd3
parent 6247 6dfad55fd71c
child 6580 6155187bf599
--- a/hedgewars/uIO.pas	Sun Nov 27 19:34:08 2011 +0300
+++ b/hedgewars/uIO.pas	Sun Nov 27 23:13:22 2011 +0300
@@ -142,8 +142,7 @@
 procedure IPCCheckSock;
 const ss: shortstring = '';
 var i: LongInt;
-    buf: array[0..255] of byte;
-    s: shortstring absolute buf;
+    s: shortstring;
 begin
 if IPCSock = nil then
    exit;
@@ -153,10 +152,10 @@
 
 while SDLNet_CheckSockets(fds, 0) > 0 do
     begin
-    i:= SDLNet_TCP_Recv(IPCSock, @buf[1], 255 - Length(ss));
+    i:= SDLNet_TCP_Recv(IPCSock, @s[1], 255 - Length(ss));
     if i > 0 then
         begin
-        buf[0]:= i;
+        s[0]:= char(i);
         ss:= ss + s;
         while (Length(ss) > 1) and (Length(ss) > byte(ss[1])) do
             begin
@@ -171,8 +170,7 @@
 var f: file;
     ss: shortstring = '';
     i: LongInt;
-    buf: array[0..255] of byte;
-    s: shortstring absolute buf;
+    s: shortstring;
 begin
 
 // set RDNLY on file open
@@ -184,12 +182,12 @@
 tryDo(IOResult = 0, 'Error opening file ' + fileName, true);
 
 i:= 0; // avoid compiler hints
-buf[0]:= 0;
+s[0]:= #0;
 repeat
-    BlockRead(f, buf[1], 255 - Length(ss), i);
+    BlockRead(f, s[1], 255 - Length(ss), i);
     if i > 0 then
         begin
-        buf[0]:= i;
+        s[0]:= char(i);
         ss:= ss + s;
         while (Length(ss) > 1)and(Length(ss) > byte(ss[1])) do
             begin
@@ -315,7 +313,7 @@
             end;
         'b': begin
             s:= copy(headcmd^.str, 2, Pred(headcmd^.len));
-            ParseCommand('chatmsg '#4 + s, true);
+            ParseCommand('chatmsg ' + #4 + s, true);
             WriteLnToConsole(s)
             end;
 // TODO: deprecate 'F'