Browse Source

* revert pos(offs,string)

git-svn-id: branches/fixes_3_0@33871 -
marco 9 years ago
parent
commit
ea23385d59

+ 11 - 14
rtl/inc/astrings.inc

@@ -915,18 +915,18 @@ end;
 
 
 {$ifndef FPC_HAS_POS_SHORTSTR_ANSISTR}
 {$ifndef FPC_HAS_POS_SHORTSTR_ANSISTR}
 {$define FPC_HAS_POS_SHORTSTR_ANSISTR}
 {$define FPC_HAS_POS_SHORTSTR_ANSISTR}
-Function Pos(Const Substr : ShortString; Const Source : RawByteString; Offset : Sizeint = 1) : SizeInt;
+Function Pos(Const Substr : ShortString; Const Source : RawByteString) : SizeInt;
 
 
 var
 var
   i,MaxLen : SizeInt;
   i,MaxLen : SizeInt;
   pc : PAnsiChar;
   pc : PAnsiChar;
 begin
 begin
   Pos:=0;
   Pos:=0;
-  if (Length(SubStr)>0) and (Offset>0) and (Offset<=Length(Source)) then
+  if Length(SubStr)>0 then
    begin
    begin
      MaxLen:=Length(source)-Length(SubStr);
      MaxLen:=Length(source)-Length(SubStr);
-     i:=Offset-1;
-     pc:=@source[Offset];
+     i:=0;
+     pc:=@source[1];
      while (i<=MaxLen) do
      while (i<=MaxLen) do
       begin
       begin
         inc(i);
         inc(i);
@@ -945,17 +945,17 @@ end;
 
 
 {$ifndef FPC_HAS_POS_ANSISTR_ANSISTR}
 {$ifndef FPC_HAS_POS_ANSISTR_ANSISTR}
 {$define FPC_HAS_POS_ANSISTR_ANSISTR}
 {$define FPC_HAS_POS_ANSISTR_ANSISTR}
-Function Pos(Const Substr : RawByteString; Const Source : RawByteString; Offset : Sizeint = 1) : SizeInt;
+Function Pos(Const Substr : RawByteString; Const Source : RawByteString) : SizeInt;
 var
 var
   i,MaxLen : SizeInt;
   i,MaxLen : SizeInt;
   pc : PAnsiChar;
   pc : PAnsiChar;
 begin
 begin
   Pos:=0;
   Pos:=0;
-  if (Length(SubStr)>0) and (Offset>0) and (Offset<=Length(Source)) then
+  if Length(SubStr)>0 then
    begin
    begin
      MaxLen:=Length(source)-Length(SubStr);
      MaxLen:=Length(source)-Length(SubStr);
-     i:=Offset-1;
-     pc:=@source[Offset];
+     i:=0;
+     pc:=@source[1];
      while (i<=MaxLen) do
      while (i<=MaxLen) do
       begin
       begin
         inc(i);
         inc(i);
@@ -978,16 +978,13 @@ end;
 { pos(c: char; const s: shortstring) also exists, so otherwise   }
 { pos(c: char; const s: shortstring) also exists, so otherwise   }
 { using pos(char,pchar) will always call the shortstring version }
 { using pos(char,pchar) will always call the shortstring version }
 { (exact match for first argument), also with $h+ (JM)           }
 { (exact match for first argument), also with $h+ (JM)           }
-Function Pos(c : AnsiChar; Const s : RawByteString; Offset : Sizeint = 1) : SizeInt;
+Function Pos(c : AnsiChar; Const s : RawByteString) : SizeInt;
 var
 var
   i: SizeInt;
   i: SizeInt;
   pc : PAnsiChar;
   pc : PAnsiChar;
 begin
 begin
-  Pos:=0;
-  If (Offset<1) or (Offset>Length(S)) then 
-    exit;
-  pc:=@s[OffSet];
-  for i:=Offset to length(s) do
+  pc:=@s[1];
+  for i:=1 to length(s) do
    begin
    begin
      if pc^=c then
      if pc^=c then
       begin
       begin

+ 9 - 12
rtl/inc/sstrings.inc

@@ -125,17 +125,17 @@ end;
 
 
 {$ifndef FPC_HAS_SHORTSTR_POS_SHORTSTR}
 {$ifndef FPC_HAS_SHORTSTR_POS_SHORTSTR}
 {$define FPC_HAS_SHORTSTR_POS_SHORTSTR}
 {$define FPC_HAS_SHORTSTR_POS_SHORTSTR}
-function pos(const substr : shortstring;const s : shortstring; Offset : Sizeint = 1):SizeInt;
+function pos(const substr : shortstring;const s : shortstring):SizeInt;
 var
 var
   i,MaxLen : SizeInt;
   i,MaxLen : SizeInt;
   pc : pchar;
   pc : pchar;
 begin
 begin
   Pos:=0;
   Pos:=0;
-  if (Length(SubStr)>0) and (Offset>0) and (Offset<=Length(S)) then
+  if Length(SubStr)>0 then
    begin
    begin
      MaxLen:=sizeint(Length(s))-Length(SubStr);
      MaxLen:=sizeint(Length(s))-Length(SubStr);
-     i:=Offset-1;
-     pc:=@s[Offset];
+     i:=0;
+     pc:=@s[1];
      while (i<=MaxLen) do
      while (i<=MaxLen) do
       begin
       begin
         inc(i);
         inc(i);
@@ -155,16 +155,13 @@ end;
 {$ifndef FPC_HAS_SHORTSTR_POS_CHAR}
 {$ifndef FPC_HAS_SHORTSTR_POS_CHAR}
 {$define FPC_HAS_SHORTSTR_POS_CHAR}
 {$define FPC_HAS_SHORTSTR_POS_CHAR}
 {Faster when looking for a single char...}
 {Faster when looking for a single char...}
-function pos(c:char;const s:shortstring; Offset : Sizeint = 1 ):SizeInt;
+function pos(c:char;const s:shortstring):SizeInt;
 var
 var
   i : SizeInt;
   i : SizeInt;
   pc : pchar;
   pc : pchar;
 begin
 begin
-  Pos:=0;
-  if (Offset<1) or (Offset>Length(S)) then
-    exit;
-  pc:=@s[Offset];
-  for i:=Offset to length(s) do
+  pc:=@s[1];
+  for i:=1 to length(s) do
    begin
    begin
      if pc^=c then
      if pc^=c then
       begin
       begin
@@ -186,9 +183,9 @@ begin
    fpc_char_Copy:='';
    fpc_char_Copy:='';
 end;
 end;
 
 
-function pos(const substr : shortstring;c:char;  Offset : Sizeint = 1): SizeInt;
+function pos(const substr : shortstring;c:char): SizeInt;
 begin
 begin
-  if (length(substr)=1) and (substr[1]=c) and (Offset=1) then
+  if (length(substr)=1) and (substr[1]=c) then
    Pos:=1
    Pos:=1
   else
   else
    Pos:=0;
    Pos:=0;

+ 6 - 6
rtl/inc/systemh.inc

@@ -1082,10 +1082,10 @@ function Utf8CodePointLen(P: PAnsiChar; MaxLookAhead: SizeInt; IncludeCombiningD
 Procedure Delete(var s:shortstring;index:SizeInt;count:SizeInt);
 Procedure Delete(var s:shortstring;index:SizeInt;count:SizeInt);
 Procedure Insert(const source:shortstring;var s:shortstring;index:SizeInt);
 Procedure Insert(const source:shortstring;var s:shortstring;index:SizeInt);
 Procedure Insert(source:Char;var s:shortstring;index:SizeInt);
 Procedure Insert(source:Char;var s:shortstring;index:SizeInt);
-Function  Pos(const substr:shortstring;const s:shortstring; Offset: Sizeint = 1):SizeInt;
-Function  Pos(C:Char;const s:shortstring; Offset: Sizeint = 1):SizeInt;
+Function  Pos(const substr:shortstring;const s:shortstring):SizeInt;
+Function  Pos(C:Char;const s:shortstring):SizeInt;
 {$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
 {$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
-Function  Pos(const Substr : ShortString; const Source : RawByteString; Offset: Sizeint = 1) : SizeInt;
+Function  Pos(const Substr : ShortString; const Source : RawByteString) : SizeInt;
 
 
 {$ifdef FPC_HAS_CPSTRING}
 {$ifdef FPC_HAS_CPSTRING}
 Procedure fpc_setstring_ansistr_pansichar(out S : RawByteString; Buf : PAnsiChar; Len : SizeInt; cp: TSystemCodePage); rtlproc; compilerproc;
 Procedure fpc_setstring_ansistr_pansichar(out S : RawByteString; Buf : PAnsiChar; Len : SizeInt; cp: TSystemCodePage); rtlproc; compilerproc;
@@ -1121,7 +1121,7 @@ Function  hexStr(Val:Pointer):shortstring;
 Function chr(b : byte) : Char;      [INTERNPROC: fpc_in_chr_byte];
 Function chr(b : byte) : Char;      [INTERNPROC: fpc_in_chr_byte];
 Function  upCase(c:Char):Char;
 Function  upCase(c:Char):Char;
 Function  lowerCase(c:Char):Char; overload;
 Function  lowerCase(c:Char):Char; overload;
-function  pos(const substr : shortstring;c:char; Offset: Sizeint = 1): SizeInt;
+function  pos(const substr : shortstring;c:char): SizeInt;
 
 
 
 
 {****************************************************************************
 {****************************************************************************
@@ -1130,8 +1130,8 @@ function  pos(const substr : shortstring;c:char; Offset: Sizeint = 1): SizeInt;
 
 
 {$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
 {$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
 Procedure UniqueString(var S : RawByteString);{$ifdef FPC_HAS_CPSTRING}rtlproc;{$endif FPC_HAS_CPSTRING}external name 'FPC_ANSISTR_UNIQUE';
 Procedure UniqueString(var S : RawByteString);{$ifdef FPC_HAS_CPSTRING}rtlproc;{$endif FPC_HAS_CPSTRING}external name 'FPC_ANSISTR_UNIQUE';
-Function  Pos (const Substr : RawByteString; const Source : RawByteString; Offset: Sizeint = 1) : SizeInt;
-Function  Pos (c : AnsiChar; const s : RawByteString; Offset: Sizeint = 1) : SizeInt;
+Function  Pos (const Substr : RawByteString; const Source : RawByteString) : SizeInt;
+Function  Pos (c : AnsiChar; const s : RawByteString) : SizeInt;
 Procedure Insert (const Source : RawByteString; var S : RawByteString; Index : SizeInt);{$ifdef FPC_HAS_CPSTRING}rtlproc;{$endif FPC_HAS_CPSTRING}
 Procedure Insert (const Source : RawByteString; var S : RawByteString; Index : SizeInt);{$ifdef FPC_HAS_CPSTRING}rtlproc;{$endif FPC_HAS_CPSTRING}
 Procedure Delete (var S : RawByteString; Index,Size: SizeInt);{$ifdef FPC_HAS_CPSTRING}rtlproc;{$endif FPC_HAS_CPSTRING}
 Procedure Delete (var S : RawByteString; Index,Size: SizeInt);{$ifdef FPC_HAS_CPSTRING}rtlproc;{$endif FPC_HAS_CPSTRING}
 Function  StringOfChar(c : Ansichar;l : SizeInt) : AnsiString;
 Function  StringOfChar(c : Ansichar;l : SizeInt) : AnsiString;

+ 6 - 6
rtl/inc/ustringh.inc

@@ -16,12 +16,12 @@
 
 
 
 
 Procedure UniqueString (Var S : UnicodeString);external name 'FPC_UNICODESTR_UNIQUE';
 Procedure UniqueString (Var S : UnicodeString);external name 'FPC_UNICODESTR_UNIQUE';
-Function Pos (Const Substr : UnicodeString; Const Source : UnicodeString; Offset: Sizeint = 1) : SizeInt;
-Function Pos (c : Char; Const s : UnicodeString; Offset: Sizeint = 1) : SizeInt;
-Function Pos (c : UnicodeChar; Const s : UnicodeString; Offset: Sizeint = 1) : SizeInt;
-Function Pos (const c : RawByteString; Const s : UnicodeString; Offset: Sizeint = 1) : SizeInt;
-Function Pos (const c : UnicodeString; Const s : RawByteString; Offset: Sizeint = 1) : SizeInt;
-Function Pos (const c : ShortString; Const s : UnicodeString; Offset: Sizeint = 1) : SizeInt;
+Function Pos (Const Substr : UnicodeString; Const Source : UnicodeString) : SizeInt;
+Function Pos (c : Char; Const s : UnicodeString) : SizeInt;
+Function Pos (c : UnicodeChar; Const s : UnicodeString) : SizeInt;
+Function Pos (const c : RawByteString; Const s : UnicodeString) : SizeInt;
+Function Pos (const c : UnicodeString; Const s : RawByteString) : SizeInt;
+Function Pos (const c : ShortString; Const s : UnicodeString) : SizeInt;
 
 
 Function UpCase(const s : UnicodeString) : UnicodeString;
 Function UpCase(const s : UnicodeString) : UnicodeString;
 Function  UpCase(c:UnicodeChar):UnicodeChar;
 Function  UpCase(c:UnicodeChar):UnicodeChar;

+ 15 - 15
rtl/inc/ustrings.inc

@@ -1160,7 +1160,7 @@ end;
 
 
 {$ifndef FPC_HAS_POS_UNICODESTR_UNICODESTR}
 {$ifndef FPC_HAS_POS_UNICODESTR_UNICODESTR}
 {$define FPC_HAS_POS_UNICODESTR_UNICODESTR}
 {$define FPC_HAS_POS_UNICODESTR_UNICODESTR}
-Function Pos (Const Substr : UnicodeString; Const Source : UnicodeString; Offset: Sizeint = 1) : SizeInt;
+Function Pos (Const Substr : UnicodeString; Const Source : UnicodeString) : SizeInt;
 var
 var
   i,MaxLen : SizeInt;
   i,MaxLen : SizeInt;
   pc : punicodechar;
   pc : punicodechar;
@@ -1168,9 +1168,9 @@ begin
   Pos:=0;
   Pos:=0;
   if Length(SubStr)>0 then
   if Length(SubStr)>0 then
    begin
    begin
-     MaxLen:=Length(source)-Length(SubStr)-(OffSet-1);
+     MaxLen:=Length(source)-Length(SubStr);
      i:=0;
      i:=0;
-     pc:=@source[OffSet];
+     pc:=@source[1];
      while (i<=MaxLen) do
      while (i<=MaxLen) do
       begin
       begin
         inc(i);
         inc(i);
@@ -1190,13 +1190,13 @@ end;
 {$ifndef FPC_HAS_POS_UNICODECHAR_UNICODESTR}
 {$ifndef FPC_HAS_POS_UNICODECHAR_UNICODESTR}
 {$define FPC_HAS_POS_UNICODECHAR_UNICODESTR}
 {$define FPC_HAS_POS_UNICODECHAR_UNICODESTR}
 { Faster version for a unicodechar alone }
 { Faster version for a unicodechar alone }
-Function Pos (c : UnicodeChar; Const s : UnicodeString; Offset: Sizeint = 1) : SizeInt;
+Function Pos (c : UnicodeChar; Const s : UnicodeString) : SizeInt;
 var
 var
   i: SizeInt;
   i: SizeInt;
   pc : punicodechar;
   pc : punicodechar;
 begin
 begin
-  pc:=@s[OffSet];
-  for i:=OffSet to length(s) do
+  pc:=@s[1];
+  for i:=1 to length(s) do
    begin
    begin
      if pc^=c then
      if pc^=c then
       begin
       begin
@@ -1212,21 +1212,21 @@ end;
 
 
 { DO NOT inline these! Inlining a managed typecast creates an implicit try..finally
 { DO NOT inline these! Inlining a managed typecast creates an implicit try..finally
   block, which is significant bloat without any sensible speed improvement. }
   block, which is significant bloat without any sensible speed improvement. }
-Function Pos (const c : RawByteString; Const s : UnicodeString; Offset: Sizeint = 1) : SizeInt;
+Function Pos (const c : RawByteString; Const s : UnicodeString) : SizeInt;
   begin
   begin
-    result:=Pos(UnicodeString(c),s,offset);
+    result:=Pos(UnicodeString(c),s);
   end;
   end;
 
 
 
 
-Function Pos (const c : ShortString; Const s : UnicodeString; Offset: Sizeint = 1) : SizeInt;
+Function Pos (const c : ShortString; Const s : UnicodeString) : SizeInt;
   begin
   begin
-    result:=Pos(UnicodeString(c),s,OffSet);
+    result:=Pos(UnicodeString(c),s);
   end;
   end;
 
 
 
 
-Function Pos (const c : UnicodeString; Const s : RawByteString; Offset: Sizeint = 1) : SizeInt;
+Function Pos (const c : UnicodeString; Const s : RawByteString) : SizeInt;
   begin
   begin
-    result:=Pos(c,UnicodeString(s),OffSet);
+    result:=Pos(c,UnicodeString(s));
   end;
   end;
 
 
 {$ifndef FPC_HAS_POS_CHAR_UNICODESTR}
 {$ifndef FPC_HAS_POS_CHAR_UNICODESTR}
@@ -1235,15 +1235,15 @@ Function Pos (const c : UnicodeString; Const s : RawByteString; Offset: Sizeint
 { pos(c: char; const s: shortstring) also exists, so otherwise   }
 { pos(c: char; const s: shortstring) also exists, so otherwise   }
 { using pos(char,pchar) will always call the shortstring version }
 { using pos(char,pchar) will always call the shortstring version }
 { (exact match for first argument), also with $h+ (JM)           }
 { (exact match for first argument), also with $h+ (JM)           }
-Function Pos (c : Char; Const s : UnicodeString; Offset: Sizeint = 1) : SizeInt;
+Function Pos (c : Char; Const s : UnicodeString) : SizeInt;
 var
 var
   i: SizeInt;
   i: SizeInt;
   wc : unicodechar;
   wc : unicodechar;
   pc : punicodechar;
   pc : punicodechar;
 begin
 begin
   wc:=c;
   wc:=c;
-  pc:=@s[OffSet];
-  for i:=OffSet to length(s) do
+  pc:=@s[1];
+  for i:=1 to length(s) do
    begin
    begin
      if pc^=wc then
      if pc^=wc then
       begin
       begin

+ 7 - 7
rtl/inc/wstringh.inc

@@ -16,13 +16,13 @@
 
 
 
 
 Procedure UniqueString (Var S : WideString);external name 'FPC_WIDESTR_UNIQUE';
 Procedure UniqueString (Var S : WideString);external name 'FPC_WIDESTR_UNIQUE';
-Function Pos (Const Substr : WideString; Const Source : WideString; Offset : SizeInt = 1) : SizeInt;
-Function Pos (c : Char; Const s : WideString; Offset : SizeInt = 1) : SizeInt;
-Function Pos (c : WideChar; Const s : WideString; Offset : SizeInt = 1) : SizeInt;
-Function Pos (c : WideChar; Const s : RawByteString; Offset : SizeInt = 1) : SizeInt;
-Function Pos (const c : RawByteString; Const s : WideString; Offset : SizeInt = 1) : SizeInt;
-Function Pos (const c : WideString; Const s : RawByteString; Offset : SizeInt = 1) : SizeInt;
-Function Pos (const c : ShortString; Const s : WideString; Offset : SizeInt = 1) : SizeInt;
+Function Pos (Const Substr : WideString; Const Source : WideString) : SizeInt;
+Function Pos (c : Char; Const s : WideString) : SizeInt;
+Function Pos (c : WideChar; Const s : WideString) : SizeInt;
+Function Pos (c : WideChar; Const s : RawByteString) : SizeInt;
+Function Pos (const c : RawByteString; Const s : WideString) : SizeInt;
+Function Pos (const c : WideString; Const s : RawByteString) : SizeInt;
+Function Pos (const c : ShortString; Const s : WideString) : SizeInt;
 
 
 Function UpCase(const s : WideString) : WideString;
 Function UpCase(const s : WideString) : WideString;
 
 

+ 20 - 25
rtl/inc/wstrings.inc

@@ -578,17 +578,17 @@ begin
 end;
 end;
 
 
 
 
-Function Pos (Const Substr : WideString; Const Source : WideString; Offset : SizeInt = 1) : SizeInt;
+Function Pos (Const Substr : WideString; Const Source : WideString) : SizeInt;
 var
 var
   i,MaxLen : SizeInt;
   i,MaxLen : SizeInt;
   pc : pwidechar;
   pc : pwidechar;
 begin
 begin
   Pos:=0;
   Pos:=0;
-  if (Length(SubStr)>0) and (Offset>0) and (Offset<Length(Source)) then
+  if Length(SubStr)>0 then
    begin
    begin
-     MaxLen:=Length(source)-Length(SubStr)-(OffSet-1);
-     i:=Offset-1;
-     pc:=@source[Offset];
+     MaxLen:=Length(source)-Length(SubStr);
+     i:=0;
+     pc:=@source[1];
      while (i<=MaxLen) do
      while (i<=MaxLen) do
       begin
       begin
         inc(i);
         inc(i);
@@ -605,15 +605,13 @@ end;
 
 
 
 
 { Faster version for a widechar alone }
 { Faster version for a widechar alone }
-Function Pos (c : WideChar; Const s : WideString; Offset : Sizeint = 1) : SizeInt;
+Function Pos (c : WideChar; Const s : WideString) : SizeInt;
 var
 var
   i: SizeInt;
   i: SizeInt;
   pc : pwidechar;
   pc : pwidechar;
 begin
 begin
-  pos:=0;
-  if (Offset<1) or (Offset>Length(s)) then exit;
-  pc:=@s[Offset];
-  for i:=Offset to length(s) do
+  pc:=@s[1];
+  for i:=1 to length(s) do
    begin
    begin
      if pc^=c then
      if pc^=c then
       begin
       begin
@@ -622,50 +620,47 @@ begin
       end;
       end;
      inc(pc);
      inc(pc);
    end;
    end;
+  pos:=0;
 end;
 end;
 
 
 { DO NOT inline these! Inlining a managed typecast creates an implicit try..finally
 { DO NOT inline these! Inlining a managed typecast creates an implicit try..finally
   block, which is significant bloat without any sensible speed improvement. }
   block, which is significant bloat without any sensible speed improvement. }
-Function Pos (c : WideChar; Const s : RawByteString; Offset : SizeInt = 1) : SizeInt;
+Function Pos (c : WideChar; Const s : RawByteString) : SizeInt;
   begin
   begin
-    result:=Pos(c,WideString(s),Offset);
+    result:=Pos(c,WideString(s));
   end;
   end;
 
 
 
 
-Function Pos (const c : RawByteString; Const s : WideString;Offset : SizeInt = 1) : SizeInt;
+Function Pos (const c : RawByteString; Const s : WideString) : SizeInt;
   begin
   begin
-    result:=Pos(WideString(c),s,Offset);
+    result:=Pos(WideString(c),s);
   end;
   end;
 
 
 
 
-Function Pos (const c : ShortString; Const s : WideString;Offset : SizeInt = 1) : SizeInt;
+Function Pos (const c : ShortString; Const s : WideString) : SizeInt;
   begin
   begin
-    result:=Pos(WideString(c),s,Offset);
+    result:=Pos(WideString(c),s);
   end;
   end;
 
 
 
 
-Function Pos (const c : WideString; Const s : RawByteString;Offset : SizeInt = 1) : SizeInt;
+Function Pos (const c : WideString; Const s : RawByteString) : SizeInt;
   begin
   begin
-    result:=Pos(c,WideString(s),Offset);
+    result:=Pos(c,WideString(s));
   end;
   end;
 
 
 { Faster version for a char alone. Must be implemented because   }
 { Faster version for a char alone. Must be implemented because   }
 { pos(c: char; const s: shortstring) also exists, so otherwise   }
 { pos(c: char; const s: shortstring) also exists, so otherwise   }
 { using pos(char,pchar) will always call the shortstring version }
 { using pos(char,pchar) will always call the shortstring version }
 { (exact match for first argument), also with $h+ (JM)           }
 { (exact match for first argument), also with $h+ (JM)           }
-Function Pos (c : Char; Const s : WideString;Offset : SizeInt = 1) : SizeInt;
+Function Pos (c : Char; Const s : WideString) : SizeInt;
 var
 var
   i: SizeInt;
   i: SizeInt;
   wc : widechar;
   wc : widechar;
   pc : pwidechar;
   pc : pwidechar;
 begin
 begin
-  Pos:=0;
-  if (Offset<1) or (OffSet>Length(S)) then 
-    exit;
   wc:=c;
   wc:=c;
-  
-  pc:=@s[offset];
-  for i:=Offset to length(s) do
+  pc:=@s[1];
+  for i:=1 to length(s) do
    begin
    begin
      if pc^=wc then
      if pc^=wc then
       begin
       begin

+ 1 - 1
rtl/java/jsystemh.inc

@@ -500,7 +500,7 @@ Function  hexStr(Val:Pointer):shortstring;
 Function chr(b : byte) : Char;      [INTERNPROC: fpc_in_chr_byte];
 Function chr(b : byte) : Char;      [INTERNPROC: fpc_in_chr_byte];
 Function  upCase(c:Char):Char;
 Function  upCase(c:Char):Char;
 Function  lowerCase(c:Char):Char; overload;
 Function  lowerCase(c:Char):Char; overload;
-function  pos(const substr : shortstring;c:char; Offset : Sizeint=1): SizeInt;
+function  pos(const substr : shortstring;c:char): SizeInt;
 
 
 
 
 {****************************************************************************
 {****************************************************************************

+ 0 - 80
rtl/objpas/sysutils/syssr.inc

@@ -1,82 +1,3 @@
-var
-  OldPat,Srch: SRstring; // Srch and Oldp can contain uppercase versions of S,OldPattern
-  PatLength,NewPatLength,P,Cnt,PatCount,PrevP: Integer;
-  c,d: SRPChar ;
-  
-begin
-  PatLength:=Length(OldPattern);
-  if PatLength=0 then begin
-    Result:=S;
-    exit;
-  end;
-
-  if rfIgnoreCase in Flags then begin
-    Srch:=SRUpperCase(S);
-    OldPat:=SRUpperCase(OldPattern);
-  end else begin
-    Srch:=S;
-    OldPat:=OldPattern;
-  end;
-
-  PatLength:=Length(OldPat);
-  if Length(NewPattern)=PatLength then begin
-    //Result length will not change
-    Result:=S;
-    P:=1;
-    repeat
-      P:=Pos(OldPat,Srch,P);
-      if P>0 then begin
-        move(NewPattern[1],Result[P],PatLength);
-        if not (rfReplaceAll in Flags) then exit;
-        inc(P,PatLength);
-      end;
-    until p=0;
-  end else begin
-    //Different pattern length -> Result length will change
-    //To avoid creating a lot of temporary strings, we count how many
-    //replacements we're going to make.
-    P:=1; PatCount:=0;
-    repeat
-      P:=Pos(OldPat,Srch,P);
-      if P>0 then begin
-        inc(P,PatLength);
-        inc(PatCount);
-        if not (rfReplaceAll in Flags) then break;
-      end;
-    until p=0;
-    if PatCount=0 then begin
-      Result:=S;
-      exit;
-    end;
-    NewPatLength:=Length(NewPattern);
-    SetLength(Result,Length(S)+PatCount*(NewPatLength-PatLength)*SizeOf(SRChar));
-    P:=1; PrevP:=0;
-    c:=SRPChar(Result); d:=SRPChar(S);
-    repeat
-      P:=Pos(OldPat,Srch,P);
-      if P>0 then begin
-        Cnt:=P-PrevP-1;
-        if Cnt>0 then begin
-          Move(d^,c^,Cnt);
-          inc(c,Cnt);
-          inc(d,Cnt);
-        end;
-        if NewPatLength>0 then begin
-          Move(NewPattern[1],c^,NewPatLength);
-          inc(c,NewPatLength);
-        end;
-        inc(P,PatLength);
-        inc(d,PatLength);
-        PrevP:=P-1;
-        if not (rfReplaceAll in Flags) then break;
-      end;
-    until p=0;
-    Cnt:=Length(S)-PrevP;
-    if Cnt>0 then Move(d^,c^,Cnt);
-  end;
-end;
-
-(*
 var
 var
   Srch,OldP,RemS: SRString; // Srch and Oldp can contain uppercase versions of S,OldPattern
   Srch,OldP,RemS: SRString; // Srch and Oldp can contain uppercase versions of S,OldPattern
   P : Integer;
   P : Integer;
@@ -113,4 +34,3 @@ begin
       end;
       end;
     end;
     end;
 end;
 end;
-*)

+ 0 - 4
rtl/objpas/sysutils/sysstr.inc

@@ -2700,8 +2700,6 @@ end;
 {$define INSTRINGREPLACE}
 {$define INSTRINGREPLACE}
 {$define SRString:=String}
 {$define SRString:=String}
 {$define SRUpperCase:=AnsiUppercase}
 {$define SRUpperCase:=AnsiUppercase}
-{$define SRPCHAR:=PChar}
-{$define SRCHAR:=Char}
 
 
 Function StringReplace(const S, OldPattern, NewPattern: string;  Flags: TReplaceFlags): string;
 Function StringReplace(const S, OldPattern, NewPattern: string;  Flags: TReplaceFlags): string;
 {$i syssr.inc}
 {$i syssr.inc}
@@ -2709,8 +2707,6 @@ Function StringReplace(const S, OldPattern, NewPattern: string;  Flags: TReplace
 {$undef INSTRINGREPLACE}
 {$undef INSTRINGREPLACE}
 {$undef SRString}
 {$undef SRString}
 {$undef SRUpperCase}
 {$undef SRUpperCase}
-{$undef SRPCHAR}
-{$undef SRCHAR}
 
 
 Function IsDelimiter(const Delimiters, S: string; Index: Integer): Boolean;
 Function IsDelimiter(const Delimiters, S: string; Index: Integer): Boolean;
 
 

+ 0 - 5
rtl/objpas/sysutils/sysuni.inc

@@ -537,14 +537,9 @@ end;
 {$define INUNICODESTRINGREPLACE}
 {$define INUNICODESTRINGREPLACE}
 {$define SRString:=UnicodeString}
 {$define SRString:=UnicodeString}
 {$define SRUpperCase:=WideUppercase}
 {$define SRUpperCase:=WideUppercase}
-{$define SRPCHAR:=PChar}
-{$define SRCHAR:=Char}
-
 function UnicodeStringReplace(const S, OldPattern, NewPattern: UnicodeString;  Flags: TReplaceFlags): UnicodeString;
 function UnicodeStringReplace(const S, OldPattern, NewPattern: UnicodeString;  Flags: TReplaceFlags): UnicodeString;
 {$i syssr.inc}
 {$i syssr.inc}
 
 
 {$undef INUNICODESTRINGREPLACE}
 {$undef INUNICODESTRINGREPLACE}
 {$undef SRString}
 {$undef SRString}
 {$undef SRUpperCase}
 {$undef SRUpperCase}
-{$undef SRPCHAR}
-{$undef SRCHAR}

+ 0 - 5
rtl/objpas/sysutils/syswide.inc

@@ -184,14 +184,9 @@ end;
 {$define INWIDESTRINGREPLACE}
 {$define INWIDESTRINGREPLACE}
 {$define SRString:=WideString}
 {$define SRString:=WideString}
 {$define SRUpperCase:=WideUppercase}
 {$define SRUpperCase:=WideUppercase}
-{$define SRPChar:=PWideChar}
-{$define SRChar:=WideChar}
-
 function WideStringReplace(const S, OldPattern, NewPattern: WideString;  Flags: TReplaceFlags): WideString;
 function WideStringReplace(const S, OldPattern, NewPattern: WideString;  Flags: TReplaceFlags): WideString;
 {$i syssr.inc}
 {$i syssr.inc}
 
 
 {$undef INWIDESTRINGREPLACE}
 {$undef INWIDESTRINGREPLACE}
 {$undef SRString}
 {$undef SRString}
 {$undef SRUpperCase}
 {$undef SRUpperCase}
-{$undef SRPChar}
-{$undef SRChar}