Parcourir la source

--- Merging r21726 into '.':
U rtl/unix/ipc.pp
U rtl/linux/unxsockh.inc
--- Merging r21738 into '.':
U rtl/win/crt.pp
--- Merging r21740 into '.':
U packages/fcl-process/src/os2/pipes.inc
U packages/fcl-process/src/unix/pipes.inc
U packages/fcl-process/src/wince/process.inc
U packages/fcl-process/src/dummy/pipes.inc
U packages/fcl-process/src/process.pp
U packages/fcl-process/src/win/process.inc
U packages/fcl-process/src/win/pipes.inc
U packages/fcl-process/src/pipes.pp
--- Merging r21810 into '.':
U rtl/objpas/strutils.pp
--- Merging r21873 into '.':
U packages/fcl-base/src/custapp.pp
--- Merging r21874 into '.':
U packages/winunits-base/src/comobj.pp
--- Merging r21881 into '.':
U packages/fcl-base/src/eventlog.pp
--- Merging r21925 into '.':
U rtl/unix/crt.pp
A tests/webtbs/tw20880.pp

# revisions: 21726,21738,21740,21810,21873,21874,21881,21925
r21726 | sergei | 2012-06-27 22:04:39 +0200 (Wed, 27 Jun 2012) | 1 line
Changed paths:
M /trunk/rtl/linux/unxsockh.inc
M /trunk/rtl/unix/ipc.pp

- Removed level 2 comments and control characters in comments.
r21738 | marco | 2012-06-30 15:23:26 +0200 (Sat, 30 Jun 2012) | 1 line
Changed paths:
M /trunk/rtl/win/crt.pp

* crtwrite didn't handle buffer writes > 255 chars properly, and the textrec buffer is 256 currently (and has been since svn history start). Mantis #22334
r21740 | marco | 2012-06-30 17:47:24 +0200 (Sat, 30 Jun 2012) | 2 lines
Changed paths:
M /trunk/packages/fcl-process/src/dummy/pipes.inc
M /trunk/packages/fcl-process/src/os2/pipes.inc
M /trunk/packages/fcl-process/src/pipes.pp
M /trunk/packages/fcl-process/src/process.pp
M /trunk/packages/fcl-process/src/unix/pipes.inc
M /trunk/packages/fcl-process/src/win/pipes.inc
M /trunk/packages/fcl-process/src/win/process.inc
M /trunk/packages/fcl-process/src/wince/process.inc

* make pipesize a property. Mantis #22327, patch by Cyrax.
r21810 | joost | 2012-07-07 10:12:07 +0200 (Sat, 07 Jul 2012) | 1 line
Changed paths:
M /trunk/rtl/objpas/strutils.pp

* Added ReplaceStr and ReplaceText functions, for Delphi compatibility
r21873 | michael | 2012-07-11 17:08:13 +0200 (Wed, 11 Jul 2012) | 1 line
Changed paths:
M /trunk/packages/fcl-base/src/custapp.pp

* Added option to fetch all errors
r21874 | michael | 2012-07-11 17:15:28 +0200 (Wed, 11 Jul 2012) | 1 line
Changed paths:
M /trunk/packages/winunits-base/src/comobj.pp

* Patch from Ludo Brands to fix late binding for com servers (bug 22378)
r21881 | michael | 2012-07-11 18:51:50 +0200 (Wed, 11 Jul 2012) | 1 line
Changed paths:
M /trunk/packages/fcl-base/src/eventlog.pp

* Fixed bug ID #22045
r21925 | jonas | 2012-07-17 20:03:23 +0200 (Tue, 17 Jul 2012) | 3 lines
Changed paths:
M /trunk/rtl/unix/crt.pp
A /trunk/tests/webtbs/tw20880.pp

* send full x/y ansi position information in case of an X-coordinate
overflow (don't know what the y-coordinate is at that point, because the
window may be wider than the artificial screenwidth) (mantis #20880)

git-svn-id: branches/fixes_2_6@22315 -

marco il y a 13 ans
Parent
commit
79e0f4727d

+ 1 - 0
.gitattributes

@@ -11906,6 +11906,7 @@ tests/webtbs/tw2069.pp svneol=native#text/plain
 tests/webtbs/tw20690.pp svneol=native#text/pascal
 tests/webtbs/tw2072.pp svneol=native#text/plain
 tests/webtbs/tw20873.pp svneol=native#text/plain
+tests/webtbs/tw20880.pp -text svneol=native#text/plain
 tests/webtbs/tw21029.pp svneol=native#text/plain
 tests/webtbs/tw21073.pp svneol=native#text/plain
 tests/webtbs/tw2109.pp svneol=native#text/plain

+ 28 - 20
packages/fcl-base/src/custapp.pp

@@ -62,10 +62,10 @@ Type
     Function GetOptionValue(Const C: Char; Const S : String) : String;
     Function HasOption(Const S : String) : Boolean;
     Function HasOption(Const C : Char; Const S : String) : Boolean;
-    Function CheckOptions(Const ShortOptions : String; Const Longopts : TStrings; Opts,NonOpts : TStrings) : String;
-    Function CheckOptions(Const ShortOptions : String; Const Longopts : TStrings) : String;
-    Function CheckOptions(Const ShortOptions : String; Const LongOpts : Array of string) : String;
-    Function CheckOptions(Const ShortOptions : String; Const LongOpts : String) : String;
+    Function CheckOptions(Const ShortOptions : String; Const Longopts : TStrings; Opts,NonOpts : TStrings; AllErrors : Boolean = False) : String;
+    Function CheckOptions(Const ShortOptions : String; Const Longopts : TStrings; AllErrors : Boolean = False) : String;
+    Function CheckOptions(Const ShortOptions : String; Const LongOpts : Array of string; AllErrors : Boolean = False) : String;
+    Function CheckOptions(Const ShortOptions : String; Const LongOpts : String; AllErrors : Boolean = False) : String;
     Procedure GetEnvironmentList(List : TStrings;NamesOnly : Boolean);
     Procedure GetEnvironmentList(List : TStrings);
     Procedure Log(EventType : TEventType; const Msg : String);
@@ -390,10 +390,10 @@ begin
 end;
 
 
-Function TCustomApplication.CheckOptions(Const ShortOptions : String; Const Longopts : TStrings) : String;
+Function TCustomApplication.CheckOptions(Const ShortOptions : String; Const Longopts : TStrings; AllErrors : Boolean = False) : String;
 
 begin
-  Result:=CheckOptions(ShortOptions,LongOpts,Nil,Nil);
+  Result:=CheckOptions(ShortOptions,LongOpts,Nil,Nil,AllErrors);
 end;
 
 ResourceString
@@ -401,7 +401,7 @@ ResourceString
   SErrNoOptionAllowed = 'Option at position %d does not allow an argument: %s';
   SErrOptionNeeded = 'Option at position %d needs an argument : %s';
 
-Function TCustomApplication.CheckOptions(Const ShortOptions : String; Const Longopts : TStrings; Opts,NonOpts : TStrings) : String;
+Function TCustomApplication.CheckOptions(Const ShortOptions : String; Const Longopts : TStrings; Opts,NonOpts : TStrings; AllErrors : Boolean = False) : String;
 
 Var
   I,J,L,P : Integer;
@@ -430,6 +430,14 @@ Var
     Result:=(I<>-1);
   end;
 
+  Procedure AddToResult(Const Msg : string);
+  
+  begin
+    If (Result<>'') then
+      Result:=Result+sLineBreak;
+    Result:=Result+Msg;  
+  end;
+
 begin
   If CaseSensitiveOptions then
     SO:=Shortoptions
@@ -437,7 +445,7 @@ begin
     SO:=LowerCase(Shortoptions);
   Result:='';
   I:=1;
-  While (I<=ParamCount) and (Result='') do
+  While (I<=ParamCount) and ((Result='') or AllErrors) do
     begin
     O:=Paramstr(I);
     If (Length(O)=0) or (O[1]<>FOptionChar) then
@@ -448,7 +456,7 @@ begin
     else
       begin
       If (Length(O)<2) then
-        Result:=Format(SErrInvalidOption,[i,O])
+        AddToResult(Format(SErrInvalidOption,[i,O]))
       else
         begin
         HaveArg:=False;
@@ -469,19 +477,19 @@ begin
           If FindLongopt(O) then
             begin
             If HaveArg then
-              Result:=Format(SErrNoOptionAllowed,[I,O])
+              AddToResult(Format(SErrNoOptionAllowed,[I,O]))
             end
           else
             begin // Required argument
             If FindLongOpt(O+':') then
               begin
               If Not HaveArg then
-                Result:=Format(SErrOptionNeeded,[I,O]);
+                AddToResult(Format(SErrOptionNeeded,[I,O]));
               end
             else
               begin // Optional Argument.
               If not FindLongOpt(O+'::') then
-                Result:=Format(SErrInvalidOption,[I,O]);
+                AddToResult(Format(SErrInvalidOption,[I,O]));
               end;
             end;
           end
@@ -494,11 +502,11 @@ begin
             O:=LowerCase(O);
           L:=Length(O);
           J:=2;
-          While (result='') and (J<=L) do
+          While ((Result='') or AllErrors) and (J<=L) do
             begin
             P:=Pos(O[J],ShortOptions);
             If (P=0) or (O[j]=':') then
-              Result:=Format(SErrInvalidOption,[I,O[J]])
+              AddToResult(Format(SErrInvalidOption,[I,O[J]]))
             else
               begin
               If (P<Length(ShortOptions)) and (Shortoptions[P+1]=':') then
@@ -506,7 +514,7 @@ begin
                 // Required argument
                 If ((P+1)=Length(ShortOptions)) or (Shortoptions[P+2]<>':') Then
                   If (J<L) or not haveArg then // Must be last in multi-opt !!
-                    Result:=Format(SErrOptionNeeded,[I,O[J]]);
+                    AddToResult(Format(SErrOptionNeeded,[I,O[J]]));
                 O:=O[j]; // O is added to arguments.
                 end;
               end;
@@ -518,7 +526,7 @@ begin
             O:=O[Length(O)]; // O is added to arguments !
             end;
           end;
-        If HaveArg and (Result='') then
+        If HaveArg and ((Result='') or AllErrors) then
           If Assigned(Opts) then
             Opts.Add(O+'='+OV);
         end;
@@ -527,7 +535,7 @@ begin
     end;
 end;
 
-Function TCustomApplication.CheckOptions(Const ShortOptions : String; Const LongOpts : Array of string) : String;
+Function TCustomApplication.CheckOptions(Const ShortOptions : String; Const LongOpts : Array of string; AllErrors : Boolean = False) : String;
 
 Var
   L : TStringList;
@@ -538,13 +546,13 @@ begin
   Try
     For I:=0 to High(LongOpts) do
       L.Add(LongOpts[i]);
-    Result:=CheckOptions(ShortOptions,L);
+    Result:=CheckOptions(ShortOptions,L,AllErrors);
   Finally
     L.Free;
   end;
 end;
 
-Function TCustomApplication.CheckOptions(Const ShortOptions : String; Const LongOpts : String) : String;
+Function TCustomApplication.CheckOptions(Const ShortOptions : String; Const LongOpts : String; AllErrors : Boolean = False) : String;
 
 Const
   SepChars = ' '#10#13#9;
@@ -569,7 +577,7 @@ begin
         L.Add(Copy(LongOpts,I,(J-I)));
       I:=J+1;
       end;
-    Result:=CheckOptions(Shortoptions,L);
+    Result:=CheckOptions(Shortoptions,L,AllErrors);
   Finally
     L.Free;
   end;

+ 2 - 0
packages/fcl-base/src/eventlog.pp

@@ -275,6 +275,8 @@ begin
 
   fFileFlags := fFileFlags or fmShareDenyWrite;
   FStream:=TFileStream.Create(FFileName,fFileFlags);
+  if fAppendContent then
+    FStream.Seek(0,soFromEnd);
 end;
 
 Procedure TEventLog.DeActivateFileLog;

+ 1 - 1
packages/fcl-process/src/dummy/pipes.inc

@@ -15,7 +15,7 @@
 
 // No pipes under dos, sorry...
 
-Function CreatePipeHandles (Var Inhandle,OutHandle : THandle) : Boolean;
+Function CreatePipeHandles (Var Inhandle,OutHandle : THandle; APipeBufferSize : Cardinal = 1024) : Boolean;
 
 begin
   InHandle := THandle (UnusedHandle);

+ 2 - 2
packages/fcl-process/src/os2/pipes.inc

@@ -19,10 +19,10 @@ uses
 const
  PipeBufSize = 1024;
 
-Function CreatePipeHandles (Var Inhandle,OutHandle : Longint) : Boolean;
+Function CreatePipeHandles (Var Inhandle,OutHandle : Longint; APipeBufferSize : Cardinal = 1024) : Boolean;
 
 begin
-  CreatePipeHandles := DosCreatePipe (InHandle, OutHandle, PipeBufSize) = 0;
+  CreatePipeHandles := DosCreatePipe (InHandle, OutHandle, APipeBufferSize) = 0;
 end;
 
 Function TInputPipeStream.GetNumBytesAvailable: DWord;

+ 1 - 1
packages/fcl-process/src/pipes.pp

@@ -50,7 +50,7 @@ Type
       Function Read (Var Buffer; Count : Longint) : longint; Override;
     end;
 
-Function CreatePipeHandles (Var Inhandle,OutHandle : THandle) : Boolean;
+Function CreatePipeHandles (Var Inhandle,OutHandle : THandle; APipeBufferSize : Cardinal = 1024) : Boolean;
 Procedure CreatePipeStreams (Var InPipe : TInputPipeStream;
                              Var OutPipe : TOutputPipeStream);
 

+ 2 - 0
packages/fcl-process/src/process.pp

@@ -78,6 +78,7 @@ Type
     dwYcountChars,
     dwy : Cardinal;
     FXTermProgram: String;
+    FPipeBufferSize : cardinal;
     Procedure FreeStreams;
     Function  GetExitStatus : Integer;
     Function  GetRunning : Boolean;
@@ -134,6 +135,7 @@ Type
     property OnForkEvent : TProcessForkEvent Read FForkEvent Write FForkEvent;
     {$endif UNIX}
   Published
+    property PipeBufferSize : cardinal read FPipeBufferSize write FPipeBufferSize default 1024;
     Property Active : Boolean Read GetRunning Write SetActive;
     Property ApplicationName : String Read FApplicationName Write SetApplicationName; deprecated;
     Property CommandLine : String Read FCommandLine Write SetCommandLine ; deprecated;

+ 1 - 1
packages/fcl-process/src/unix/pipes.inc

@@ -16,7 +16,7 @@
 Uses
   BaseUnix, Unix, TermIO;
 
-Function CreatePipeHandles (Var Inhandle,OutHandle : Longint) : Boolean;
+Function CreatePipeHandles (Var Inhandle,OutHandle : Longint; APipeBufferSize : Cardinal = 1024) : Boolean;
 
 begin
   Result := (AssignPipe (Inhandle,OutHandle)<>-1);

+ 2 - 2
packages/fcl-process/src/win/pipes.inc

@@ -28,10 +28,10 @@ Const piInheritablePipe : TSecurityAttributes = (
       PipeBufSize = 1024;
 
 
-Function CreatePipeHandles (Var Inhandle,OutHandle : THandle) : Boolean;
+Function CreatePipeHandles (Var Inhandle,OutHandle : THandle; APipeBufferSize : Cardinal = PipeBufSize) : Boolean;
 
 begin
-  Result := CreatePipe (@Inhandle,@OutHandle,@piNonInheritablePipe,PipeBufSize);
+  Result := CreatePipe (@Inhandle,@OutHandle,@piNonInheritablePipe,APipeBufferSize);
 end;
 
 

+ 5 - 5
packages/fcl-process/src/win/process.inc

@@ -179,15 +179,15 @@ begin
 end;
 
 
-Procedure CreatePipes(Var HI,HO,HE : Thandle; Var SI : TStartupInfo; CE : Boolean);
+Procedure CreatePipes(Var HI,HO,HE : Thandle; Var SI : TStartupInfo; CE : Boolean; APipeBufferSize : Cardinal);
 
 begin
-  CreatePipeHandles(SI.hStdInput,HI);
+  CreatePipeHandles(SI.hStdInput,HI, APipeBufferSize);
   DuplicateHandleFP(SI.hStdInput);
-  CreatePipeHandles(HO,Si.hStdOutput);
+  CreatePipeHandles(HO,Si.hStdOutput, APipeBufferSize);
   DuplicateHandleFP(   Si.hStdOutput);
   if CE then begin
-    CreatePipeHandles(HE,SI.hStdError);
+    CreatePipeHandles(HE,SI.hStdError, APipeBufferSize);
     DuplicateHandleFP(   SI.hStdError);
     end
   else
@@ -262,7 +262,7 @@ begin
     InitThreadAttributes(Self,FThreadAttributes);
     InitStartupInfo(Self,FStartUpInfo);
     If poUsePipes in FProcessOptions then
-      CreatePipes(HI,HO,HE,FStartupInfo,Not(poStdErrToOutPut in FProcessOptions));
+      CreatePipes(HI,HO,HE,FStartupInfo,Not(poStdErrToOutPut in FProcessOptions), FPipeBufferSize);
     Try
       If Not CreateProcess (PName,PCommandLine,@FProcessAttributes,@FThreadAttributes,
                    FInheritHandles,FCreationFlags,FEnv,PDir,FStartupInfo,

+ 5 - 5
packages/fcl-process/src/wince/process.inc

@@ -152,13 +152,13 @@ begin
      end;
 end;
 
-Procedure CreatePipes(Var HI,HO,HE : Thandle; Var SI : TStartupInfo; CE : Boolean);
+Procedure CreatePipes(Var HI,HO,HE : Thandle; Var SI : TStartupInfo; CE : Boolean; APipeBufferSize : Cardinal);
 
 begin
-  CreatePipeHandles(SI.hStdInput,HI);
-  CreatePipeHandles(HO,Si.hStdOutput);
+  CreatePipeHandles(SI.hStdInput,HI,APipeBufferSize);
+  CreatePipeHandles(HO,Si.hStdOutput,APipeBufferSize);
   if CE then
-    CreatePipeHandles(HE,SI.hStdError)
+    CreatePipeHandles(HE,SI.hStdError,APipeBufferSize)
   else
     begin
     SI.hStdError:=SI.hStdOutput;
@@ -213,7 +213,7 @@ begin
     InitThreadAttributes(Self,FThreadAttributes);
     InitStartupInfo(Self,FStartUpInfo);
     If poUsePipes in FProcessOptions then
-      CreatePipes(HI,HO,HE,FStartupInfo,Not(poStdErrToOutPut in FProcessOptions));
+      CreatePipes(HI,HO,HE,FStartupInfo,Not(poStdErrToOutPut in FProcessOptions),FPipeBufferSize);
     Try
       If Not CreateProcess (PName,PCommandLine,@FProcessAttributes,@FThreadAttributes,
                    FInheritHandles,FCreationFlags,FEnv,PDir,@FStartupInfo,

+ 39 - 5
packages/winunits-base/src/comobj.pp

@@ -216,6 +216,7 @@ unit comobj;
       TTypedComObjectFactory = class(TComObjectFactory)
       private
         FClassInfo: ITypeInfo;
+        FTypeInfoCount:integer;
       public
         constructor Create(AComServer: TComServerObject; TypedComClass: TTypedComClass; const AClassID: TGUID;
           AInstancing: TClassInstancing; AThreadingModel: TThreadingModel = tmSingle);
@@ -241,9 +242,15 @@ unit comobj;
 
       { TAutoObjectFactory }
       TAutoObjectFactory = class(TTypedComObjectFactory)
+      private
+        FDispIntfEntry: PInterfaceEntry;
+        FDispTypeInfo: ITypeInfo;
       public
         constructor Create(AComServer: TComServerObject; AutoClass: TAutoClass; const AClassID: TGUID;
           AInstancing: TClassInstancing; AThreadingModel: TThreadingModel = tmSingle);
+        function GetIntfEntry(Guid: TGUID): PInterfaceEntry; virtual;
+        property DispIntfEntry: PInterfaceEntry read FDispIntfEntry;
+        property DispTypeInfo: ITypeInfo read FDispTypeInfo;
       end;
 
       { TAutoIntfObject }
@@ -1477,6 +1484,7 @@ HKCR
         OleCheck(FClassInfo.GetDocumentation(-1, @TypedName, @TypedDescription, nil, nil));
         FClassInfo.GetTypeAttr(ppTypeAttr);
         try
+          FTypeInfoCount := ppTypeAttr^.cImplTypes;
           TypedVersion := '';
           if (ppTypeAttr^.wMajorVerNum <> 0) or (ppTypeAttr^.wMinorVerNum <> 0) then
           begin
@@ -1493,9 +1501,22 @@ HKCR
 
 
     function TTypedComObjectFactory.GetInterfaceTypeInfo(TypeFlags: Integer): ITypeInfo;
+    var
+      index, ImplTypeFlags: Integer;
+      RefType: HRefType;
+    begin
+      Result := nil;
+      for index := 0 to FTypeInfoCount - 1 do
       begin
-        RunError(217);
+        OleCheck(ClassInfo.GetImplTypeFlags(index, ImplTypeFlags));
+        if ImplTypeFlags = TypeFlags then
+        begin
+          OleCheck(ClassInfo.GetRefTypeOfImplType(index, RefType));
+          OleCheck(ClassInfo.GetRefTypeInfo(RefType, Result));
+          break;
+        end;
       end;
+    end;
 
 
     procedure TTypedComObjectFactory.UpdateRegistry(Register: Boolean);
@@ -1677,10 +1698,9 @@ HKCR
           Result := DISP_E_UNKNOWNINTERFACE
         else
         begin
-      //  Function  Invoke(pvInstance: Pointer; memid: MEMBERID; wFlags: WORD; VAR pDispParams: DISPPARAMS; OUT pVarResult: VARIANT; OUT pExcepInfo: EXCEPINFO; OUT puArgErr: UINT):HResult;StdCall;
-      //  Result := fTypeInfo.Invoke(IDispatch(Self), DispID, Flags, TDispParams(params), PVariant(VarResult)^, PExcepInfo(ExcepInfo)^, PUINT(ArgErr)^);
-          OleCheck(QueryInterface(TAutoObjectFactory(Factory).ClassID, fInterfacePointer));
-          Result := TAutoObjectFactory(Factory).ClassInfo.Invoke(fInterfacePointer, DispID, Flags, TDispParams(params), PVariant(VarResult)^, PExcepInfo(ExcepInfo)^, PUINT(ArgErr)^);
+          Result := TAutoObjectFactory(Factory).DispTypeInfo.Invoke(Pointer(
+            Integer(Self) + TAutoObjectFactory(Factory).DispIntfEntry^.IOffset),
+            DispID, Flags, TDispParams(Params), PVariant(VarResult)^, PExcepInfo(ExcepInfo)^, PUINT(ArgErr)^);
         end;
       end;
 
@@ -1689,10 +1709,24 @@ HKCR
     constructor TAutoObjectFactory.Create(AComServer: TComServerObject;
       AutoClass: TAutoClass; const AClassID: TGUID; AInstancing: TClassInstancing;
       AThreadingModel: TThreadingModel);
+         var
+           ppTypeAttr: lpTYPEATTR;
       begin
         inherited Create(AComServer, AutoClass, AClassID, AInstancing, AThreadingModel);
+        FDispTypeInfo := GetInterfaceTypeInfo(IMPLTYPEFLAG_FDEFAULT);
+        OleCheck(FDispTypeInfo.GetTypeAttr(ppTypeAttr));
+        try
+          FDispIntfEntry := GetIntfEntry(ppTypeAttr^.guid);
+        finally
+          FDispTypeInfo.ReleaseTypeAttr(ppTypeAttr);
+        end;
       end;
 
+    function TAutoObjectFactory.GetIntfEntry(Guid: TGUID): PInterfaceEntry;
+    begin
+      Result := FComClass.GetInterfaceEntry(Guid);
+    end;
+
 
     procedure TOleStream.Check(err:integer);
       begin

+ 5 - 5
rtl/linux/unxsockh.inc

@@ -170,10 +170,10 @@ Const
          IPPROTO_RAW     = 255;       { Raw IP packets.  }
          IPPROTO_MAX     = 255;
 //from /usr/include/bits/in.h
-{{ Options for use with etsockopt' and etsockopt' at the IP level.
+{ Options for use with getsockopt' and setsockopt' at the IP level.
    The first word in the comment at the right is the data type used;
-   "bool" means a boolean value stored in an 	nt'.  }
-}
+   "bool" means a boolean value stored in an int'.  }
+
         IP_OPTIONS              = 4;               { ip_opts; IP per-packet options.  }
         IP_HDRINCL              = 3;               { int; Header is included with data.  }
         IP_TOS                  = 1;               { int; IP type of service and precedence.  }
@@ -227,9 +227,9 @@ Const
         IP_MAX_MEMBERSHIPS       = 20;
 
 
-{  Options for use with etsockopt' and etsockopt' at the IPv6 level.
+{  Options for use with getsockopt' and setsockopt' at the IPv6 level.
    The first word in the comment at the right is the data type used;
-   "bool" means a boolean value stored in an 	nt'.  }
+   "bool" means a boolean value stored in an int'.  }
         IPV6_ADDRFORM         = 1;
         IPV6_PKTINFO             = 2;
         IPV6_HOPOPTS             = 3;

+ 21 - 0
rtl/objpas/strutils.pp

@@ -96,6 +96,13 @@ Function PosEx(const SubStr, S: string): Integer;inline; // Offset: Cardinal = 1
 Function PosEx(c:char; const S: string; Offset: Cardinal): Integer;
 function StringsReplace(const S: string; OldPattern, NewPattern: array of string;  Flags: TReplaceFlags): string;
 
+{ ---------------------------------------------------------------------
+    Delphi compat
+  ---------------------------------------------------------------------}
+
+Function ReplaceStr(const AText, AFromText, AToText: string): string;inline;
+Function ReplaceText(const AText, AFromText, AToText: string): string;inline;
+
 { ---------------------------------------------------------------------
     Soundex Functions.
   ---------------------------------------------------------------------}
@@ -744,6 +751,20 @@ begin
   Result := ResStr;
 end;
 
+{ ---------------------------------------------------------------------
+    Delphi compat
+  ---------------------------------------------------------------------}
+
+Function ReplaceStr(const AText, AFromText, AToText: string): string;inline;
+begin
+  AnsiReplaceStr(AText, AFromText, AToText);
+end;
+
+Function ReplaceText(const AText, AFromText, AToText: string): string;inline;
+begin
+  AnsiReplaceText(AText, AFromText, AToText);
+end;
+
 { ---------------------------------------------------------------------
     Soundex Functions.
   ---------------------------------------------------------------------}

+ 4 - 1
rtl/unix/crt.pp

@@ -112,7 +112,10 @@ Function XY2Ansi(x,y,ox,oy:longint):String;
   Returns a string with the escape sequences to go to X,Y on the screen
 }
 Begin
-  if y=oy then
+  { in case of potential ox overflow, send full position information
+    (mantis #20880) }
+  if (y=oy) and
+     (ox<>$ff) then
    begin
      if x=ox then
       begin

+ 6 - 6
rtl/unix/ipc.pp

@@ -431,12 +431,12 @@ const
   SEM_UNDO = 1 shl 12;
   MAX_SOPS = 5;
 
-  SEM_GETNCNT = 3;   { Return the value of sempid {READ}  }
-  SEM_GETPID  = 4;   { Return the value of semval {READ}  }
-  SEM_GETVAL  = 5;   { Return semvals into arg.array {READ}  }
-  SEM_GETALL  = 6;   { Return the value of semzcnt {READ}  }
-  SEM_GETZCNT = 7;   { Set the value of semval to arg.val {ALTER}  }
-  SEM_SETVAL  = 8;   { Set semvals from arg.array {ALTER}  }
+  SEM_GETNCNT = 3;   { Return the value of sempid (READ)  }
+  SEM_GETPID  = 4;   { Return the value of semval (READ)  }
+  SEM_GETVAL  = 5;   { Return semvals into arg.array (READ)  }
+  SEM_GETALL  = 6;   { Return the value of semzcnt (READ)  }
+  SEM_GETZCNT = 7;   { Set the value of semval to arg.val (ALTER)  }
+  SEM_SETVAL  = 8;   { Set semvals from arg.array (ALTER)  }
   SEM_SETALL  = 9;
 
   { Permissions  }

+ 8 - 1
rtl/win/crt.pp

@@ -711,7 +711,14 @@ begin
         WriteChar(f.buffer[i]);
       end
     else
-      s:=s+f.buffer[i];
+      begin
+        if length(s)=255 then
+          begin
+            WriteStr(s);
+            s:='';
+          end;
+        s:=s+f.buffer[i];
+      end;
   if s<>'' then
     WriteStr(s);
   SetScreenCursor(CurrX, CurrY);

+ 21 - 0
tests/webtbs/tw20880.pp

@@ -0,0 +1,21 @@
+{ %interactive }
+
+program CrtBug;
+
+uses Crt;
+
+begin
+  ClrScr;
+  Window(windmaxx - 25, 5, windmaxx, 20);
+  TextColor(LightRed);
+  TextBackground(Cyan); 
+  ClrScr;  
+  
+  while not KeyPressed do
+  begin
+    Write('R=', Random(256), ' ');
+    Delay(100);
+  end;
+  
+  ReadKey;
+end.