X-Git-Url: http://www.lcore.org/git/lcore.git/blobdiff_plain/e27ef2c6aab3a2a8051314bd37bb3b2386775f36..cda2e4bba1a2bc9bd3e48076f236ac843086aff3:/binipstuff.pas?ds=inline

diff --git a/binipstuff.pas b/binipstuff.pas
index ae3d23a..d622029 100644
--- a/binipstuff.pas
+++ b/binipstuff.pas
@@ -4,25 +4,28 @@
   ----------------------------------------------------------------------------- }
 unit binipstuff;
 
+{$ifdef fpc}
+{$mode delphi}
+{$endif}
+
 interface
 
 {$include lcoreconfig.inc}
 
 uses
-  {$ifndef win32}{$ifdef ipv6}sockets,{$endif}{$endif}
+{$ifndef mswindows}
+  sockets,
+{$endif}
   pgtypes;
 
-{$ifdef fpc}
-  {$mode delphi}
-{$endif}
-{$ifdef cpu386}{$define i386}{$endif}
-{$ifdef i386}{$define ENDIAN_LITTLE}{$endif}
+
+{$include pgtypes.inc}
 
 {$include uint32.inc}
 
 const
   hexchars:array[0..15] of ansichar='0123456789abcdef';
-  {$ifdef win32}
+  {$ifdef mswindows}
     AF_INET=2;
     AF_INET6=23;
   {$else}
@@ -36,7 +39,7 @@ const
 type
   {$ifdef ipv6}
     
-    {$ifdef win32}
+    {$ifdef mswindows}
       {$define want_Tin6_addr}
     {$endif}
     {$ifdef ver1_0}
@@ -67,7 +70,7 @@ type
     {$endif}
   end;
 
-  {$ifdef win32}
+  {$ifdef mswindows}
     TInetSockAddr = packed Record
       family:Word;
       port  :Word;
@@ -331,7 +334,7 @@ written by beware
 
 - implementation does not depend on other ipv6 code such as the tin6_addr type,
   the parameter can also be untyped.
-- it is host endian neutral - binary format is aways network order
+- it is host endian neutral - binary format is always network order
 - it supports compression of zeroes
 - it supports ::ffff:192.168.12.34 style addresses
 - they are made to do the Right Thing, more efficient implementations are possible
@@ -382,6 +385,13 @@ begin
       end;
     end;
   end;
+
+  {run length at least 2 0 words}
+  if (runlength = 1) then begin
+    runlength := 0;
+    runbegin := 0;
+  end;
+
   result := '';
   for a := 0 to runbegin-1 do begin
     if (a <> 0) then result := result + ':';