I've made the below changes to synaip and I suspect I need to release
my changes to the team and get some sort of acceptance / approval
before I use this code in a (hopefully) commercial application.

I'm not sure what version of synaip code I'm using.  The string to the
right of Project: Ararat Synapse says" 001.002.000".

I needed to use Int64 values as I'm doing some math and Integer was
not large enough.

John

{:JLR - Apr 28, 2010 - added.}
{:Convert IPv4 address from string form to large binary.}
function StrToIpBig(value: string): Int64;

{:JLR - May 2, 2010 - added.}
{:Convert IPv4 address from large binary to string form.}
function IpToStrBig(value: Int64): string;

{==============================================================================}

function StrToIpBig(value: string): Int64;
// JLR - converted above to use Int64 intergers.  April 2010.
var
 s: string;
 i, x: Integer;
begin
 Result := 0;
 for x := 0 to 3 do
 begin
   s := Fetch(value, '.');
   i := StrToIntDef(s, 0);
   Result := (256 * Result) + i;
 end;
end;

{==============================================================================}


function IpToStrBig(value: Int64): string;
// JLR - converted above to use Int64 integers.  May 2, 2010
var
 x1, x2: word;
 y1, y2: byte;
begin
 Result := '';
 x1 := value shr 16;
 x2 := value and $FFFF;
 y1 := x1 div $100;
 y2 := x1 mod $100;
 Result := inttostr(y1) + '.' + inttostr(y2) + '.';
 y1 := x2 div $100;
 y2 := x2 mod $100;
 Result := Result + inttostr(y1) + '.' + inttostr(y2);
end;

{==============================================================================}

------------------------------------------------------------------------------
The modern datacenter depends on network connectivity to access resources
and provide services. The best practices for maximizing a physical server's
connectivity to a physical network are well understood - see how these
rules translate into the virtual world? 
http://p.sf.net/sfu/oracle-sfdevnlfb
_______________________________________________
synalist-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synalist-public

Reply via email to