Browse Source

* 64-bit ID for 64-bit platforms

Michaël Van Canneyt 4 years ago
parent
commit
9b8a6438c7

+ 6 - 2
packages/fcl-web/src/base/fphttpserver.pp

@@ -62,7 +62,7 @@ Type
 
 
   TFPHTTPConnection = Class(TObject)
   TFPHTTPConnection = Class(TObject)
   private
   private
-    Class var _ConnectionCount : Cardinal;
+    Class var _ConnectionCount : {$IFDEF CPU64}QWord{$ELSE}Cardinal{$ENDIF};
   private
   private
     FBusy: Boolean;
     FBusy: Boolean;
     FConnectionID: String;
     FConnectionID: String;
@@ -990,7 +990,11 @@ begin
   if Assigned(IDAllocator) then
   if Assigned(IDAllocator) then
     IDAllocator(FConnectionID);
     IDAllocator(FConnectionID);
   if FConnectionID='' then
   if FConnectionID='' then
-    FConnectionID:=IntToStr(InterlockedIncrement(_ConnectionCount))
+{$IFDEF CPU64}
+    FConnectionID:=IntToStr(InterlockedIncrement64(_ConnectionCount));
+{$ELSE}
+    FConnectionID:=IntToStr(InterlockedIncrement(_ConnectionCount));
+{$ENDIF}
 end;
 end;
 
 
 procedure TFPHTTPConnection.DoHandleRequest;
 procedure TFPHTTPConnection.DoHandleRequest;

+ 6 - 3
packages/fcl-web/src/base/httpdefs.pp

@@ -445,7 +445,7 @@ type
 
 
   TRequest = class(THttpHeader)
   TRequest = class(THttpHeader)
   Private
   Private
-    class var _RequestCount : Cardinal;
+    class var _RequestCount : {$IFDEF CPU64}QWord{$ELSE}Cardinal{$ENDIF};
   private
   private
     FCommand: String;
     FCommand: String;
     FCommandLine: String;
     FCommandLine: String;
@@ -2209,8 +2209,11 @@ begin
   if Assigned(IDAllocator) then
   if Assigned(IDAllocator) then
     IDAllocator(FRequestID);
     IDAllocator(FRequestID);
   if FRequestID='' then
   if FRequestID='' then
-    FRequestID:=IntToStr(InterlockedIncrement(_RequestCount))
-
+{$IFDEF CPU64}
+    FRequestID:=IntToStr(InterlockedIncrement64(_RequestCount));
+{$ELSE}
+    FRequestID:=IntToStr(InterlockedIncrement(_RequestCount));
+{$ENDIF}
 end;
 end;
 
 
 function TRequest.AllowReadContent: Boolean;
 function TRequest.AllowReadContent: Boolean;