2
0
Эх сурвалжийг харах

* Formal const to var fixes
* Hexstr(int64) added

peter 24 жил өмнө
parent
commit
741d455ab7

+ 36 - 7
rtl/inc/file.inc

@@ -124,7 +124,7 @@ Begin
 End;
 End;
 
 
 
 
-Procedure BlockWrite(Var f:File;Var Buf;Count:Longint;var Result:Longint);[IOCheck];
+Procedure BlockWrite(Var f:File;Const Buf;Count:Longint;var Result:Longint);[IOCheck];
 {
 {
   Write Count records from Buf to file f, return written records in result
   Write Count records from Buf to file f, return written records in result
 }
 }
@@ -142,7 +142,7 @@ Begin
 End;
 End;
 
 
 
 
-Procedure BlockWrite(Var f:File;Var Buf;Count:Word;var Result:Word);[IOCheck];
+Procedure BlockWrite(Var f:File;Const Buf;Count:Word;var Result:Word);[IOCheck];
 {
 {
   Write Count records from Buf to file f, return written records in Result
   Write Count records from Buf to file f, return written records in Result
 }
 }
@@ -154,7 +154,7 @@ Begin
 End;
 End;
 
 
 
 
-Procedure BlockWrite(Var f:File;Var Buf;Count:Word;var Result:Integer);[IOCheck];
+Procedure BlockWrite(Var f:File;Const Buf;Count:Cardinal;var Result:Cardinal);[IOCheck];
 {
 {
   Write Count records from Buf to file f, return written records in Result
   Write Count records from Buf to file f, return written records in Result
 }
 }
@@ -166,7 +166,19 @@ Begin
 End;
 End;
 
 
 
 
-Procedure BlockWrite(Var f:File;Var Buf;Count:Longint);[IOCheck];
+Procedure BlockWrite(Var f:File;Const Buf;Count:Word;var Result:Integer);[IOCheck];
+{
+  Write Count records from Buf to file f, return written records in Result
+}
+var
+  l : longint;
+Begin
+  BlockWrite(f,Buf,Count,l);
+  Result:=l;
+End;
+
+
+Procedure BlockWrite(Var f:File;Const Buf;Count:Longint);[IOCheck];
 {
 {
   Write Count records from Buf to file f, if none a Read and Count>0 then
   Write Count records from Buf to file f, if none a Read and Count>0 then
   InOutRes is set
   InOutRes is set
@@ -190,7 +202,7 @@ Begin
   If InOutRes <> 0 then
   If InOutRes <> 0 then
    exit;
    exit;
   case FileRec(f).Mode of
   case FileRec(f).Mode of
-    fmInOut,fmInput : 
+    fmInOut,fmInput :
       Result:=Do_Read(FileRec(f).Handle,Longint(@Buf),count*FileRec(f).RecSize)
       Result:=Do_Read(FileRec(f).Handle,Longint(@Buf),count*FileRec(f).RecSize)
         div FileRec(f).RecSize;
         div FileRec(f).RecSize;
     fmOutput: inOutRes := 104;
     fmOutput: inOutRes := 104;
@@ -212,6 +224,19 @@ Begin
 End;
 End;
 
 
 
 
+Procedure BlockRead(var f:File;var Buf;count:Cardinal;var Result:Cardinal);[IOCheck];
+{
+  Read Count records from file f to Buf, return number of read records in
+  Result
+}
+var
+  l : longint;
+Begin
+  BlockRead(f,Buf,Count,l);
+  Result:=l;
+End;
+
+
 Procedure BlockRead(var f:File;var Buf;count:Word;var Result:Integer);[IOCheck];
 Procedure BlockRead(var f:File;var Buf;count:Word;var Result:Integer);[IOCheck];
 {
 {
   Read Count records from file f to Buf, return number of read records in
   Read Count records from file f to Buf, return number of read records in
@@ -385,7 +410,11 @@ End;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.2  2000-07-13 11:33:43  michael
+  Revision 1.3  2001-06-04 11:43:51  peter
+    * Formal const to var fixes
+    * Hexstr(int64) added
+
+  Revision 1.2  2000/07/13 11:33:43  michael
   + removed logs
   + removed logs
- 
+
 }
 }

+ 10 - 6
rtl/inc/socketsh.inc

@@ -132,16 +132,16 @@ Var
 
 
 {Basic Socket Functions}
 {Basic Socket Functions}
 Function Socket(Domain,SocketType,Protocol:Longint):Longint;
 Function Socket(Domain,SocketType,Protocol:Longint):Longint;
-Function Send(Sock:Longint;Var Addr;AddrLen,Flags:Longint):Longint;
-Function Recv(Sock:Longint;Var Addr;AddrLen,Flags:Longint):Longint;
-Function Bind(Sock:Longint;Var Addr;AddrLen:Longint):Boolean;
+Function Send(Sock:Longint;Const Addr;AddrLen,Flags:Longint):Longint;
+Function Recv(Sock:Longint;Const Addr;AddrLen,Flags:Longint):Longint;
+Function Bind(Sock:Longint;Const Addr;AddrLen:Longint):Boolean;
 Function Listen (Sock,MaxConnect:Longint):Boolean;
 Function Listen (Sock,MaxConnect:Longint):Boolean;
 Function Accept(Sock:Longint;Var Addr;Var Addrlen:Longint):Longint;
 Function Accept(Sock:Longint;Var Addr;Var Addrlen:Longint):Longint;
-Function Connect(Sock:Longint;Var Addr;Addrlen:Longint):boolean;
+Function Connect(Sock:Longint;Const Addr;Addrlen:Longint):boolean;
 Function Shutdown(Sock:Longint;How:Longint):Longint;
 Function Shutdown(Sock:Longint;How:Longint):Longint;
 Function GetSocketName(Sock:Longint;Var Addr;Var Addrlen:Longint):Longint;
 Function GetSocketName(Sock:Longint;Var Addr;Var Addrlen:Longint):Longint;
 Function GetPeerName(Sock:Longint;Var Addr;Var Addrlen:Longint):Longint;
 Function GetPeerName(Sock:Longint;Var Addr;Var Addrlen:Longint):Longint;
-Function SetSocketOptions(Sock,Level,OptName:Longint;Var OptVal;optlen:longint):Longint;
+Function SetSocketOptions(Sock,Level,OptName:Longint;Const OptVal;optlen:longint):Longint;
 Function GetSocketOptions(Sock,Level,OptName:Longint;Var OptVal;Var optlen:longint):Longint;
 Function GetSocketOptions(Sock,Level,OptName:Longint;Var OptVal;Var optlen:longint):Longint;
 Function SocketPair(Domain,SocketType,Protocol:Longint;var Pair:TSockArray):Longint;
 Function SocketPair(Domain,SocketType,Protocol:Longint;var Pair:TSockArray):Longint;
 
 
@@ -159,7 +159,11 @@ Function Connect(Sock:longint;const addr:TInetSockAddr;var SockIn,SockOut:file):
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.4  2000-11-13 13:40:04  marco
+  Revision 1.5  2001-06-04 11:43:51  peter
+    * Formal const to var fixes
+    * Hexstr(int64) added
+
+  Revision 1.4  2000/11/13 13:40:04  marco
    * Renamefest
    * Renamefest
 
 
   Revision 1.3  2000/09/11 14:53:14  marco
   Revision 1.3  2000/09/11 14:53:14  marco

+ 33 - 2
rtl/inc/sstrings.inc

@@ -241,9 +241,10 @@ begin
 end;
 end;
 
 
 
 
-function hexstr(val : longint;cnt : byte) : shortstring;
 const
 const
   HexTbl : array[0..15] of char='0123456789ABCDEF';
   HexTbl : array[0..15] of char='0123456789ABCDEF';
+
+function hexstr(val : longint;cnt : byte) : shortstring;
 var
 var
   i : longint;
   i : longint;
 begin
 begin
@@ -269,6 +270,32 @@ begin
 end;
 end;
 
 
 
 
+function hexstr(val : int64;cnt : byte) : shortstring;
+var
+  i : longint;
+begin
+  hexstr[0]:=char(cnt);
+  for i:=cnt downto 1 do
+   begin
+     hexstr[i]:=hextbl[val and $f];
+     val:=val shr 4;
+   end;
+end;
+
+
+function binstr(val : int64;cnt : byte) : shortstring;
+var
+  i : longint;
+begin
+  binstr[0]:=char(cnt);
+  for i:=cnt downto 1 do
+   begin
+     binstr[i]:=char(48+val and 1);
+     val:=val shr 1;
+   end;
+end;
+
+
 function space (b : byte): shortstring;
 function space (b : byte): shortstring;
 begin
 begin
   space[0] := chr(b);
   space[0] := chr(b);
@@ -546,7 +573,11 @@ end;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.11  2001-04-13 22:30:04  peter
+  Revision 1.12  2001-06-04 11:43:51  peter
+    * Formal const to var fixes
+    * Hexstr(int64) added
+
+  Revision 1.11  2001/04/13 22:30:04  peter
     * remove warnings
     * remove warnings
 
 
   Revision 1.10  2001/04/13 18:06:28  peter
   Revision 1.10  2001/04/13 18:06:28  peter

+ 14 - 5
rtl/inc/systemh.inc

@@ -112,6 +112,7 @@ Type
   PDWord              = ^DWord;
   PDWord              = ^DWord;
   PLongWord           = ^LongWord;
   PLongWord           = ^LongWord;
   PLongint            = ^Longint;
   PLongint            = ^Longint;
+  PCardinal           = ^Cardinal;
   PQWord              = ^QWord;
   PQWord              = ^QWord;
   PInt64              = ^Int64;
   PInt64              = ^Int64;
 
 
@@ -304,6 +305,8 @@ Function  lowerCase(const s:shortstring):shortstring;
 Function  Space(b:byte):shortstring;
 Function  Space(b:byte):shortstring;
 Function  hexStr(Val:Longint;cnt:byte):shortstring;
 Function  hexStr(Val:Longint;cnt:byte):shortstring;
 Function  binStr(Val:Longint;cnt:byte):shortstring;
 Function  binStr(Val:Longint;cnt:byte):shortstring;
+Function  hexStr(Val:int64;cnt:byte):shortstring;
+Function  binStr(Val:int64;cnt:byte):shortstring;
 
 
 { Char functions }
 { Char functions }
 Function  Chr(b:byte):Char;
 Function  Chr(b:byte):Char;
@@ -362,11 +365,13 @@ Procedure Rewrite(Var f:File);
 Procedure Reset(Var f:File;l:Longint);
 Procedure Reset(Var f:File;l:Longint);
 Procedure Reset(Var f:File);
 Procedure Reset(Var f:File);
 Procedure Close(Var f:File);
 Procedure Close(Var f:File);
-Procedure BlockWrite(Var f:File;Var Buf;Count:Longint;Var Result:Longint);
-Procedure BlockWrite(Var f:File;Var Buf;Count:Word;Var Result:Word);
-Procedure BlockWrite(Var f:File;Var Buf;Count:Word;Var Result:Integer);
-Procedure BlockWrite(Var f:File;Var Buf;Count:Longint);
+Procedure BlockWrite(Var f:File;Const Buf;Count:Longint;Var Result:Longint);
+Procedure BlockWrite(Var f:File;Const Buf;Count:Cardinal;var Result:Cardinal);
+Procedure BlockWrite(Var f:File;Const Buf;Count:Word;Var Result:Word);
+Procedure BlockWrite(Var f:File;Const Buf;Count:Word;Var Result:Integer);
+Procedure BlockWrite(Var f:File;Const Buf;Count:Longint);
 Procedure BlockRead(Var f:File;Var Buf;count:Longint;Var Result:Longint);
 Procedure BlockRead(Var f:File;Var Buf;count:Longint;Var Result:Longint);
+Procedure BlockRead(Var f:File;Var Buf;count:Cardinal;Var Result:Cardinal);
 Procedure BlockRead(Var f:File;Var Buf;count:Word;Var Result:Word);
 Procedure BlockRead(Var f:File;Var Buf;count:Word;Var Result:Word);
 Procedure BlockRead(Var f:File;Var Buf;count:Word;Var Result:Integer);
 Procedure BlockRead(Var f:File;Var Buf;count:Word;Var Result:Integer);
 Procedure BlockRead(Var f:File;Var Buf;count:Longint);
 Procedure BlockRead(Var f:File;Var Buf;count:Longint);
@@ -497,7 +502,11 @@ const
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.23  2001-06-03 20:17:06  peter
+  Revision 1.24  2001-06-04 11:43:51  peter
+    * Formal const to var fixes
+    * Hexstr(int64) added
+
+  Revision 1.23  2001/06/03 20:17:06  peter
     * ucs4char added
     * ucs4char added
 
 
   Revision 1.22  2001/05/16 17:44:25  jonas
   Revision 1.22  2001/05/16 17:44:25  jonas

+ 6 - 2
rtl/inc/text.inc

@@ -390,7 +390,7 @@ End;
                                Write(Ln)
                                Write(Ln)
 *****************************************************************************}
 *****************************************************************************}
 
 
-Procedure WriteBuffer(var f:TextRec;var b;len:longint);
+Procedure WriteBuffer(var f:TextRec;const b;len:longint);
 var
 var
   p   : pchar;
   p   : pchar;
   left,
   left,
@@ -1047,7 +1047,11 @@ end;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.6  2001-04-08 13:21:30  jonas
+  Revision 1.7  2001-06-04 11:43:51  peter
+    * Formal const to var fixes
+    * Hexstr(int64) added
+
+  Revision 1.6  2001/04/08 13:21:30  jonas
     * fixed potential buffer overflow in FPC_WRITE_TEXT_PCHAR_AS_ARRAY (merged)
     * fixed potential buffer overflow in FPC_WRITE_TEXT_PCHAR_AS_ARRAY (merged)
 
 
   Revision 1.5  2001/03/21 23:29:40  florian
   Revision 1.5  2001/03/21 23:29:40  florian

+ 10 - 7
rtl/linux/unixsock.inc

@@ -80,21 +80,21 @@ end;
 
 
 
 
 
 
-Function Send(Sock:Longint;Var Addr;AddrLen,Flags:Longint):Longint;
+Function Send(Sock:Longint;Const Addr;AddrLen,Flags:Longint):Longint;
 begin
 begin
   Send:=SocketCall(Socket_Sys_Send,Sock,Longint(@Addr),AddrLen,Flags,0,0);
   Send:=SocketCall(Socket_Sys_Send,Sock,Longint(@Addr),AddrLen,Flags,0,0);
 end;
 end;
 
 
 
 
 
 
-Function Recv(Sock:Longint;Var Addr;AddrLen,Flags:Longint):Longint;
+Function Recv(Sock:Longint;Const Addr;AddrLen,Flags:Longint):Longint;
 begin
 begin
   Recv:=SocketCall(Socket_Sys_Recv,Sock,Longint(@Addr),AddrLen,Flags,0,0);
   Recv:=SocketCall(Socket_Sys_Recv,Sock,Longint(@Addr),AddrLen,Flags,0,0);
 end;
 end;
 
 
 
 
 
 
-Function Bind(Sock:Longint;Var Addr;AddrLen:Longint):Boolean;
+Function Bind(Sock:Longint;Const Addr;AddrLen:Longint):Boolean;
 begin
 begin
   Bind:=(SocketCall(Socket_Sys_Bind,Sock,Longint(@Addr),AddrLen)=0);
   Bind:=(SocketCall(Socket_Sys_Bind,Sock,Longint(@Addr),AddrLen)=0);
 end;
 end;
@@ -117,8 +117,7 @@ end;
 
 
 
 
 
 
-Function Connect(Sock:Longint;Var Addr;Addrlen:Longint): boolean;
-
+Function Connect(Sock:Longint;Const Addr;Addrlen:Longint): boolean;
 begin
 begin
   Connect:=SocketCall(Socket_Sys_Connect,Sock,longint(@Addr),AddrLen)=0;
   Connect:=SocketCall(Socket_Sys_Connect,Sock,longint(@Addr),AddrLen)=0;
 end;
 end;
@@ -146,7 +145,7 @@ end;
 
 
 
 
 
 
-Function SetSocketOptions(Sock,Level,OptName:Longint;Var OptVal;optlen:longint):Longint;
+Function SetSocketOptions(Sock,Level,OptName:Longint;Const OptVal;optlen:longint):Longint;
 begin
 begin
   SetSocketOptions:=SocketCall(Socket_Sys_SetSockOpt,Sock,Level,OptName,Longint(@OptVal),OptLen,0);
   SetSocketOptions:=SocketCall(Socket_Sys_SetSockOpt,Sock,Level,OptName,Longint(@OptVal),OptLen,0);
 end;
 end;
@@ -262,7 +261,11 @@ end;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.2  2001-06-02 00:31:30  peter
+  Revision 1.3  2001-06-04 11:43:51  peter
+    * Formal const to var fixes
+    * Hexstr(int64) added
+
+  Revision 1.2  2001/06/02 00:31:30  peter
     * merge unix updates from the 1.0 branch, mostly related to the
     * merge unix updates from the 1.0 branch, mostly related to the
       solaris target
       solaris target