THRIFT-3788 Compatibility improvements and Win64 support
Client: Delphi
Patch: Jens Geyer

Revised previous patch.
diff --git a/lib/delphi/test/TestClient.pas b/lib/delphi/test/TestClient.pas
index 1980dcd..3be3218 100644
--- a/lib/delphi/test/TestClient.pas
+++ b/lib/delphi/test/TestClient.pas
@@ -19,6 +19,8 @@
 
 unit TestClient;
 
+{$I ../src/Thrift.Defines.inc}
+
 {.$DEFINE StressTest}   // activate to stress-test the server with frequent connects/disconnects
 {.$DEFINE PerfTest}     // activate to activate the performance test
 
@@ -306,7 +308,11 @@
       case endpoint of
         trns_Sockets: begin
           Console.WriteLine('Using sockets ('+host+' port '+IntToStr(port)+')');
+          {$IFDEF OLD_SOCKETS}
           streamtrans := TSocketImpl.Create( host, port );
+          {$ELSE}
+          raise Exception.Create(ENDPOINT_TRANSPORTS[endpoint]+' transport not implemented');
+          {$ENDIF}
         end;
 
         trns_Http: begin
@@ -438,9 +444,10 @@
   arg3 : IThriftDictionary<SmallInt, string>;
   arg4 : TNumberz;
   arg5 : Int64;
+  {$IFDEF PerfTest}
   StartTick : Cardinal;
   k : Integer;
-  proc : TThreadProcedure;
+  {$ENDIF}
   hello, goodbye : IXtruct;
   crazy : IInsanity;
   looney : IInsanity;
@@ -950,7 +957,7 @@
   // call time
   {$IFDEF PerfTest}
   StartTestGroup( 'Test Calltime()');
-  StartTick := GetTIckCount;
+  StartTick := GetTickCount;
   for k := 0 to 1000 - 1 do
   begin
     client.testVoid();
@@ -1172,7 +1179,8 @@
     // We have a failed test!
     // -> issue DebugBreak ONLY if a debugger is attached,
     // -> unhandled DebugBreaks would cause Windows to terminate the app otherwise
-    if IsDebuggerPresent then asm int 3 end;
+    if IsDebuggerPresent
+    then {$IFDEF CPUX64} DebugBreak {$ELSE} asm int 3 end {$ENDIF};
   end;
 end;
 
diff --git a/lib/delphi/test/TestServer.pas b/lib/delphi/test/TestServer.pas
index 018282c..e3576dd 100644
--- a/lib/delphi/test/TestServer.pas
+++ b/lib/delphi/test/TestServer.pas
@@ -19,6 +19,7 @@
 
 unit TestServer;
 
+{$I ../src/Thrift.Defines.inc}
 {$WARN SYMBOL_PLATFORM OFF}
 
 {.$DEFINE RunEndless}   // activate to interactively stress-test the server stop routines via Ctrl+C
@@ -657,11 +658,15 @@
       trns_Sockets : begin
         Console.WriteLine('- sockets (port '+IntToStr(port)+')');
         if (trns_Buffered in layered) then Console.WriteLine('- buffered');
+        {$IFDEF OLD_SOCKETS}
         servertrans := TServerSocketImpl.Create( Port, 0, (trns_Buffered in layered));
+        {$ELSE}
+        raise Exception.Create(ENDPOINT_TRANSPORTS[endpoint]+' server transport not implemented');
+        {$ENDIF}
       end;
 
       trns_Http : begin
-        raise Exception.Create('HTTP server transport not implemented');
+        raise Exception.Create(ENDPOINT_TRANSPORTS[endpoint]+' server transport not implemented');
       end;
 
       trns_NamedPipes : begin
diff --git a/lib/delphi/test/client.dpr b/lib/delphi/test/client.dpr
index 69e44c2..1297aaa 100644
--- a/lib/delphi/test/client.dpr
+++ b/lib/delphi/test/client.dpr
@@ -44,19 +44,19 @@
   args : array of string;
   i : Integer;
   arg : string;
-  s : string;
 
 begin
   try
     Writeln( 'Delphi TestClient '+Thrift.Version);
     nParamCount := ParamCount;
     SetLength( args, nParamCount);
-    for i := 1 to nParamCount do
-    begin
+    for i := 1 to nParamCount do begin
       arg := ParamStr( i );
       args[i-1] := arg;
     end;
+
     ExitCode := TTestClient.Execute( args);
+
   except
     on E: EAbort do begin
       ExitCode := $FF;
diff --git a/lib/delphi/test/server.dpr b/lib/delphi/test/server.dpr
index d532e34..4d623f3 100644
--- a/lib/delphi/test/server.dpr
+++ b/lib/delphi/test/server.dpr
@@ -44,19 +44,19 @@
   args : array of string;
   i : Integer;
   arg : string;
-  s : string;
 
 begin
   try
     Writeln( 'Delphi TestServer '+Thrift.Version);
     nParamCount := ParamCount;
     SetLength( args, nParamCount);
-    for i := 1 to nParamCount do
-    begin
+    for i := 1 to nParamCount do begin
       arg := ParamStr( i );
       args[i-1] := arg;
     end;
+
     TTestServer.Execute( args );
+
   except
     on E: EAbort do begin
       ExitCode := $FF;