mORMot and Open Source friends
Check-in [1b58480d8e]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:{1737} fixed FPC 64 bit compilation for HTTP server - target not fully supported by now - thanks marius maximus for the path
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 1b58480d8e23431f6b890f95cff168afd26c6da5
User & Date: ab 2015-08-05 06:35:00
Context
2015-08-05
12:36
{1738} another FPC 64 bit compilation fix for HTTP server check-in: 653f828d99 user: ab tags: trunk
06:35
{1737} fixed FPC 64 bit compilation for HTTP server - target not fully supported by now - thanks marius maximus for the path check-in: 1b58480d8e user: ab tags: trunk
06:32
{1736} fixed LVCL compilation check-in: 1f8897dd00 user: ab tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to SynCrtSock.pas.

30
31
32
33
34
35
36

37
38
39
40
41
42
43
....
2645
2646
2647
2648
2649
2650
2651



2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
....
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
....
2690
2691
2692
2693
2694
2695
2696
2697
2698

2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
....
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
....
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
  Contributor(s):
  - Alfred Glaenzer (alf)
  - EMartin
  - Eric Grange
  - EvaF
  - Maciej Izak (hnb)

  - Pavel (mpv)

  Alternatively, the contents of this file may be used under the terms of
  either the GNU General Public License Version 2 or later (the "GPL"), or
  the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  in which case the provisions of the GPL or the LGPL are applicable instead
  of those above. If you wish to allow use of your version of this file only
................................................................................
    if Connect(result,Sin)<>0 then begin
       CloseSocket(result);
       result := -1;
    end;
  end;
end;




function OutputSock(var F: TTextRec): integer;
begin
  if F.BufPos=0 then
    result := 0 else
    if TCrtSocket(F.Handle).TrySndLow(F.BufPtr,F.BufPos) then begin
      F.BufPos := 0;
      result := 0;
    end else
      result := -1; // on socket error -> raise ioresult error
end;

function InputSock(var F: TTextRec): Integer;
................................................................................
// -> very optimized use for readln() in HTTP stream
var Size: integer;
    Sock: TCRTSocket;
begin
  F.BufEnd := 0;
  F.BufPos := 0;
  result := -1; // on socket error -> raise ioresult error
  Sock := TCrtSocket(F.Handle);
  if (Sock=nil) or (Sock.Sock=-1) then
    exit; // file closed = no socket -> error
  if Sock.TimeOut<>0 then begin // will wait for pending data?
    IOCtlSocket(Sock.Sock, FIONREAD, Size); // get exact count
    if (Size<=0) or (Size>integer(F.BufSize)) then
      Size := F.BufSize;
  end else
................................................................................
    Sock.fSockInEof := true; // error -> mark end of SockIn
    result := -WSAGetLastError();
    // result <0 will update ioresult and raise an exception if {$I+}
  end;
end;

function CloseSock(var F: TTextRec): integer;
var Sock: TCRTSocket;
begin

  Sock := TCrtSocket(F.Handle);
  if Sock<>nil then
    Sock.Close;
  F.Handle := 0; // Sock := nil
  Result := 0;
end;

function OpenSock(var F: TTextRec): integer;
begin
  F.BufPos := 0;
  F.BufEnd := 0;
................................................................................
  if (Self=nil) or (SockIn<>nil) then
    exit; // initialization already occured
  if InputBufferSize<SOCKMINBUFSIZE then
    InputBufferSize := SOCKMINBUFSIZE;
  GetMem(fSockIn,sizeof(TTextRec)+InputBufferSize);
  fillchar(SockIn^,sizeof(TTextRec),0);
  with TTextRec(SockIn^) do begin
    Handle := PtrInt(self);
    Mode := fmClosed;
    BufSize := InputBufferSize;
    BufPtr := pointer(PAnsiChar(SockIn)+sizeof(TTextRec)); // ignore Buffer[] (Delphi 2009+)
    OpenFunc := @OpenSock;
  end;
{$ifdef CONDITIONALEXPRESSIONS}
  SetLineBreakStyle(SockIn^,LineBreak); // http does break lines with #13#10
................................................................................
  if SockOut<>nil then
    exit; // initialization already occured
  if OutputBufferSize<SOCKMINBUFSIZE then
    OutputBufferSize := SOCKMINBUFSIZE;
  GetMem(fSockOut,sizeof(TTextRec)+OutputBufferSize);
  fillchar(SockOut^,sizeof(TTextRec),0);
  with TTextRec(SockOut^) do begin
    Handle := PtrInt(self);
    Mode := fmClosed;
    BufSize := OutputBufferSize;
    BufPtr := pointer(PAnsiChar(SockIn)+sizeof(TTextRec)); // ignore Buffer[] (Delphi 2009+)
    OpenFunc := @OpenSock;
  end;
{$ifdef CONDITIONALEXPRESSIONS}
  SetLineBreakStyle(SockOut^,tlbsCRLF); // force e.g. for Linux platforms






>







 







>
>
>




|







 







|







 







<

>
|
|
<
<







 







|







 







|







30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
....
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
....
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
....
2694
2695
2696
2697
2698
2699
2700

2701
2702
2703
2704


2705
2706
2707
2708
2709
2710
2711
....
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
....
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
  Contributor(s):
  - Alfred Glaenzer (alf)
  - EMartin
  - Eric Grange
  - EvaF
  - Maciej Izak (hnb)
  - Marius Maximus
  - Pavel (mpv)

  Alternatively, the contents of this file may be used under the terms of
  either the GNU General Public License Version 2 or later (the "GPL"), or
  the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  in which case the provisions of the GPL or the LGPL are applicable instead
  of those above. If you wish to allow use of your version of this file only
................................................................................
    if Connect(result,Sin)<>0 then begin
       CloseSocket(result);
       result := -1;
    end;
  end;
end;

type
  PCrtSocket = ^TCrtSocket;

function OutputSock(var F: TTextRec): integer;
begin
  if F.BufPos=0 then
    result := 0 else
    if PCrtSocket(@F.UserData)^.TrySndLow(F.BufPtr,F.BufPos) then begin
      F.BufPos := 0;
      result := 0;
    end else
      result := -1; // on socket error -> raise ioresult error
end;

function InputSock(var F: TTextRec): Integer;
................................................................................
// -> very optimized use for readln() in HTTP stream
var Size: integer;
    Sock: TCRTSocket;
begin
  F.BufEnd := 0;
  F.BufPos := 0;
  result := -1; // on socket error -> raise ioresult error
  Sock := PCrtSocket(@F.UserData)^;
  if (Sock=nil) or (Sock.Sock=-1) then
    exit; // file closed = no socket -> error
  if Sock.TimeOut<>0 then begin // will wait for pending data?
    IOCtlSocket(Sock.Sock, FIONREAD, Size); // get exact count
    if (Size<=0) or (Size>integer(F.BufSize)) then
      Size := F.BufSize;
  end else
................................................................................
    Sock.fSockInEof := true; // error -> mark end of SockIn
    result := -WSAGetLastError();
    // result <0 will update ioresult and raise an exception if {$I+}
  end;
end;

function CloseSock(var F: TTextRec): integer;

begin
  if PCrtSocket(@F.UserData)^<>nil then
    PCrtSocket(@F.UserData)^.Close;
  PCrtSocket(@F.UserData)^ := nil;


  Result := 0;
end;

function OpenSock(var F: TTextRec): integer;
begin
  F.BufPos := 0;
  F.BufEnd := 0;
................................................................................
  if (Self=nil) or (SockIn<>nil) then
    exit; // initialization already occured
  if InputBufferSize<SOCKMINBUFSIZE then
    InputBufferSize := SOCKMINBUFSIZE;
  GetMem(fSockIn,sizeof(TTextRec)+InputBufferSize);
  fillchar(SockIn^,sizeof(TTextRec),0);
  with TTextRec(SockIn^) do begin
    PCrtSocket(@UserData)^ := self;
    Mode := fmClosed;
    BufSize := InputBufferSize;
    BufPtr := pointer(PAnsiChar(SockIn)+sizeof(TTextRec)); // ignore Buffer[] (Delphi 2009+)
    OpenFunc := @OpenSock;
  end;
{$ifdef CONDITIONALEXPRESSIONS}
  SetLineBreakStyle(SockIn^,LineBreak); // http does break lines with #13#10
................................................................................
  if SockOut<>nil then
    exit; // initialization already occured
  if OutputBufferSize<SOCKMINBUFSIZE then
    OutputBufferSize := SOCKMINBUFSIZE;
  GetMem(fSockOut,sizeof(TTextRec)+OutputBufferSize);
  fillchar(SockOut^,sizeof(TTextRec),0);
  with TTextRec(SockOut^) do begin
    PCrtSocket(@UserData)^ := self;
    Mode := fmClosed;
    BufSize := OutputBufferSize;
    BufPtr := pointer(PAnsiChar(SockIn)+sizeof(TTextRec)); // ignore Buffer[] (Delphi 2009+)
    OpenFunc := @OpenSock;
  end;
{$ifdef CONDITIONALEXPRESSIONS}
  SetLineBreakStyle(SockOut^,tlbsCRLF); // force e.g. for Linux platforms

Changes to SynopseCommit.inc.

1
'1.18.1736'
|
1
'1.18.1737'