* Formal const to var fixes

* Hexstr(int64) added
This commit is contained in:
peter 2001-06-04 11:43:51 +00:00
parent 282c4d8f68
commit 741d455ab7
6 changed files with 109 additions and 29 deletions

View File

@ -124,7 +124,7 @@ Begin
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
}
@ -142,7 +142,7 @@ Begin
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
}
@ -154,7 +154,7 @@ Begin
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
}
@ -166,7 +166,19 @@ Begin
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
InOutRes is set
@ -190,7 +202,7 @@ Begin
If InOutRes <> 0 then
exit;
case FileRec(f).Mode of
fmInOut,fmInput :
fmInOut,fmInput :
Result:=Do_Read(FileRec(f).Handle,Longint(@Buf),count*FileRec(f).RecSize)
div FileRec(f).RecSize;
fmOutput: inOutRes := 104;
@ -212,6 +224,19 @@ Begin
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];
{
Read Count records from file f to Buf, return number of read records in
@ -385,7 +410,11 @@ End;
{
$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
}

View File

@ -132,16 +132,16 @@ Var
{Basic Socket Functions}
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 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 GetSocketName(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 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$
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
Revision 1.3 2000/09/11 14:53:14 marco

View File

@ -241,9 +241,10 @@ begin
end;
function hexstr(val : longint;cnt : byte) : shortstring;
const
HexTbl : array[0..15] of char='0123456789ABCDEF';
function hexstr(val : longint;cnt : byte) : shortstring;
var
i : longint;
begin
@ -269,6 +270,32 @@ begin
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;
begin
space[0] := chr(b);
@ -546,7 +573,11 @@ end;
{
$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
Revision 1.10 2001/04/13 18:06:28 peter

View File

@ -112,6 +112,7 @@ Type
PDWord = ^DWord;
PLongWord = ^LongWord;
PLongint = ^Longint;
PCardinal = ^Cardinal;
PQWord = ^QWord;
PInt64 = ^Int64;
@ -304,6 +305,8 @@ Function lowerCase(const s:shortstring):shortstring;
Function Space(b:byte):shortstring;
Function hexStr(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 }
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);
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: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:Integer);
Procedure BlockRead(Var f:File;Var Buf;count:Longint);
@ -497,7 +502,11 @@ const
{
$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
Revision 1.22 2001/05/16 17:44:25 jonas

View File

@ -390,7 +390,7 @@ End;
Write(Ln)
*****************************************************************************}
Procedure WriteBuffer(var f:TextRec;var b;len:longint);
Procedure WriteBuffer(var f:TextRec;const b;len:longint);
var
p : pchar;
left,
@ -1047,7 +1047,11 @@ end;
{
$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)
Revision 1.5 2001/03/21 23:29:40 florian

View File

@ -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
Send:=SocketCall(Socket_Sys_Send,Sock,Longint(@Addr),AddrLen,Flags,0,0);
end;
Function Recv(Sock:Longint;Var Addr;AddrLen,Flags:Longint):Longint;
Function Recv(Sock:Longint;Const Addr;AddrLen,Flags:Longint):Longint;
begin
Recv:=SocketCall(Socket_Sys_Recv,Sock,Longint(@Addr),AddrLen,Flags,0,0);
end;
Function Bind(Sock:Longint;Var Addr;AddrLen:Longint):Boolean;
Function Bind(Sock:Longint;Const Addr;AddrLen:Longint):Boolean;
begin
Bind:=(SocketCall(Socket_Sys_Bind,Sock,Longint(@Addr),AddrLen)=0);
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
Connect:=SocketCall(Socket_Sys_Connect,Sock,longint(@Addr),AddrLen)=0;
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
SetSocketOptions:=SocketCall(Socket_Sys_SetSockOpt,Sock,Level,OptName,Longint(@OptVal),OptLen,0);
end;
@ -262,7 +261,11 @@ end;
{
$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
solaris target