Browse Source

Remove conditionals that rely on not defined(FPC_HAS_CPSTRING).

Rika Ichinose 9 months ago
parent
commit
0b97f169b0

+ 0 - 6
compiler/widestr.pas

@@ -335,13 +335,10 @@ unit widestr;
 
 
 
 
     function charlength(p: pchar; len: sizeint): sizeint;
     function charlength(p: pchar; len: sizeint): sizeint;
-      {$IFDEF FPC_HAS_CPSTRING}
       var
       var
         p2: pchar;
         p2: pchar;
         i, chars, codepointlen: sizeint;
         i, chars, codepointlen: sizeint;
-      {$ENDIF FPC_HAS_CPSTRING}
       begin
       begin
-{$IFDEF FPC_HAS_CPSTRING}
         if len=0 then
         if len=0 then
           begin
           begin
             result:=0;
             result:=0;
@@ -373,9 +370,6 @@ unit widestr;
           end
           end
         else
         else
           result:=len;
           result:=len;
-{$ELSE FPC_HAS_CPSTRING}
-        result:=len;
-{$ENDIF FPC_HAS_CPSTRING}
       end;
       end;
 
 
     function charlength(const s: string): sizeint;
     function charlength(const s: string): sizeint;

+ 0 - 10
packages/rtl-extra/src/inc/objects.pp

@@ -1275,20 +1275,14 @@ END;
 {---------------------------------------------------------------------------}
 {---------------------------------------------------------------------------}
 FUNCTION TStream.ReadRawByteString: RawByteString;
 FUNCTION TStream.ReadRawByteString: RawByteString;
 VAR
 VAR
-{$ifdef FPC_HAS_CPSTRING}
   CP: TSystemCodePage;
   CP: TSystemCodePage;
-{$endif FPC_HAS_CPSTRING}
   L: LongInt;
   L: LongInt;
 BEGIN
 BEGIN
-{$ifdef FPC_HAS_CPSTRING}
   Read(CP, SizeOf(CP));
   Read(CP, SizeOf(CP));
-{$endif FPC_HAS_CPSTRING}
   Read(L, SizeOf(L));
   Read(L, SizeOf(L));
    If (L <= 0) Then ReadRawByteString := '' Else Begin
    If (L <= 0) Then ReadRawByteString := '' Else Begin
      SetLength(ReadRawByteString, L);
      SetLength(ReadRawByteString, L);
-{$ifdef FPC_HAS_CPSTRING}
      SetCodePage(ReadRawByteString, CP, False);
      SetCodePage(ReadRawByteString, CP, False);
-{$endif FPC_HAS_CPSTRING}
      Read(ReadRawByteString[1], L);
      Read(ReadRawByteString[1], L);
    End;
    End;
 END;
 END;
@@ -1432,15 +1426,11 @@ END;
 {---------------------------------------------------------------------------}
 {---------------------------------------------------------------------------}
 PROCEDURE TStream.WriteRawByteString (Const S: RawByteString);
 PROCEDURE TStream.WriteRawByteString (Const S: RawByteString);
 VAR
 VAR
-{$ifdef FPC_HAS_CPSTRING}
   CP: TSystemCodePage;
   CP: TSystemCodePage;
-{$endif FPC_HAS_CPSTRING}
   L: LongInt;
   L: LongInt;
 BEGIN
 BEGIN
-{$ifdef FPC_HAS_CPSTRING}
    CP := StringCodePage(S);
    CP := StringCodePage(S);
    Write(CP, SizeOf(CP));
    Write(CP, SizeOf(CP));
-{$endif FPC_HAS_CPSTRING}
    L := Length(S);
    L := Length(S);
    Write(L, SizeOf(L));
    Write(L, SizeOf(L));
    if L > 0 then
    if L > 0 then

+ 28 - 124
rtl/inc/astrings.inc

@@ -83,7 +83,7 @@ end;
 
 
 {$ifndef FPC_HAS_PCHAR_ANSISTR_INTERN_CHARMOVE}
 {$ifndef FPC_HAS_PCHAR_ANSISTR_INTERN_CHARMOVE}
 {$define FPC_HAS_PCHAR_ANSISTR_INTERN_CHARMOVE}
 {$define FPC_HAS_PCHAR_ANSISTR_INTERN_CHARMOVE}
-procedure fpc_pchar_ansistr_intern_charmove(const src: pansichar; const srcindex: sizeint; var dst: rawbytestring; const dstindex, len: sizeint); {$ifdef FPC_HAS_CPSTRING}rtlproc;{$endif} {$ifdef SYSTEMINLINE}inline;{$endif}
+procedure fpc_pchar_ansistr_intern_charmove(const src: pansichar; const srcindex: sizeint; var dst: rawbytestring; const dstindex, len: sizeint); rtlproc;{$ifdef SYSTEMINLINE}inline;{$endif}
 begin
 begin
   move(src[srcindex],pbyte(pointer(dst))[dstindex],len);
   move(src[srcindex],pbyte(pointer(dst))[dstindex],len);
 end;
 end;
@@ -92,7 +92,7 @@ end;
 
 
 {$ifndef FPC_HAS_PCHAR_PCHAR_INTERN_CHARMOVE}
 {$ifndef FPC_HAS_PCHAR_PCHAR_INTERN_CHARMOVE}
 {$define FPC_HAS_PCHAR_PCHAR_INTERN_CHARMOVE}
 {$define FPC_HAS_PCHAR_PCHAR_INTERN_CHARMOVE}
-procedure fpc_pchar_pchar_intern_charmove(const src: pansichar; const srcindex: sizeint; const dst: pansichar; const dstindex, len: sizeint); {$ifdef FPC_HAS_CPSTRING}rtlproc;{$endif} {$ifdef SYSTEMINLINE}inline;{$endif}
+procedure fpc_pchar_pchar_intern_charmove(const src: pansichar; const srcindex: sizeint; const dst: pansichar; const dstindex, len: sizeint); rtlproc; {$ifdef SYSTEMINLINE}inline;{$endif}
 begin
 begin
   move(src[srcindex],dst[dstindex],len);
   move(src[srcindex],dst[dstindex],len);
 end;
 end;
@@ -101,7 +101,7 @@ end;
 
 
 {$ifndef FPC_HAS_SHORTSTR_ANSISTR_INTERN_CHARMOVE}
 {$ifndef FPC_HAS_SHORTSTR_ANSISTR_INTERN_CHARMOVE}
 {$define FPC_HAS_SHORTSTR_ANSISTR_INTERN_CHARMOVE}
 {$define FPC_HAS_SHORTSTR_ANSISTR_INTERN_CHARMOVE}
-procedure fpc_shortstr_ansistr_intern_charmove(const src: shortstring; const srcindex: sizeint; var dst: rawbytestring; const dstindex, len: sizeint); {$ifdef FPC_HAS_CPSTRING}rtlproc;{$endif} {$ifdef SYSTEMINLINE}inline;{$endif}
+procedure fpc_shortstr_ansistr_intern_charmove(const src: shortstring; const srcindex: sizeint; var dst: rawbytestring; const dstindex, len: sizeint); rtlproc; {$ifdef SYSTEMINLINE}inline;{$endif}
 begin
 begin
   move(src[srcindex],pbyte(pointer(dst))[dstindex],len);
   move(src[srcindex],pbyte(pointer(dst))[dstindex],len);
 end;
 end;
@@ -211,19 +211,15 @@ end;
 
 
 {$ifndef FPC_HAS_ANSISTR_CONCAT}
 {$ifndef FPC_HAS_ANSISTR_CONCAT}
 {$define FPC_HAS_ANSISTR_CONCAT}
 {$define FPC_HAS_ANSISTR_CONCAT}
-procedure fpc_AnsiStr_Concat (var DestS:RawByteString;const S1,S2 : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc;
+procedure fpc_AnsiStr_Concat (var DestS:RawByteString;const S1,S2 : RawByteString;cp : TSystemCodePage); compilerproc;
 Var
 Var
   S1Len, S2Len: SizeInt;
   S1Len, S2Len: SizeInt;
   S1CP, S2CP, DestCP: TSystemCodePage;
   S1CP, S2CP, DestCP: TSystemCodePage;
   OldDestP, NewDestP, RealDestP, Src : Pointer;
   OldDestP, NewDestP, RealDestP, Src : Pointer;
 begin
 begin
-{$ifdef FPC_HAS_CPSTRING}
   DestCP:=cp;
   DestCP:=cp;
   if DestCp=CP_NONE then
   if DestCp=CP_NONE then
     DestCP:=DefaultSystemCodePage;
     DestCP:=DefaultSystemCodePage;
-{$else FPC_HAS_CPSTRING}
-  DestCP:=StringCodePage(DestS);
-{$endif FPC_HAS_CPSTRING}
   DestCP:=TranslatePlaceholderCP(DestCP);
   DestCP:=TranslatePlaceholderCP(DestCP);
   { if codepages are different then concat using unicodestring,
   { if codepages are different then concat using unicodestring,
     but avoid conversions if either addend is empty (StringCodePage will return
     but avoid conversions if either addend is empty (StringCodePage will return
@@ -234,7 +230,6 @@ begin
   S2CP:=S1CP; { So if S2 is empty, S2CP = S1CP. }
   S2CP:=S1CP; { So if S2 is empty, S2CP = S1CP. }
   if Length(S2)<>0 then
   if Length(S2)<>0 then
     S2CP:=TranslatePlaceholderCP(StringCodePage(S2));
     S2CP:=TranslatePlaceholderCP(StringCodePage(S2));
-{$ifdef FPC_HAS_CPSTRING}
   { if the result is rawbytestring and both strings have the same code page,
   { if the result is rawbytestring and both strings have the same code page,
     keep that code page or keep the code page if the other string is empty }
     keep that code page or keep the code page if the other string is empty }
   if cp=CP_NONE then
   if cp=CP_NONE then
@@ -245,7 +240,6 @@ begin
        DestCP:=S2CP;
        DestCP:=S2CP;
        S1CP:=S2CP;
        S1CP:=S2CP;
      end;
      end;
-{$endif FPC_HAS_CPSTRING}
   if (S1CP<>DestCP) or (S2CP<>DestCP) then
   if (S1CP<>DestCP) or (S2CP<>DestCP) then
     begin
     begin
       ansistr_concat_complex(DestS,S1,S2,DestCP);
       ansistr_concat_complex(DestS,S1,S2,DestCP);
@@ -308,19 +302,15 @@ begin
   widestringmanager.Unicode2AnsiMoveProc(PUnicodeChar(Pointer(U)),DestS,cp,Length(U));
   widestringmanager.Unicode2AnsiMoveProc(PUnicodeChar(Pointer(U)),DestS,cp,Length(U));
 end;
 end;
 
 
-procedure fpc_AnsiStr_Concat_multi (var DestS:RawByteString;const sarr:array of RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc;
+procedure fpc_AnsiStr_Concat_multi (var DestS:RawByteString;const sarr:array of RawByteString;cp : TSystemCodePage); compilerproc;
 Var
 Var
   lowstart,i,Size,NewLen : SizeInt;
   lowstart,i,Size,NewLen : SizeInt;
   p,pc,olddestp,newdestp,realdestp : pointer;
   p,pc,olddestp,newdestp,realdestp : pointer;
   DestCP,tmpCP : TSystemCodePage;
   DestCP,tmpCP : TSystemCodePage;
 begin
 begin
-{$ifdef FPC_HAS_CPSTRING}
   DestCP:=cp;
   DestCP:=cp;
   if DestCp=CP_NONE then
   if DestCp=CP_NONE then
     DestCP:=DefaultSystemCodePage;
     DestCP:=DefaultSystemCodePage;
-{$else FPC_HAS_CPSTRING}
-  DestCP:=StringCodePage(DestS);
-{$endif FPC_HAS_CPSTRING}
   lowstart:=low(sarr);
   lowstart:=low(sarr);
   { skip empty strings }
   { skip empty strings }
   while (lowstart<=high(sarr)) and
   while (lowstart<=high(sarr)) and
@@ -344,12 +334,10 @@ begin
           exit;
           exit;
         end;
         end;
     end;
     end;
-{$ifdef FPC_HAS_CPSTRING}
   { if the result is rawbytestring and all strings have the same code page,
   { if the result is rawbytestring and all strings have the same code page,
     keep that code page }
     keep that code page }
   if cp=CP_NONE then
   if cp=CP_NONE then
     DestCP:=tmpCP;
     DestCP:=tmpCP;
-{$endif FPC_HAS_CPSTRING}
   { Calculate size of the result so we can do
   { Calculate size of the result so we can do
     a single call to SetLength() }
     a single call to SetLength() }
   NewLen:=0;
   NewLen:=0;
@@ -424,7 +412,6 @@ begin
 end;
 end;
 {$endif EXTRAANSISHORT}
 {$endif EXTRAANSISHORT}
 
 
-{$ifdef FPC_HAS_CPSTRING}
 {$ifndef FPC_HAS_ANSISTR_TO_ANSISTR}
 {$ifndef FPC_HAS_ANSISTR_TO_ANSISTR}
 {$define FPC_HAS_ANSISTR_TO_ANSISTR}
 {$define FPC_HAS_ANSISTR_TO_ANSISTR}
 Function fpc_AnsiStr_To_AnsiStr (const S : RawByteString;cp : TSystemCodePage): RawByteString; [Public, alias: 'FPC_ANSISTR_TO_ANSISTR']; compilerproc;
 Function fpc_AnsiStr_To_AnsiStr (const S : RawByteString;cp : TSystemCodePage): RawByteString; [Public, alias: 'FPC_ANSISTR_TO_ANSISTR']; compilerproc;
@@ -458,7 +445,6 @@ begin
 end;
 end;
 
 
 Function fpc_AnsiStr_To_AnsiStr (const S : RawByteString;cp : TSystemCodePage): RawByteString; [external name 'FPC_ANSISTR_TO_ANSISTR'];
 Function fpc_AnsiStr_To_AnsiStr (const S : RawByteString;cp : TSystemCodePage): RawByteString; [external name 'FPC_ANSISTR_TO_ANSISTR'];
-{$endif FPC_HAS_CPSTRING}
 {$endif FPC_HAS_ANSISTR_TO_ANSISTR}
 {$endif FPC_HAS_ANSISTR_TO_ANSISTR}
 
 
 {$ifndef FPC_HAS_ANSISTR_TO_SHORTSTR}
 {$ifndef FPC_HAS_ANSISTR_TO_SHORTSTR}
@@ -487,27 +473,19 @@ end;
 
 
 {$ifndef FPC_HAS_SHORTSTR_TO_ANSISTR}
 {$ifndef FPC_HAS_SHORTSTR_TO_ANSISTR}
 {$define FPC_HAS_SHORTSTR_TO_ANSISTR}
 {$define FPC_HAS_SHORTSTR_TO_ANSISTR}
-Function fpc_ShortStr_To_AnsiStr (Const S2 : ShortString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}): RawByteString; compilerproc;
+Function fpc_ShortStr_To_AnsiStr (Const S2 : ShortString;cp : TSystemCodePage): RawByteString; compilerproc;
 {
 {
   Converts a ShortString to a AnsiString;
   Converts a ShortString to a AnsiString;
 }
 }
 Var
 Var
   Size : SizeInt;
   Size : SizeInt;
-{$ifndef FPC_HAS_CPSTRING}
-  cp : TSystemCodePage;
-{$endif FPC_HAS_CPSTRING}
 begin
 begin
-{$ifdef FPC_HAS_CPSTRING}
-  cp:=TranslatePlaceholderCP(cp);
-{$else FPC_HAS_CPSTRING}
-  cp:=DefaultSystemCodePage;
-{$endif FPC_HAS_CPSTRING}
   Size:=Length(S2);
   Size:=Length(S2);
   Setlength(fpc_ShortStr_To_AnsiStr,Size);
   Setlength(fpc_ShortStr_To_AnsiStr,Size);
   if Size>0 then
   if Size>0 then
     begin
     begin
       fpc_shortstr_ansistr_intern_charmove(S2,1,fpc_ShortStr_To_AnsiStr,0,Size);
       fpc_shortstr_ansistr_intern_charmove(S2,1,fpc_ShortStr_To_AnsiStr,0,Size);
-      SetCodePage(fpc_ShortStr_To_AnsiStr,cp,False);
+      SetCodePage(fpc_ShortStr_To_AnsiStr,TranslatePlaceholderCP(cp),False);
     end
     end
 end;
 end;
 {$endif FPC_HAS_SHORTSTR_TO_ANSISTR}
 {$endif FPC_HAS_SHORTSTR_TO_ANSISTR}
@@ -515,36 +493,24 @@ end;
 
 
 {$ifndef FPC_HAS_CHAR_TO_ANSISTR}
 {$ifndef FPC_HAS_CHAR_TO_ANSISTR}
 {$define FPC_HAS_CHAR_TO_ANSISTR}
 {$define FPC_HAS_CHAR_TO_ANSISTR}
-Function fpc_Char_To_AnsiStr(const c : AnsiChar{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}): RawByteString; compilerproc;
+Function fpc_Char_To_AnsiStr(const c : AnsiChar;cp : TSystemCodePage): RawByteString; compilerproc;
 {
 {
   Converts a AnsiChar to a AnsiString;
   Converts a AnsiChar to a AnsiString;
 }
 }
-{$ifndef FPC_HAS_CPSTRING}
-var
-  cp : TSystemCodePage;
-{$endif FPC_HAS_CPSTRING}
 begin
 begin
-{$ifdef FPC_HAS_CPSTRING}
-  cp:=TranslatePlaceholderCP(cp);
-{$else FPC_HAS_CPSTRING}
-  cp:=DefaultSystemCodePage;
-{$endif FPC_HAS_CPSTRING}
   Setlength (fpc_Char_To_AnsiStr,1);
   Setlength (fpc_Char_To_AnsiStr,1);
   PAnsiChar(fpc_Char_To_AnsiStr)^:=c;
   PAnsiChar(fpc_Char_To_AnsiStr)^:=c;
   { Terminating Zero already set by SetLength above }
   { Terminating Zero already set by SetLength above }
-  SetCodePage(fpc_Char_To_AnsiStr,cp,False);
+  SetCodePage(fpc_Char_To_AnsiStr,TranslatePlaceholderCP(cp),False);
 end;
 end;
 {$endif FPC_HAS_CHAR_TO_ANSISTR}
 {$endif FPC_HAS_CHAR_TO_ANSISTR}
 
 
 
 
 {$ifndef FPC_HAS_PCHAR_TO_ANSISTR}
 {$ifndef FPC_HAS_PCHAR_TO_ANSISTR}
 {$define FPC_HAS_PCHAR_TO_ANSISTR}
 {$define FPC_HAS_PCHAR_TO_ANSISTR}
-Function fpc_PChar_To_AnsiStr(const p : PAnsiChar{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}): RawByteString; compilerproc;
+Function fpc_PChar_To_AnsiStr(const p : PAnsiChar;cp : TSystemCodePage): RawByteString; compilerproc;
 Var
 Var
   L : SizeInt;
   L : SizeInt;
-{$ifndef FPC_HAS_CPSTRING}
-  cp : TSystemCodePage;
-{$endif FPC_HAS_CPSTRING}
 begin
 begin
   if (not assigned(p)) or (p[0]=#0) Then
   if (not assigned(p)) or (p[0]=#0) Then
     L := 0
     L := 0
@@ -553,13 +519,8 @@ begin
   SetLength(fpc_PChar_To_AnsiStr,L);
   SetLength(fpc_PChar_To_AnsiStr,L);
   if L > 0 then
   if L > 0 then
     begin
     begin
-{$ifdef FPC_HAS_CPSTRING}
-      cp:=TranslatePlaceholderCP(cp);
-{$else FPC_HAS_CPSTRING}
-      cp:=DefaultSystemCodePage;
-{$endif FPC_HAS_CPSTRING}
       fpc_pchar_ansistr_intern_charmove(p,0,fpc_PChar_To_AnsiStr,0,L);
       fpc_pchar_ansistr_intern_charmove(p,0,fpc_PChar_To_AnsiStr,0,L);
-      SetCodePage(fpc_PChar_To_AnsiStr,cp,False);
+      SetCodePage(fpc_PChar_To_AnsiStr,TranslatePlaceholderCP(cp),False);
     end;
     end;
 end;
 end;
 {$endif FPC_HAS_PCHAR_TO_ANSISTR}
 {$endif FPC_HAS_PCHAR_TO_ANSISTR}
@@ -567,12 +528,9 @@ end;
 
 
 {$ifndef FPC_HAS_CHARARRAY_TO_ANSISTR}
 {$ifndef FPC_HAS_CHARARRAY_TO_ANSISTR}
 {$define FPC_HAS_CHARARRAY_TO_ANSISTR}
 {$define FPC_HAS_CHARARRAY_TO_ANSISTR}
-Function fpc_CharArray_To_AnsiStr(const arr: array of ansichar; {$ifdef FPC_HAS_CPSTRING}cp : TSystemCodePage;{$endif FPC_HAS_CPSTRING}zerobased: boolean = true): RawByteString; compilerproc;
+Function fpc_CharArray_To_AnsiStr(const arr: array of ansichar; cp : TSystemCodePage;zerobased: boolean = true): RawByteString; compilerproc;
 var
 var
   i  : SizeInt;
   i  : SizeInt;
-{$ifndef FPC_HAS_CPSTRING}
-  cp : TSystemCodePage;
-{$endif FPC_HAS_CPSTRING}
 begin
 begin
   if (zerobased) then
   if (zerobased) then
     begin
     begin
@@ -590,13 +548,8 @@ begin
   SetLength(fpc_CharArray_To_AnsiStr,i);
   SetLength(fpc_CharArray_To_AnsiStr,i);
   if i > 0 then
   if i > 0 then
     begin
     begin
-{$ifdef FPC_HAS_CPSTRING}
-      cp:=TranslatePlaceholderCP(cp);
-{$else FPC_HAS_CPSTRING}
-      cp:=DefaultSystemCodePage;
-{$endif FPC_HAS_CPSTRING}
       fpc_pchar_ansistr_intern_charmove(pansichar(@arr),0,fpc_CharArray_To_AnsiStr,0,i);
       fpc_pchar_ansistr_intern_charmove(pansichar(@arr),0,fpc_CharArray_To_AnsiStr,0,i);
-      SetCodePage(fpc_CharArray_To_AnsiStr,cp,False);
+      SetCodePage(fpc_CharArray_To_AnsiStr,TranslatePlaceholderCP(cp),False);
     end;
     end;
 end;
 end;
 {$endif FPC_HAS_ANSISTR_TO_CHARARRAY}
 {$endif FPC_HAS_ANSISTR_TO_CHARARRAY}
@@ -725,7 +678,7 @@ end;
 
 
 {$ifndef FPC_HAS_ANSISTR_SETLENGTH}
 {$ifndef FPC_HAS_ANSISTR_SETLENGTH}
 {$define FPC_HAS_ANSISTR_SETLENGTH}
 {$define FPC_HAS_ANSISTR_SETLENGTH}
-Procedure fpc_AnsiStr_SetLength (Var S : RawByteString; l : SizeInt{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING});[Public,Alias : 'FPC_ANSISTR_SETLENGTH'];  compilerproc;
+Procedure fpc_AnsiStr_SetLength (Var S : RawByteString; l : SizeInt;cp : TSystemCodePage);[Public,Alias : 'FPC_ANSISTR_SETLENGTH'];  compilerproc;
 {
 {
   Sets The length of string S to L.
   Sets The length of string S to L.
   Makes sure S is unique, and contains enough room.
   Makes sure S is unique, and contains enough room.
@@ -739,12 +692,8 @@ begin
       if Pointer(S)=nil then
       if Pointer(S)=nil then
         begin
         begin
           Pointer(S):=NewAnsiString(L);
           Pointer(S):=NewAnsiString(L);
-{$ifdef FPC_HAS_CPSTRING}
           cp:=TranslatePlaceholderCP(cp);
           cp:=TranslatePlaceholderCP(cp);
           PAnsiRec(Pointer(S)-AnsiFirstOff)^.CodePage:=cp;
           PAnsiRec(Pointer(S)-AnsiFirstOff)^.CodePage:=cp;
-{$else}
-          PAnsiRec(Pointer(S)-AnsiFirstOff)^.CodePage:=DefaultSystemCodePage;
-{$endif FPC_HAS_CPSTRING}
         end
         end
       else if PAnsiRec(Pointer(S)-AnsiFirstOff)^.Ref=1 then
       else if PAnsiRec(Pointer(S)-AnsiFirstOff)^.Ref=1 then
         begin
         begin
@@ -832,7 +781,7 @@ end;
 Function fpc_ansistr_Unique_func(Var S : RawByteString): Pointer; external name 'FPC_ANSISTR_UNIQUE';
 Function fpc_ansistr_Unique_func(Var S : RawByteString): Pointer; external name 'FPC_ANSISTR_UNIQUE';
 
 
 
 
-Procedure UniqueString(var S : RawByteString);{$ifdef FPC_HAS_CPSTRING}rtlproc;{$endif FPC_HAS_CPSTRING}{$ifdef SYSTEMINLINE}inline;{$endif}
+Procedure UniqueString(var S : RawByteString);rtlproc;{$ifdef SYSTEMINLINE}inline;{$endif}
   begin
   begin
     fpc_ansistr_Unique_func(S);
     fpc_ansistr_Unique_func(S);
   end;
   end;
@@ -1154,42 +1103,36 @@ end;
 
 
 
 
 {$ifndef FPUNONE}
 {$ifndef FPUNONE}
-procedure fpc_AnsiStr_Float(d : ValReal;len,fr,rt : SizeInt;out s : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING});[public,alias:'FPC_ANSISTR_FLOAT']; compilerproc; inline;
+procedure fpc_AnsiStr_Float(d : ValReal;len,fr,rt : SizeInt;out s : RawByteString;cp : TSystemCodePage);[public,alias:'FPC_ANSISTR_FLOAT']; compilerproc; inline;
 var
 var
   ss: ShortString;
   ss: ShortString;
 begin
 begin
   str_real(len,fr,d,treal_type(rt),ss);
   str_real(len,fr,d,treal_type(rt),ss);
   s:=ss;
   s:=ss;
-  {$ifdef FPC_HAS_CPSTRING}
   SetCodePage(s,cp,false);
   SetCodePage(s,cp,false);
-  {$endif FPC_HAS_CPSTRING}
 end;
 end;
 {$endif}
 {$endif}
 
 
 {$ifndef FPC_STR_ENUM_INTERN}
 {$ifndef FPC_STR_ENUM_INTERN}
-procedure fpc_ansistr_enum(ordinal,len:sizeint;typinfo,ord2strindex:pointer;out s:RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING});[public,alias:'FPC_ANSISTR_ENUM'];compilerproc; inline;
+procedure fpc_ansistr_enum(ordinal,len:sizeint;typinfo,ord2strindex:pointer;out s:RawByteString;cp : TSystemCodePage);[public,alias:'FPC_ANSISTR_ENUM'];compilerproc; inline;
 
 
 var ss:shortstring;
 var ss:shortstring;
 
 
 begin
 begin
   fpc_shortstr_enum(ordinal,len,typinfo,ord2strindex,ss);
   fpc_shortstr_enum(ordinal,len,typinfo,ord2strindex,ss);
   s:=ss;
   s:=ss;
-  {$ifdef FPC_HAS_CPSTRING}
   SetCodePage(s,cp,false);
   SetCodePage(s,cp,false);
-  {$endif FPC_HAS_CPSTRING}
 end;
 end;
 {$endif FPC_STR_ENUM_INTERN}
 {$endif FPC_STR_ENUM_INTERN}
 
 
 
 
-procedure fpc_ansistr_bool(b : boolean;len:sizeint;out s:RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING});[public,alias:'FPC_ANSISTR_BOOL'];compilerproc; inline;
+procedure fpc_ansistr_bool(b : boolean;len:sizeint;out s:RawByteString;cp : TSystemCodePage);[public,alias:'FPC_ANSISTR_BOOL'];compilerproc; inline;
 var
 var
   ss:shortstring;
   ss:shortstring;
 begin
 begin
   fpc_shortstr_bool(b,len,ss);
   fpc_shortstr_bool(b,len,ss);
   s:=ss;
   s:=ss;
-  {$ifdef FPC_HAS_CPSTRING}
   SetCodePage(s,cp,false);
   SetCodePage(s,cp,false);
-  {$endif FPC_HAS_CPSTRING}
 end;
 end;
 
 
 
 
@@ -1202,111 +1145,93 @@ end;
 {$endif FPC_STR_ENUM_INTERN}
 {$endif FPC_STR_ENUM_INTERN}
 
 
 
 
-procedure fpc_AnsiStr_Currency(c : currency;len,fr : SizeInt;out s : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING});[public,alias:'FPC_ANSISTR_CURRENCY']; compilerproc; inline;
+procedure fpc_AnsiStr_Currency(c : currency;len,fr : SizeInt;out s : RawByteString;cp : TSystemCodePage);[public,alias:'FPC_ANSISTR_CURRENCY']; compilerproc; inline;
 var
 var
   ss: ShortString;
   ss: ShortString;
 begin
 begin
   str(c:len:fr,ss);
   str(c:len:fr,ss);
   s:=ss;
   s:=ss;
-  {$ifdef FPC_HAS_CPSTRING}
   SetCodePage(s,cp,false);
   SetCodePage(s,cp,false);
-  {$endif FPC_HAS_CPSTRING}
 end;
 end;
 
 
-Procedure fpc_AnsiStr_UInt(v : ValUInt;Len : SizeInt; out S : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING});[Public,Alias : 'FPC_ANSISTR_VALUINT']; compilerproc; inline;
+Procedure fpc_AnsiStr_UInt(v : ValUInt;Len : SizeInt; out S : RawByteString;cp : TSystemCodePage);[Public,Alias : 'FPC_ANSISTR_VALUINT']; compilerproc; inline;
 Var
 Var
   SS : ShortString;
   SS : ShortString;
 begin
 begin
   str(v:Len,SS);
   str(v:Len,SS);
   S:=SS;
   S:=SS;
-  {$ifdef FPC_HAS_CPSTRING}
   SetCodePage(s,cp,false);
   SetCodePage(s,cp,false);
-  {$endif FPC_HAS_CPSTRING}
 end;
 end;
 
 
 
 
 
 
-Procedure fpc_AnsiStr_SInt(v : ValSInt;Len : SizeInt; out S : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING});[Public,Alias : 'FPC_ANSISTR_VALSINT']; compilerproc; inline;
+Procedure fpc_AnsiStr_SInt(v : ValSInt;Len : SizeInt; out S : RawByteString;cp : TSystemCodePage);[Public,Alias : 'FPC_ANSISTR_VALSINT']; compilerproc; inline;
 Var
 Var
   SS : ShortString;
   SS : ShortString;
 begin
 begin
   str (v:Len,SS);
   str (v:Len,SS);
   S:=SS;
   S:=SS;
-  {$ifdef FPC_HAS_CPSTRING}
   SetCodePage(s,cp,false);
   SetCodePage(s,cp,false);
-  {$endif FPC_HAS_CPSTRING}
 end;
 end;
 
 
 
 
 {$ifndef CPU64}
 {$ifndef CPU64}
 
 
-Procedure fpc_AnsiStr_QWord(v : QWord;Len : SizeInt; out S : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING});[Public,Alias : 'FPC_ANSISTR_QWORD']; compilerproc; inline;
+Procedure fpc_AnsiStr_QWord(v : QWord;Len : SizeInt; out S : RawByteString;cp : TSystemCodePage);[Public,Alias : 'FPC_ANSISTR_QWORD']; compilerproc; inline;
 Var
 Var
   SS : ShortString;
   SS : ShortString;
 begin
 begin
   str(v:Len,SS);
   str(v:Len,SS);
   S:=SS;
   S:=SS;
-  {$ifdef FPC_HAS_CPSTRING}
   SetCodePage(s,cp,false);
   SetCodePage(s,cp,false);
-  {$endif FPC_HAS_CPSTRING}
 end;
 end;
 
 
-Procedure fpc_AnsiStr_Int64(v : Int64; Len : SizeInt; out S : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING});[Public,Alias : 'FPC_ANSISTR_INT64']; compilerproc; inline;
+Procedure fpc_AnsiStr_Int64(v : Int64; Len : SizeInt; out S : RawByteString;cp : TSystemCodePage);[Public,Alias : 'FPC_ANSISTR_INT64']; compilerproc; inline;
 Var
 Var
   SS : ShortString;
   SS : ShortString;
 begin
 begin
   str (v:Len,SS);
   str (v:Len,SS);
   S:=SS;
   S:=SS;
-  {$ifdef FPC_HAS_CPSTRING}
   SetCodePage(s,cp,false);
   SetCodePage(s,cp,false);
-  {$endif FPC_HAS_CPSTRING}
 end;
 end;
 
 
 {$endif CPU64}
 {$endif CPU64}
 
 
 {$if defined(CPU16) or defined(CPU8)}
 {$if defined(CPU16) or defined(CPU8)}
-Procedure fpc_AnsiStr_LongWord(v : LongWord;Len : SizeInt; out S : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING});[Public,Alias : 'FPC_ANSISTR_LONGWORD']; compilerproc; inline;
+Procedure fpc_AnsiStr_LongWord(v : LongWord;Len : SizeInt; out S : RawByteString;cp : TSystemCodePage);[Public,Alias : 'FPC_ANSISTR_LONGWORD']; compilerproc; inline;
 Var
 Var
   SS : ShortString;
   SS : ShortString;
 begin
 begin
   str(v:Len,SS);
   str(v:Len,SS);
   S:=SS;
   S:=SS;
-  {$ifdef FPC_HAS_CPSTRING}
   SetCodePage(s,cp,false);
   SetCodePage(s,cp,false);
-  {$endif FPC_HAS_CPSTRING}
 end;
 end;
 
 
-Procedure fpc_AnsiStr_LongInt(v : LongInt; Len : SizeInt; out S : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING});[Public,Alias : 'FPC_ANSISTR_LONGINT']; compilerproc; inline;
+Procedure fpc_AnsiStr_LongInt(v : LongInt; Len : SizeInt; out S : RawByteString;cp : TSystemCodePage);[Public,Alias : 'FPC_ANSISTR_LONGINT']; compilerproc; inline;
 Var
 Var
   SS : ShortString;
   SS : ShortString;
 begin
 begin
   str (v:Len,SS);
   str (v:Len,SS);
   S:=SS;
   S:=SS;
-  {$ifdef FPC_HAS_CPSTRING}
   SetCodePage(s,cp,false);
   SetCodePage(s,cp,false);
-  {$endif FPC_HAS_CPSTRING}
 end;
 end;
 
 
-Procedure fpc_AnsiStr_Word(v : Word;Len : SizeInt; out S : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING});[Public,Alias : 'FPC_ANSISTR_WORD']; compilerproc; inline;
+Procedure fpc_AnsiStr_Word(v : Word;Len : SizeInt; out S : RawByteString;cp : TSystemCodePage);[Public,Alias : 'FPC_ANSISTR_WORD']; compilerproc; inline;
 Var
 Var
   SS : ShortString;
   SS : ShortString;
 begin
 begin
   str(v:Len,SS);
   str(v:Len,SS);
   S:=SS;
   S:=SS;
-  {$ifdef FPC_HAS_CPSTRING}
   SetCodePage(s,cp,false);
   SetCodePage(s,cp,false);
-  {$endif FPC_HAS_CPSTRING}
 end;
 end;
 
 
-Procedure fpc_AnsiStr_SmallInt(v : SmallInt; Len : SizeInt; out S : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING});[Public,Alias : 'FPC_ANSISTR_SMALLINT']; compilerproc; inline;
+Procedure fpc_AnsiStr_SmallInt(v : SmallInt; Len : SizeInt; out S : RawByteString;cp : TSystemCodePage);[Public,Alias : 'FPC_ANSISTR_SMALLINT']; compilerproc; inline;
 Var
 Var
   SS : ShortString;
   SS : ShortString;
 begin
 begin
   str (v:Len,SS);
   str (v:Len,SS);
   S:=SS;
   S:=SS;
-  {$ifdef FPC_HAS_CPSTRING}
   SetCodePage(s,cp,false);
   SetCodePage(s,cp,false);
-  {$endif FPC_HAS_CPSTRING}
 end;
 end;
 {$endif CPU16 or CPU8}
 {$endif CPU16 or CPU8}
 
 
@@ -1384,38 +1309,24 @@ end;
 {$endif FPC_HAS_ANSISTR_OF_CHAR}
 {$endif FPC_HAS_ANSISTR_OF_CHAR}
 
 
 
 
-{$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;
-{$else}
-Procedure SetString(out S : AnsiString; Buf : PAnsiChar; Len : SizeInt);
-{$endif}
 begin
 begin
   SetLength(S,Len);
   SetLength(S,Len);
-{$ifdef FPC_HAS_CPSTRING}
   SetCodePage(S,cp,false);
   SetCodePage(S,cp,false);
-{$endif}
   If (Buf<>Nil) then
   If (Buf<>Nil) then
     fpc_pchar_ansistr_intern_charmove(Buf,0,S,0,Len);
     fpc_pchar_ansistr_intern_charmove(Buf,0,S,0,Len);
 end;
 end;
 
 
 
 
-{$ifdef FPC_HAS_CPSTRING}
 Procedure fpc_setstring_ansistr_pwidechar(out S : RawByteString; Buf : PWideChar; Len : SizeInt; cp: TSystemCodePage); rtlproc; compilerproc;
 Procedure fpc_setstring_ansistr_pwidechar(out S : RawByteString; Buf : PWideChar; Len : SizeInt; cp: TSystemCodePage); rtlproc; compilerproc;
-{$else}
-Procedure SetString(out S : AnsiString; Buf : PWideChar; Len : SizeInt);
-{$endif}
 begin
 begin
-{$ifdef FPC_HAS_CPSTRING}
   cp:=TranslatePlaceholderCP(cp);
   cp:=TranslatePlaceholderCP(cp);
-{$endif}
   if (Buf<>nil) and (Len>0) then
   if (Buf<>nil) and (Len>0) then
-    widestringmanager.Wide2AnsiMoveProc(Buf,S,{$ifdef FPC_HAS_CPSTRING}cp{$else}DefaultSystemCodePage{$endif},Len)
+    widestringmanager.Wide2AnsiMoveProc(Buf,S,cp,Len)
   else
   else
     begin
     begin
       SetLength(S, Len);
       SetLength(S, Len);
-{$ifdef FPC_HAS_CPSTRING}
       SetCodePage(S,cp,false);
       SetCodePage(S,cp,false);
-{$endif}
     end;
     end;
 end;
 end;
 
 
@@ -1450,11 +1361,9 @@ end;
 {$define FPC_HAS_ANSISTR_STRINGCODEPAGE}
 {$define FPC_HAS_ANSISTR_STRINGCODEPAGE}
 function StringCodePage(const S: RawByteString): TSystemCodePage; overload;
 function StringCodePage(const S: RawByteString): TSystemCodePage; overload;
   begin
   begin
-{$ifdef FPC_HAS_CPSTRING}
     if assigned(Pointer(S)) then
     if assigned(Pointer(S)) then
       Result:=PAnsiRec(pointer(S)-AnsiFirstOff)^.CodePage
       Result:=PAnsiRec(pointer(S)-AnsiFirstOff)^.CodePage
     else
     else
-{$endif FPC_HAS_CPSTRING}
       Result:=DefaultSystemCodePage;
       Result:=DefaultSystemCodePage;
   end;
   end;
 {$endif FPC_HAS_ANSISTR_STRINGCODEPAGE}
 {$endif FPC_HAS_ANSISTR_STRINGCODEPAGE}
@@ -1490,12 +1399,7 @@ procedure InternalSetCodePage(var s : RawByteString; CodePage : TSystemCodePage;
   begin
   begin
     if Convert then
     if Convert then
       begin
       begin
-{$ifdef FPC_HAS_CPSTRING}
         s:=fpc_AnsiStr_To_AnsiStr(s,CodePage);
         s:=fpc_AnsiStr_To_AnsiStr(s,CodePage);
-{$else FPC_HAS_CPSTRING}
-        UniqueString(s);
-        PAnsiRec(pointer(s)-AnsiFirstOff)^.CodePage:=CodePage;
-{$endif FPC_HAS_CPSTRING}
       end
       end
     else
     else
       begin
       begin

+ 25 - 27
rtl/inc/compproc.inc

@@ -101,14 +101,14 @@ procedure fpc_ShortStr_Currency(c : currency; len,f : SizeInt; out s : shortstri
 procedure fpc_chararray_sint(v : valsint;len : SizeInt;out a : array of AnsiChar); compilerproc;
 procedure fpc_chararray_sint(v : valsint;len : SizeInt;out a : array of AnsiChar); compilerproc;
 procedure fpc_chararray_uint(v : valuint;len : SizeInt;out a : array of AnsiChar); compilerproc;
 procedure fpc_chararray_uint(v : valuint;len : SizeInt;out a : array of AnsiChar); compilerproc;
 {$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
 {$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
-procedure fpc_AnsiStr_sint(v : valsint; Len : SizeInt; out S : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc; inline;
-procedure fpc_AnsiStr_uint(v : valuint;Len : SizeInt; out S : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc; inline;
+procedure fpc_AnsiStr_sint(v : valsint; Len : SizeInt; out S : RawByteString;cp : TSystemCodePage); compilerproc; inline;
+procedure fpc_AnsiStr_uint(v : valuint;Len : SizeInt; out S : RawByteString;cp : TSystemCodePage); compilerproc; inline;
 {$ifndef FPUNONE}
 {$ifndef FPUNONE}
-procedure fpc_AnsiStr_Float(d : ValReal;len,fr,rt : SizeInt;out s : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc; inline;
+procedure fpc_AnsiStr_Float(d : ValReal;len,fr,rt : SizeInt;out s : RawByteString;cp : TSystemCodePage); compilerproc; inline;
 {$endif}
 {$endif}
-procedure fpc_ansistr_enum(ordinal,len:sizeint;typinfo,ord2strindex:pointer;out s:RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc; inline;
-procedure fpc_ansistr_bool(b : boolean;len:sizeint;out s:RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc; inline;
-procedure fpc_AnsiStr_Currency(c : currency;len,fr : SizeInt;out s : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc; inline;
+procedure fpc_ansistr_enum(ordinal,len:sizeint;typinfo,ord2strindex:pointer;out s:RawByteString;cp : TSystemCodePage); compilerproc; inline;
+procedure fpc_ansistr_bool(b : boolean;len:sizeint;out s:RawByteString;cp : TSystemCodePage); compilerproc; inline;
+procedure fpc_AnsiStr_Currency(c : currency;len,fr : SizeInt;out s : RawByteString;cp : TSystemCodePage); compilerproc; inline;
 {$endif FPC_HAS_FEATURE_ANSISTRINGS}
 {$endif FPC_HAS_FEATURE_ANSISTRINGS}
 
 
 {$ifdef FPC_HAS_FEATURE_WIDESTRINGS}
 {$ifdef FPC_HAS_FEATURE_WIDESTRINGS}
@@ -126,8 +126,8 @@ procedure fpc_AnsiStr_Currency(c : currency;len,fr : SizeInt;out s : RawByteStri
   procedure fpc_chararray_qword(v : qword;len : SizeInt;out a : array of AnsiChar); compilerproc;
   procedure fpc_chararray_qword(v : qword;len : SizeInt;out a : array of AnsiChar); compilerproc;
   procedure fpc_chararray_int64(v : int64;len : SizeInt;out a : array of AnsiChar); compilerproc;
   procedure fpc_chararray_int64(v : int64;len : SizeInt;out a : array of AnsiChar); compilerproc;
   {$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
   {$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
-  procedure fpc_ansistr_qword(v : qword;len : SizeInt;out s : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc; inline;
-  procedure fpc_ansistr_int64(v : int64;len : SizeInt;out s : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc; inline;
+  procedure fpc_ansistr_qword(v : qword;len : SizeInt;out s : RawByteString;cp : TSystemCodePage); compilerproc; inline;
+  procedure fpc_ansistr_int64(v : int64;len : SizeInt;out s : RawByteString;cp : TSystemCodePage); compilerproc; inline;
   {$endif FPC_HAS_FEATURE_ANSISTRINGS}
   {$endif FPC_HAS_FEATURE_ANSISTRINGS}
 
 
   {$ifdef FPC_HAS_FEATURE_WIDESTRINGS}
   {$ifdef FPC_HAS_FEATURE_WIDESTRINGS}
@@ -145,8 +145,8 @@ procedure fpc_AnsiStr_Currency(c : currency;len,fr : SizeInt;out s : RawByteStri
   procedure fpc_chararray_longword(v : longword;len : SizeInt;out a : array of AnsiChar); compilerproc;
   procedure fpc_chararray_longword(v : longword;len : SizeInt;out a : array of AnsiChar); compilerproc;
   procedure fpc_chararray_longint(v : longint;len : SizeInt;out a : array of AnsiChar); compilerproc;
   procedure fpc_chararray_longint(v : longint;len : SizeInt;out a : array of AnsiChar); compilerproc;
   {$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
   {$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
-  procedure fpc_ansistr_longword(v : longword;len : SizeInt;out s : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc;
-  procedure fpc_ansistr_longint(v : longint;len : SizeInt;out s : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc;
+  procedure fpc_ansistr_longword(v : longword;len : SizeInt;out s : RawByteString;cp : TSystemCodePage); compilerproc;
+  procedure fpc_ansistr_longint(v : longint;len : SizeInt;out s : RawByteString;cp : TSystemCodePage); compilerproc;
   {$endif FPC_HAS_FEATURE_ANSISTRINGS}
   {$endif FPC_HAS_FEATURE_ANSISTRINGS}
 
 
   {$ifdef FPC_HAS_FEATURE_WIDESTRINGS}
   {$ifdef FPC_HAS_FEATURE_WIDESTRINGS}
@@ -163,8 +163,8 @@ procedure fpc_AnsiStr_Currency(c : currency;len,fr : SizeInt;out s : RawByteStri
   procedure fpc_chararray_word(v : word;len : SizeInt;out a : array of AnsiChar); compilerproc;
   procedure fpc_chararray_word(v : word;len : SizeInt;out a : array of AnsiChar); compilerproc;
   procedure fpc_chararray_smallint(v : smallint;len : SizeInt;out a : array of AnsiChar); compilerproc;
   procedure fpc_chararray_smallint(v : smallint;len : SizeInt;out a : array of AnsiChar); compilerproc;
   {$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
   {$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
-  procedure fpc_ansistr_word(v : word;len : SizeInt;out s : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc;
-  procedure fpc_ansistr_smallint(v : smallint;len : SizeInt;out s : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc;
+  procedure fpc_ansistr_word(v : word;len : SizeInt;out s : RawByteString;cp : TSystemCodePage); compilerproc;
+  procedure fpc_ansistr_smallint(v : smallint;len : SizeInt;out s : RawByteString;cp : TSystemCodePage); compilerproc;
   {$endif FPC_HAS_FEATURE_ANSISTRINGS}
   {$endif FPC_HAS_FEATURE_ANSISTRINGS}
 
 
   {$ifdef FPC_HAS_FEATURE_WIDESTRINGS}
   {$ifdef FPC_HAS_FEATURE_WIDESTRINGS}
@@ -303,27 +303,25 @@ Function fpc_Val_smallint_UnicodeStr (Const S : UnicodeString; out Code : ValSIn
 Procedure fpc_ansistr_decr_ref (Var S : Pointer); compilerproc; {$if FPC_FULLVERSION>30202}inline;{$ifend}
 Procedure fpc_ansistr_decr_ref (Var S : Pointer); compilerproc; {$if FPC_FULLVERSION>30202}inline;{$ifend}
 Procedure fpc_ansistr_incr_ref (S : Pointer); compilerproc; {$if FPC_FULLVERSION>30202}inline;{$ifend}
 Procedure fpc_ansistr_incr_ref (S : Pointer); compilerproc; {$if FPC_FULLVERSION>30202}inline;{$ifend}
 Procedure fpc_AnsiStr_Assign (Var DestS : Pointer;S2 : Pointer); compilerproc;
 Procedure fpc_AnsiStr_Assign (Var DestS : Pointer;S2 : Pointer); compilerproc;
-Procedure fpc_AnsiStr_Concat (Var DestS : RawByteString;const S1,S2 : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc;
-Procedure fpc_AnsiStr_Concat_multi (Var DestS : RawByteString;const sarr:array of RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc;
+Procedure fpc_AnsiStr_Concat (Var DestS : RawByteString;const S1,S2 : RawByteString;cp : TSystemCodePage); compilerproc;
+Procedure fpc_AnsiStr_Concat_multi (Var DestS : RawByteString;const sarr:array of RawByteString;cp : TSystemCodePage); compilerproc;
 {$ifdef EXTRAANSISHORT}
 {$ifdef EXTRAANSISHORT}
 Procedure fpc_AnsiStr_ShortStr_Concat (Var S1: AnsiString; Var S2 : ShortString); compilerproc;
 Procedure fpc_AnsiStr_ShortStr_Concat (Var S1: AnsiString; Var S2 : ShortString); compilerproc;
 {$endif EXTRAANSISHORT}
 {$endif EXTRAANSISHORT}
 procedure fpc_AnsiStr_To_ShortStr (out res : shortstring;const S2 : RawByteString); compilerproc;
 procedure fpc_AnsiStr_To_ShortStr (out res : shortstring;const S2 : RawByteString); compilerproc;
-{$ifdef FPC_HAS_CPSTRING}
 Function fpc_AnsiStr_To_AnsiStr (const S : RawByteString;cp : TSystemCodePage): RawByteString; compilerproc;
 Function fpc_AnsiStr_To_AnsiStr (const S : RawByteString;cp : TSystemCodePage): RawByteString; compilerproc;
-{$endif FPC_HAS_CPSTRING}
-Function fpc_ShortStr_To_AnsiStr (Const S2 : ShortString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}): RawByteString; compilerproc;
-Function fpc_Char_To_AnsiStr(const c : AnsiChar{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}): RawByteString; compilerproc;
+Function fpc_ShortStr_To_AnsiStr (Const S2 : ShortString;cp : TSystemCodePage): RawByteString; compilerproc;
+Function fpc_Char_To_AnsiStr(const c : AnsiChar;cp : TSystemCodePage): RawByteString; compilerproc;
 
 
-Function fpc_PChar_To_AnsiStr(const p : PAnsiChar{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}): RawByteString; compilerproc;
-Function fpc_CharArray_To_AnsiStr(const arr: array of AnsiChar; {$ifdef FPC_HAS_CPSTRING}cp : TSystemCodePage;{$endif FPC_HAS_CPSTRING}zerobased: boolean = true): RawByteString; compilerproc;
+Function fpc_PChar_To_AnsiStr(const p : PAnsiChar;cp : TSystemCodePage): RawByteString; compilerproc;
+Function fpc_CharArray_To_AnsiStr(const arr: array of AnsiChar; cp : TSystemCodePage;zerobased: boolean = true): RawByteString; compilerproc;
 procedure fpc_ansistr_to_chararray(out res: array of AnsiChar; const src: RawByteString)compilerproc;
 procedure fpc_ansistr_to_chararray(out res: array of AnsiChar; const src: RawByteString)compilerproc;
 Function fpc_AnsiStr_Compare(const S1,S2 : RawByteString): SizeInt; compilerproc;
 Function fpc_AnsiStr_Compare(const S1,S2 : RawByteString): SizeInt; compilerproc;
 Function fpc_AnsiStr_Compare_equal(const S1,S2 : RawByteString): SizeInt; compilerproc;
 Function fpc_AnsiStr_Compare_equal(const S1,S2 : RawByteString): SizeInt; compilerproc;
 Procedure fpc_AnsiStr_RangeCheck(p : Pointer; index : SizeInt); compilerproc;
 Procedure fpc_AnsiStr_RangeCheck(p : Pointer; index : SizeInt); compilerproc;
 Procedure fpc_AnsiStr_ZeroBased_RangeCheck(p : Pointer; index : SizeInt); compilerproc;
 Procedure fpc_AnsiStr_ZeroBased_RangeCheck(p : Pointer; index : SizeInt); compilerproc;
 
 
-Procedure fpc_AnsiStr_SetLength (Var S : RawByteString; l : SizeInt{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc;
+Procedure fpc_AnsiStr_SetLength (Var S : RawByteString; l : SizeInt;cp : TSystemCodePage); compilerproc;
 Function  fpc_ansistr_Copy (Const S : RawByteString; Index,Size : SizeInt): RawByteString;compilerproc:fpc_in_copy_x;
 Function  fpc_ansistr_Copy (Const S : RawByteString; Index,Size : SizeInt): RawByteString;compilerproc:fpc_in_copy_x;
 Procedure fpc_ansistr_insert (const Source : RawByteString; var S : RawByteString; Index : SizeInt); compilerproc:fpc_in_insert_x_y_z; rtlproc;
 Procedure fpc_ansistr_insert (const Source : RawByteString; var S : RawByteString; Index : SizeInt); compilerproc:fpc_in_insert_x_y_z; rtlproc;
 Procedure fpc_ansistr_delete (var S : RawByteString; Index,Size: SizeInt); compilerproc:fpc_in_delete_x_y_z; rtlproc;
 Procedure fpc_ansistr_delete (var S : RawByteString; Index,Size: SizeInt); compilerproc:fpc_in_delete_x_y_z; rtlproc;
@@ -346,7 +344,7 @@ Procedure fpc_WideStr_Decr_Ref (Var S : Pointer); compilerproc;
 Procedure fpc_WideStr_Incr_Ref (Var S : Pointer); compilerproc;
 Procedure fpc_WideStr_Incr_Ref (Var S : Pointer); compilerproc;
 procedure fpc_WideStr_To_ShortStr (out res: ShortString;const S2 : WideString); compilerproc;
 procedure fpc_WideStr_To_ShortStr (out res: ShortString;const S2 : WideString); compilerproc;
 Function fpc_ShortStr_To_WideStr (Const S2 : ShortString): WideString; compilerproc;
 Function fpc_ShortStr_To_WideStr (Const S2 : ShortString): WideString; compilerproc;
-Function fpc_WideStr_To_AnsiStr (const S2 : WideString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}): AnsiString; compilerproc;
+Function fpc_WideStr_To_AnsiStr (const S2 : WideString;cp : TSystemCodePage): AnsiString; compilerproc;
 Function fpc_AnsiStr_To_WideStr (Const S2 : RawByteString): WideString; compilerproc;
 Function fpc_AnsiStr_To_WideStr (Const S2 : RawByteString): WideString; compilerproc;
 Procedure fpc_WideStr_Assign (Var S1 : Pointer;S2 : Pointer); compilerproc;
 Procedure fpc_WideStr_Assign (Var S1 : Pointer;S2 : Pointer); compilerproc;
 Procedure fpc_WideStr_Concat (Var DestS : Widestring;const S1,S2 : WideString); compilerproc;
 Procedure fpc_WideStr_Concat (Var DestS : Widestring;const S1,S2 : WideString); compilerproc;
@@ -383,7 +381,7 @@ Procedure fpc_UnicodeStr_Decr_Ref (Var S : Pointer); compilerproc;
 Procedure fpc_UnicodeStr_Incr_Ref (S : Pointer); compilerproc;
 Procedure fpc_UnicodeStr_Incr_Ref (S : Pointer); compilerproc;
 procedure fpc_UnicodeStr_To_ShortStr (out res: ShortString;const S2 : UnicodeString); compilerproc;
 procedure fpc_UnicodeStr_To_ShortStr (out res: ShortString;const S2 : UnicodeString); compilerproc;
 Function fpc_ShortStr_To_UnicodeStr (Const S2 : ShortString): UnicodeString; compilerproc;
 Function fpc_ShortStr_To_UnicodeStr (Const S2 : ShortString): UnicodeString; compilerproc;
-Function fpc_UnicodeStr_To_AnsiStr (const S2 : UnicodeString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}): AnsiString; compilerproc;
+Function fpc_UnicodeStr_To_AnsiStr (const S2 : UnicodeString;cp : TSystemCodePage): AnsiString; compilerproc;
 Function fpc_AnsiStr_To_UnicodeStr (Const S2 : RawByteString): UnicodeString; compilerproc;
 Function fpc_AnsiStr_To_UnicodeStr (Const S2 : RawByteString): UnicodeString; compilerproc;
 Function fpc_UnicodeStr_To_WideStr (const S2 : UnicodeString): WideString; compilerproc;
 Function fpc_UnicodeStr_To_WideStr (const S2 : UnicodeString): WideString; compilerproc;
 Function fpc_WideStr_To_UnicodeStr (Const S2 : WideString): UnicodeString; compilerproc;
 Function fpc_WideStr_To_UnicodeStr (Const S2 : WideString): UnicodeString; compilerproc;
@@ -395,7 +393,7 @@ Function fpc_PChar_To_UnicodeStr(const p : PAnsiChar): UnicodeString; compilerpr
 Function fpc_CharArray_To_UnicodeStr(const arr: array of AnsiChar; zerobased: boolean = true): UnicodeString; compilerproc;
 Function fpc_CharArray_To_UnicodeStr(const arr: array of AnsiChar; zerobased: boolean = true): UnicodeString; compilerproc;
 procedure fpc_unicodestr_to_chararray(out res: array of AnsiChar; const src: UnicodeString); compilerproc;
 procedure fpc_unicodestr_to_chararray(out res: array of AnsiChar; const src: UnicodeString); compilerproc;
 procedure fpc_WideCharArray_To_ShortStr(out res : shortstring;const arr: array of widechar; zerobased: boolean = true); compilerproc;
 procedure fpc_WideCharArray_To_ShortStr(out res : shortstring;const arr: array of widechar; zerobased: boolean = true); compilerproc;
-Function fpc_WideCharArray_To_AnsiStr(const arr: array of widechar; {$ifdef FPC_HAS_CPSTRING}cp : TSystemCodePage;{$endif FPC_HAS_CPSTRING} zerobased: boolean = true): AnsiString; compilerproc;
+Function fpc_WideCharArray_To_AnsiStr(const arr: array of widechar; cp : TSystemCodePage; zerobased: boolean = true): AnsiString; compilerproc;
 {$ifndef FPC_WIDESTRING_EQUAL_UNICODESTRING}
 {$ifndef FPC_WIDESTRING_EQUAL_UNICODESTRING}
 Function fpc_WideCharArray_To_WideStr(const arr: array of widechar; zerobased: boolean = true): WideString; compilerproc;
 Function fpc_WideCharArray_To_WideStr(const arr: array of widechar; zerobased: boolean = true): WideString; compilerproc;
 {$endif}
 {$endif}
@@ -416,12 +414,12 @@ function fpc_unicodestr_Unique(Var S : Pointer): Pointer; compilerproc;
 Function fpc_Char_To_UChar(const c : AnsiChar): UnicodeChar; compilerproc;
 Function fpc_Char_To_UChar(const c : AnsiChar): UnicodeChar; compilerproc;
 Function fpc_UChar_To_Char(const c : UnicodeChar): AnsiChar; compilerproc;
 Function fpc_UChar_To_Char(const c : UnicodeChar): AnsiChar; compilerproc;
 Function fpc_UChar_To_UnicodeStr(const c : UnicodeChar): UnicodeString; compilerproc;
 Function fpc_UChar_To_UnicodeStr(const c : UnicodeChar): UnicodeString; compilerproc;
-Function fpc_UChar_To_AnsiStr(const c : UnicodeChar{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}): AnsiString; compilerproc;
+Function fpc_UChar_To_AnsiStr(const c : UnicodeChar;cp : TSystemCodePage): AnsiString; compilerproc;
 function fpc_UChar_To_ShortStr(const c : WideChar): shortstring; compilerproc;
 function fpc_UChar_To_ShortStr(const c : WideChar): shortstring; compilerproc;
 
 
 Function fpc_PWideChar_To_UnicodeStr(const p : pwidechar): unicodestring; compilerproc;
 Function fpc_PWideChar_To_UnicodeStr(const p : pwidechar): unicodestring; compilerproc;
 {$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
 {$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
-Function fpc_PWideChar_To_AnsiStr(const p : pwidechar{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}): ansistring; compilerproc;
+Function fpc_PWideChar_To_AnsiStr(const p : pwidechar;cp : TSystemCodePage): ansistring; compilerproc;
 {$endif FPC_HAS_FEATURE_ANSISTRINGS}
 {$endif FPC_HAS_FEATURE_ANSISTRINGS}
 procedure fpc_PWideChar_To_ShortStr(out res : shortstring;const p : pwidechar); compilerproc;
 procedure fpc_PWideChar_To_ShortStr(out res : shortstring;const p : pwidechar); compilerproc;
 {$endif FPC_HAS_FEATURE_WIDESTRINGS}
 {$endif FPC_HAS_FEATURE_WIDESTRINGS}
@@ -538,7 +536,7 @@ Procedure fpc_Read_Text_ShortStr(var f : Text;out s : shortString); compilerproc
 Procedure fpc_Read_Text_PChar_As_Pointer(var f : Text; const s : PAnsiChar); compilerproc;
 Procedure fpc_Read_Text_PChar_As_Pointer(var f : Text; const s : PAnsiChar); compilerproc;
 Procedure fpc_Read_Text_PChar_As_Array(var f : Text;out s : array of ansichar; zerobased: boolean = false); compilerproc;
 Procedure fpc_Read_Text_PChar_As_Array(var f : Text;out s : array of ansichar; zerobased: boolean = false); compilerproc;
 {$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
 {$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
-Procedure fpc_Read_Text_AnsiStr(var f : Text;out s : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc;
+Procedure fpc_Read_Text_AnsiStr(var f : Text;out s : RawByteString;cp : TSystemCodePage); compilerproc;
 {$endif FPC_HAS_FEATURE_ANSISTRINGS}
 {$endif FPC_HAS_FEATURE_ANSISTRINGS}
 {$ifdef FPC_HAS_FEATURE_WIDESTRINGS}
 {$ifdef FPC_HAS_FEATURE_WIDESTRINGS}
 Procedure fpc_Read_Text_UnicodeStr(var f : Text;out us : UnicodeString); compilerproc;
 Procedure fpc_Read_Text_UnicodeStr(var f : Text;out us : UnicodeString); compilerproc;

+ 1 - 1
rtl/inc/sstrings.inc

@@ -1854,7 +1854,7 @@ end;
 
 
 {$ifndef FPC_HAS_SETSTRING_SHORTSTR}
 {$ifndef FPC_HAS_SETSTRING_SHORTSTR}
 {$define FPC_HAS_SETSTRING_SHORTSTR}
 {$define FPC_HAS_SETSTRING_SHORTSTR}
-Procedure {$ifdef FPC_HAS_CPSTRING}fpc_setstring_shortstr{$else}SetString{$endif}(Out S : Shortstring; Buf : PAnsiChar; Len : SizeInt); {$ifdef FPC_HAS_CPSTRING} compilerproc; {$endif FPC_HAS_CPSTRING}
+Procedure fpc_setstring_shortstr(Out S : Shortstring; Buf : PAnsiChar; Len : SizeInt); compilerproc;
 begin
 begin
   If Len > High(S) then
   If Len > High(S) then
     Len := High(S);
     Len := High(S);

+ 3 - 17
rtl/inc/systemh.inc

@@ -572,18 +572,9 @@ Type
   UCS4String          = array of UCS4Char;
   UCS4String          = array of UCS4Char;
 {$endif}
 {$endif}
 
 
-{$ifdef FPC_HAS_CPSTRING}
   UTF8String          = type AnsiString(CP_UTF8);
   UTF8String          = type AnsiString(CP_UTF8);
-{$else FPC_HAS_CPSTRING}
-  UTF8String          = type ansistring;
-{$endif FPC_HAS_CPSTRING}
   PUTF8String         = ^UTF8String;
   PUTF8String         = ^UTF8String;
-
-{$ifdef FPC_HAS_CPSTRING}
   RawByteString       = type AnsiString(CP_NONE);
   RawByteString       = type AnsiString(CP_NONE);
-{$else FPC_HAS_CPSTRING}
-  RawByteString       = ansistring;
-{$endif FPC_HAS_CPSTRING}
 
 
   HRESULT             = type Longint;
   HRESULT             = type Longint;
 {$ifndef FPUNONE}
 {$ifndef FPUNONE}
@@ -1295,15 +1286,10 @@ Function  Pos(C:AnsiChar;const s:shortstring; Offset: Sizeint = 1):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; Offset: Sizeint = 1) : SizeInt;
 
 
-{$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;
 Procedure fpc_setstring_ansistr_pwidechar(out S : RawByteString; Buf : PWideChar; Len : SizeInt; cp: TSystemCodePage); rtlproc; compilerproc;
 Procedure fpc_setstring_ansistr_pwidechar(out S : RawByteString; Buf : PWideChar; Len : SizeInt; cp: TSystemCodePage); rtlproc; compilerproc;
-{$else}
-Procedure SetString(out S : AnsiString; Buf : PAnsiChar; Len : SizeInt);
-Procedure SetString(out S : AnsiString; Buf : PWideChar; Len : SizeInt);
-{$endif}
 {$endif FPC_HAS_FEATURE_ANSISTRINGS}
 {$endif FPC_HAS_FEATURE_ANSISTRINGS}
-Procedure {$ifdef FPC_HAS_CPSTRING}fpc_setstring_shortstr{$else}SetString{$endif}(out S : Shortstring; Buf : PAnsiChar; Len : SizeInt); {$ifdef FPC_HAS_CPSTRING} compilerproc; {$endif FPC_HAS_CPSTRING}
+Procedure fpc_setstring_shortstr(out S : Shortstring; Buf : PAnsiChar; Len : SizeInt); compilerproc;
 function  ShortCompareText(const S1, S2: shortstring): SizeInt;
 function  ShortCompareText(const S1, S2: shortstring): SizeInt;
 Function  UpCase(const s:shortstring):shortstring;
 Function  UpCase(const s:shortstring):shortstring;
 Function  LowerCase(const s:shortstring):shortstring; overload;
 Function  LowerCase(const s:shortstring):shortstring; overload;
@@ -1345,7 +1331,7 @@ function  Pos(const substr : shortstring;c:Ansichar; Offset: Sizeint = 1): SizeI
 ****************************************************************************}
 ****************************************************************************}
 
 
 {$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
 {$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
-Procedure UniqueString(var S : RawByteString);{$ifdef FPC_HAS_CPSTRING}rtlproc;{$endif FPC_HAS_CPSTRING}{$ifdef SYSTEMINLINE}inline;{$endif}
+Procedure UniqueString(var S : RawByteString);rtlproc;{$ifdef SYSTEMINLINE}inline;{$endif}
 Function  Pos (const Substr : RawByteString; const Source : RawByteString; Offset: Sizeint = 1) : SizeInt;
 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 (c : AnsiChar; const s : RawByteString; Offset: Sizeint = 1) : SizeInt;
 Function  StringOfChar(c : Ansichar;l : SizeInt) : AnsiString;
 Function  StringOfChar(c : Ansichar;l : SizeInt) : AnsiString;
@@ -1518,7 +1504,7 @@ Procedure ChDir(const s:rawbytestring); overload;
 Procedure MkDir(const s:rawbytestring); overload;
 Procedure MkDir(const s:rawbytestring); overload;
 Procedure RmDir(const s:rawbytestring); overload;
 Procedure RmDir(const s:rawbytestring); overload;
 // defaultrtlfilesystemcodepage is returned here
 // defaultrtlfilesystemcodepage is returned here
-Procedure GetDir(drivenr:byte;var dir: rawbytestring);overload;{$ifdef FPC_HAS_CPSTRING}rtlproc;{$endif FPC_HAS_CPSTRING}
+Procedure GetDir(drivenr:byte;var dir: rawbytestring);overload;rtlproc;
 {$endif FPC_HAS_FEATURE_ANSISTRINGS}
 {$endif FPC_HAS_FEATURE_ANSISTRINGS}
 {$ifdef FPC_HAS_FEATURE_WIDESTRINGS}
 {$ifdef FPC_HAS_FEATURE_WIDESTRINGS}
 Procedure ChDir(const s:unicodestring); overload;
 Procedure ChDir(const s:unicodestring); overload;

+ 11 - 39
rtl/inc/text.inc

@@ -229,14 +229,12 @@ Begin
   TextRec(t).bufpos:=0;
   TextRec(t).bufpos:=0;
   TextRec(t).bufend:=0;
   TextRec(t).bufend:=0;
 
 
-{$ifdef FPC_HAS_CPSTRING}
 {$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
 {$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
   { if no codepage is yet assigned then assign default ansi codepage }
   { if no codepage is yet assigned then assign default ansi codepage }
   TextRec(t).CodePage:=TranslatePlaceholderCP(TextRec(t).CodePage);
   TextRec(t).CodePage:=TranslatePlaceholderCP(TextRec(t).CodePage);
 {$else FPC_HAS_FEATURE_ANSISTRINGS}
 {$else FPC_HAS_FEATURE_ANSISTRINGS}
   TextRec(t).CodePage:=0;
   TextRec(t).CodePage:=0;
 {$endif FPC_HAS_FEATURE_ANSISTRINGS}
 {$endif FPC_HAS_FEATURE_ANSISTRINGS}
-{$endif FPC_HAS_CPSTRING}
   FileFunc(TextRec(t).OpenFunc)(TextRec(t));
   FileFunc(TextRec(t).OpenFunc)(TextRec(t));
   { reset the mode to closed when an error has occurred }
   { reset the mode to closed when an error has occurred }
   if InOutRes<>0 then
   if InOutRes<>0 then
@@ -598,7 +596,7 @@ End;
 
 
 function GetTextCodePage(var T: Text): TSystemCodePage;
 function GetTextCodePage(var T: Text): TSystemCodePage;
 begin
 begin
-{$if defined(FPC_HAS_CPSTRING) and defined(FPC_HAS_FEATURE_ANSISTRINGS)}
+{$if defined(FPC_HAS_FEATURE_ANSISTRINGS)}
   GetTextCodePage:=TextRec(T).CodePage;
   GetTextCodePage:=TextRec(T).CodePage;
 {$else}
 {$else}
   GetTextCodePage:=0;
   GetTextCodePage:=0;
@@ -608,7 +606,7 @@ end;
 
 
 procedure SetTextCodePage(var T: Text; CodePage: TSystemCodePage);
 procedure SetTextCodePage(var T: Text; CodePage: TSystemCodePage);
 begin
 begin
-{$if defined(FPC_HAS_CPSTRING) and defined(FPC_HAS_FEATURE_ANSISTRINGS)}
+{$if defined(FPC_HAS_FEATURE_ANSISTRINGS)}
   TextRec(T).CodePage:=TranslatePlaceholderCP(CodePage);
   TextRec(T).CodePage:=TranslatePlaceholderCP(CodePage);
 {$endif}
 {$endif}
 end;
 end;
@@ -931,7 +929,7 @@ begin
           fpc_WriteBlanks(f,Len-SLen);
           fpc_WriteBlanks(f,Len-SLen);
         if SLen > 0 then
         if SLen > 0 then
           begin
           begin
-            {$if defined(FPC_HAS_CPSTRING) and defined(FPC_HAS_FEATURE_ANSISTRINGS)}
+            {$if defined(FPC_HAS_FEATURE_ANSISTRINGS)}
             if TextRec(f).CodePage<>TranslatePlaceholderCP(StringCodePage(S)) then
             if TextRec(f).CodePage<>TranslatePlaceholderCP(StringCodePage(S)) then
               begin
               begin
                 a:=fpc_AnsiStr_To_AnsiStr(S,TextRec(f).CodePage);
                 a:=fpc_AnsiStr_To_AnsiStr(S,TextRec(f).CodePage);
@@ -965,11 +963,7 @@ begin
         SLen:=Length(s);
         SLen:=Length(s);
         If Len>SLen Then
         If Len>SLen Then
           fpc_WriteBlanks(f,Len-SLen);
           fpc_WriteBlanks(f,Len-SLen);
-        {$ifdef FPC_HAS_CPSTRING}
         WideStringManager.Unicode2AnsiMoveProc(PUnicodeChar(S),a,TextRec(f).CodePage,SLen);
         WideStringManager.Unicode2AnsiMoveProc(PUnicodeChar(S),a,TextRec(f).CodePage,SLen);
-        {$else}
-        a:=s;
-        {$endif FPC_HAS_CPSTRING}
         { length(a) can be > slen, e.g. after utf-16 -> utf-8 }
         { length(a) can be > slen, e.g. after utf-16 -> utf-8 }
         fpc_WriteBuffer(f,PAnsiChar(a)^,Length(a));
         fpc_WriteBuffer(f,PAnsiChar(a)^,Length(a));
       end;
       end;
@@ -997,11 +991,7 @@ begin
         SLen:=Length(s);
         SLen:=Length(s);
         If Len>SLen Then
         If Len>SLen Then
           fpc_WriteBlanks(f,Len-SLen);
           fpc_WriteBlanks(f,Len-SLen);
-        {$ifdef FPC_HAS_CPSTRING}
         widestringmanager.Wide2AnsiMoveProc(PWideChar(s), a, TextRec(f).CodePage, SLen);
         widestringmanager.Wide2AnsiMoveProc(PWideChar(s), a, TextRec(f).CodePage, SLen);
-        {$else}
-        a:=s;
-        {$endif}
         { length(a) can be > slen, e.g. after utf-16 -> utf-8 }
         { length(a) can be > slen, e.g. after utf-16 -> utf-8 }
         fpc_WriteBuffer(f,PAnsiChar(a)^,Length(a));
         fpc_WriteBuffer(f,PAnsiChar(a)^,Length(a));
       end;
       end;
@@ -1386,11 +1376,7 @@ Begin
   If TextRec(t).BufPos>=TextRec(t).BufSize Then
   If TextRec(t).BufPos>=TextRec(t).BufSize Then
     FileFunc(TextRec(t).InOutFunc)(TextRec(t));
     FileFunc(TextRec(t).InOutFunc)(TextRec(t));
   { a widechar can be translated into more than a single ansichar }
   { a widechar can be translated into more than a single ansichar }
-  {$ifdef FPC_HAS_CPSTRING}
   widestringmanager.Wide2AnsiMoveProc(@c,a,TextRec(t).CodePage,1);
   widestringmanager.Wide2AnsiMoveProc(@c,a,TextRec(t).CodePage,1);
-  {$else}
-  a:=c;
-  {$endif}
   fpc_WriteBuffer(t,PAnsiChar(a)^,Length(a));
   fpc_WriteBuffer(t,PAnsiChar(a)^,Length(a));
 End;
 End;
 {$endif FPC_HAS_FEATURE_WIDESTRINGS}
 {$endif FPC_HAS_FEATURE_WIDESTRINGS}
@@ -1810,7 +1796,7 @@ End;
 
 
 
 
 {$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
 {$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
-Procedure fpc_Read_Text_AnsiStr(var f : Text;out s : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); [public, alias: 'FPC_READ_TEXT_ANSISTR']; iocheck; compilerproc;
+Procedure fpc_Read_Text_AnsiStr(var f : Text;out s : RawByteString;cp : TSystemCodePage); [public, alias: 'FPC_READ_TEXT_ANSISTR']; iocheck; compilerproc;
 var
 var
   slen,len : SizeInt;
   slen,len : SizeInt;
 Begin
 Begin
@@ -1823,15 +1809,13 @@ Begin
   Until len<255;
   Until len<255;
   // Set actual length
   // Set actual length
   SetLength(s,Slen);
   SetLength(s,Slen);
-  {$ifdef FPC_HAS_CPSTRING}
   SetCodePage(s,TextRec(f).CodePage,false);
   SetCodePage(s,TextRec(f).CodePage,false);
   cp:=TranslatePlaceholderCP(cp);
   cp:=TranslatePlaceholderCP(cp);
   if cp<>TextRec(f).CodePage then
   if cp<>TextRec(f).CodePage then
     s:=fpc_AnsiStr_To_AnsiStr(s,cp);
     s:=fpc_AnsiStr_To_AnsiStr(s,cp);
-  {$endif FPC_HAS_CPSTRING}
 End;
 End;
 
 
-Procedure fpc_Read_Text_AnsiStr_Intern(var f : Text;out s : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); [external name 'FPC_READ_TEXT_ANSISTR'];
+Procedure fpc_Read_Text_AnsiStr_Intern(var f : Text;out s : RawByteString;cp : TSystemCodePage); [external name 'FPC_READ_TEXT_ANSISTR'];
 {$endif FPC_HAS_FEATURE_ANSISTRINGS}
 {$endif FPC_HAS_FEATURE_ANSISTRINGS}
 
 
 
 
@@ -1841,13 +1825,9 @@ var
   s: RawByteString;
   s: RawByteString;
 Begin
 Begin
   // all standard input is assumed to be ansi-encoded
   // all standard input is assumed to be ansi-encoded
-  fpc_Read_Text_AnsiStr_Intern(f,s{$ifdef FPC_HAS_CPSTRING},DefaultSystemCodePage{$endif FPC_HAS_CPSTRING});
+  fpc_Read_Text_AnsiStr_Intern(f,s,DefaultSystemCodePage);
   // Convert to unicodestring
   // Convert to unicodestring
-  {$ifdef FPC_HAS_CPSTRING}
   widestringmanager.Ansi2UnicodeMoveProc(PAnsiChar(s),StringCodePage(s),us,Length(s));
   widestringmanager.Ansi2UnicodeMoveProc(PAnsiChar(s),StringCodePage(s),us,Length(s));
-  {$else}
-  us:=s;
-  {$endif}
 End;
 End;
 {$endif FPC_HAS_FEATURE_WIDESTRINGS}
 {$endif FPC_HAS_FEATURE_WIDESTRINGS}
 
 
@@ -1857,13 +1837,9 @@ var
   s: RawByteString;
   s: RawByteString;
 Begin
 Begin
   // all standard input is assumed to be ansi-encoded
   // all standard input is assumed to be ansi-encoded
-  fpc_Read_Text_AnsiStr_Intern(f,s{$ifdef FPC_HAS_CPSTRING},DefaultSystemCodePage{$endif FPC_HAS_CPSTRING});
+  fpc_Read_Text_AnsiStr_Intern(f,s,DefaultSystemCodePage);
   // Convert to widestring
   // Convert to widestring
-  {$ifdef FPC_HAS_CPSTRING}
   widestringmanager.Ansi2WideMoveProc(PAnsiChar(s),StringCodePage(s),ws,Length(s));
   widestringmanager.Ansi2WideMoveProc(PAnsiChar(s),StringCodePage(s),ws,Length(s));
-  {$else}
-  ws:=s;
-  {$endif}
 End;
 End;
 {$endif FPC_WIDESTRING_EQUAL_UNICODESTRING}
 {$endif FPC_WIDESTRING_EQUAL_UNICODESTRING}
 
 
@@ -1920,11 +1896,7 @@ Begin
         else
         else
           begin
           begin
             { valid code point -> convert to widestring}
             { valid code point -> convert to widestring}
-            {$ifdef FPC_HAS_CPSTRING}
             widestringmanager.Ansi2WideMoveProc(@str[0],TextRec(f).CodePage,ws,i+1);
             widestringmanager.Ansi2WideMoveProc(@str[0],TextRec(f).CodePage,ws,i+1);
-            {$else}
-            widestringmanager.Ansi2WideMoveProc(@str[0],DefaultSystemCodePage,ws,i+1);
-            {$endif}
             { has to be exactly one widechar }
             { has to be exactly one widechar }
             if length(ws)=1 then
             if length(ws)=1 then
               begin
               begin
@@ -2553,7 +2525,7 @@ begin
   t.mode:=fmOutput;
   t.mode:=fmOutput;
   t.OpenFunc:=nil;
   t.OpenFunc:=nil;
   t.CloseFunc:=nil;
   t.CloseFunc:=nil;
-{$if defined(FPC_HAS_CPSTRING) and defined(FPC_HAS_FEATURE_ANSISTRINGS)}
+{$if defined(FPC_HAS_FEATURE_ANSISTRINGS)}
   t.CodePage:=TranslatePlaceholderCP(cp);
   t.CodePage:=TranslatePlaceholderCP(cp);
 {$endif}
 {$endif}
 end;
 end;
@@ -2664,7 +2636,7 @@ begin
   t.mode:=fmInput;
   t.mode:=fmInput;
   t.OpenFunc:=nil;
   t.OpenFunc:=nil;
   t.CloseFunc:=nil;
   t.CloseFunc:=nil;
-{$if defined(FPC_HAS_CPSTRING) and defined(FPC_HAS_FEATURE_ANSISTRINGS)}
+{$if defined(FPC_HAS_FEATURE_ANSISTRINGS)}
   t.CodePage:=TranslatePlaceholderCP(cp);
   t.CodePage:=TranslatePlaceholderCP(cp);
   {$endif}
   {$endif}
   PSizeInt(@t.userdata[BytesReadIndex])^:=0;
   PSizeInt(@t.userdata[BytesReadIndex])^:=0;
@@ -2763,14 +2735,14 @@ begin
     fmInput :
     fmInput :
       begin
       begin
         TextRec(f).InOutFunc:=@FileReadFunc;
         TextRec(f).InOutFunc:=@FileReadFunc;
-      {$if defined(FPC_HAS_CPSTRING) and defined(FPC_HAS_FEATURE_WIDESTRINGS)}
+      {$if defined(FPC_HAS_FEATURE_WIDESTRINGS)}
         TextRec(f).CodePage:=WideStringManager.GetStandardCodePageProc(scpConsoleInput);
         TextRec(f).CodePage:=WideStringManager.GetStandardCodePageProc(scpConsoleInput);
       {$endif}
       {$endif}
       end;
       end;
     fmOutput :
     fmOutput :
       begin
       begin
         TextRec(f).InOutFunc:=@FileWriteFunc;
         TextRec(f).InOutFunc:=@FileWriteFunc;
-        {$if defined(FPC_HAS_CPSTRING) and defined(FPC_HAS_FEATURE_WIDESTRINGS)}
+        {$if defined(FPC_HAS_FEATURE_WIDESTRINGS)}
         TextRec(f).CodePage:=WideStringManager.GetStandardCodePageProc(scpConsoleOutput);
         TextRec(f).CodePage:=WideStringManager.GetStandardCodePageProc(scpConsoleOutput);
       {$endif}
       {$endif}
         if Do_Isdevice(hdl) then
         if Do_Isdevice(hdl) then

+ 0 - 2
rtl/inc/textrec.inc

@@ -54,9 +54,7 @@ type
     name      : array[0..textrecnamelength-1] of TFileTextRecChar;
     name      : array[0..textrecnamelength-1] of TFileTextRecChar;
     LineEnd   : TLineEndStr;
     LineEnd   : TLineEndStr;
     buffer    : textbuf;
     buffer    : textbuf;
-{$ifdef FPC_HAS_CPSTRING}
     CodePage  : TSystemCodePage;
     CodePage  : TSystemCodePage;
-{$endif}
 {$ifdef FPC_HAS_FEATURE_UNICODESTRINGS}
 {$ifdef FPC_HAS_FEATURE_UNICODESTRINGS}
     FullName  : Pointer;
     FullName  : Pointer;
 {$endif FPC_HAS_FEATURE_UNICODESTRINGS}
 {$endif FPC_HAS_FEATURE_UNICODESTRINGS}

+ 2 - 2
rtl/inc/ustringh.inc

@@ -28,8 +28,8 @@ Function  UpCase(c:UnicodeChar):UnicodeChar;
 Function LowerCase(const s : UnicodeString) : UnicodeString;
 Function LowerCase(const s : UnicodeString) : UnicodeString;
 Function  LowerCase(c:UnicodeChar):UnicodeChar;
 Function  LowerCase(c:UnicodeChar):UnicodeChar;
 
 
-Procedure {$ifdef FPC_HAS_CPSTRING}fpc_setstring_unicodestr_pwidechar{$else}SetString{$endif}(Out S : UnicodeString; Buf : PUnicodeChar; Len : SizeInt); {$ifdef FPC_HAS_CPSTRING} compilerproc; {$endif FPC_HAS_CPSTRING}
-Procedure {$ifdef FPC_HAS_CPSTRING}fpc_setstring_unicodestr_pansichar{$else}SetString{$endif}(Out S : UnicodeString; Buf : PAnsiChar; Len : SizeInt); {$ifdef FPC_HAS_CPSTRING} compilerproc; {$endif FPC_HAS_CPSTRING}
+Procedure fpc_setstring_unicodestr_pwidechar(Out S : UnicodeString; Buf : PUnicodeChar; Len : SizeInt); compilerproc;
+Procedure fpc_setstring_unicodestr_pansichar(Out S : UnicodeString; Buf : PAnsiChar; Len : SizeInt); compilerproc;
 
 
 function WideCharToString(S : PWideChar) : UnicodeString;
 function WideCharToString(S : PWideChar) : UnicodeString;
 function StringToWideChar(const Src : RawByteString;Dest : PWideChar;DestSize : SizeInt) : PWideChar;
 function StringToWideChar(const Src : RawByteString;Dest : PWideChar;DestSize : SizeInt) : PWideChar;

+ 10 - 47
rtl/inc/ustrings.inc

@@ -295,26 +295,17 @@ end;
 
 
 {$ifndef FPC_HAS_UNICODESTR_TO_ANSISTR}
 {$ifndef FPC_HAS_UNICODESTR_TO_ANSISTR}
 {$define FPC_HAS_UNICODESTR_TO_ANSISTR}
 {$define FPC_HAS_UNICODESTR_TO_ANSISTR}
-Function fpc_UnicodeStr_To_AnsiStr (const S2 : UnicodeString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}): AnsiString; compilerproc;
+Function fpc_UnicodeStr_To_AnsiStr (const S2 : UnicodeString;cp : TSystemCodePage): AnsiString; compilerproc;
 {
 {
   Converts a UnicodeString to an AnsiString
   Converts a UnicodeString to an AnsiString
 }
 }
 Var
 Var
   Size : SizeInt;
   Size : SizeInt;
-{$ifndef FPC_HAS_CPSTRING}
-  cp : TSystemCodePage;
-{$endif FPC_HAS_CPSTRING}
 begin
 begin
-{$ifndef FPC_HAS_CPSTRING}
-  cp:=DefaultSystemCodePage;
-{$endif FPC_HAS_CPSTRING}
   result:='';
   result:='';
   Size:=Length(S2);
   Size:=Length(S2);
   if Size>0 then
   if Size>0 then
-  begin
-    cp:=TranslatePlaceholderCP(cp);
-    widestringmanager.Unicode2AnsiMoveProc(PUnicodeChar(Pointer(S2)),result,cp,Size);
-  end;
+    widestringmanager.Unicode2AnsiMoveProc(PUnicodeChar(Pointer(S2)),result,TranslatePlaceholderCP(cp),Size);
 end;
 end;
 {$endif FPC_HAS_UNICODESTR_TO_ANSISTR}
 {$endif FPC_HAS_UNICODESTR_TO_ANSISTR}
 
 
@@ -379,25 +370,16 @@ end;
 
 
 {$ifndef FPC_HAS_PWIDECHAR_TO_ANSISTR}
 {$ifndef FPC_HAS_PWIDECHAR_TO_ANSISTR}
 {$define FPC_HAS_PWIDECHAR_TO_ANSISTR}
 {$define FPC_HAS_PWIDECHAR_TO_ANSISTR}
-Function fpc_PWideChar_To_AnsiStr(const p : pwidechar{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}): ansistring; compilerproc;
+Function fpc_PWideChar_To_AnsiStr(const p : pwidechar;cp : TSystemCodePage): ansistring; compilerproc;
 var
 var
   Size : SizeInt;
   Size : SizeInt;
-{$ifndef FPC_HAS_CPSTRING}
-  cp : TSystemCodePage;
-{$endif FPC_HAS_CPSTRING}
 begin
 begin
-{$ifndef FPC_HAS_CPSTRING}
-  cp:=DefaultSystemCodePage;
-{$endif FPC_HAS_CPSTRING}
   result:='';
   result:='';
   if p=nil then
   if p=nil then
     exit;
     exit;
   Size := IndexWord(p^, -1, 0);
   Size := IndexWord(p^, -1, 0);
   if Size>0 then
   if Size>0 then
-  begin
-    cp:=TranslatePlaceholderCP(cp);
-    widestringmanager.Wide2AnsiMoveProc(P,result,cp,Size);
-  end;
+    widestringmanager.Wide2AnsiMoveProc(P,result,TranslatePlaceholderCP(cp),Size);
 end;
 end;
 {$endif FPC_HAS_PWIDECHAR_TO_ANSISTR}
 {$endif FPC_HAS_PWIDECHAR_TO_ANSISTR}
 
 
@@ -630,20 +612,12 @@ end;
 
 
 {$ifndef FPC_HAS_UCHAR_TO_ANSISTR}
 {$ifndef FPC_HAS_UCHAR_TO_ANSISTR}
 {$define FPC_HAS_UCHAR_TO_ANSISTR}
 {$define FPC_HAS_UCHAR_TO_ANSISTR}
-Function fpc_UChar_To_AnsiStr(const c : UnicodeChar{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}): AnsiString; compilerproc;
+Function fpc_UChar_To_AnsiStr(const c : UnicodeChar;cp : TSystemCodePage): AnsiString; compilerproc;
 {
 {
   Converts a UnicodeChar to a AnsiString;
   Converts a UnicodeChar to a AnsiString;
 }
 }
-{$ifndef FPC_HAS_CPSTRING}
-var
-  cp : TSystemCodePage;
-{$endif FPC_HAS_CPSTRING}
 begin
 begin
-{$ifndef FPC_HAS_CPSTRING}
-  cp:=DefaultSystemCodePage;
-{$endif FPC_HAS_CPSTRING}
-  cp:=TranslatePlaceholderCP(cp);
-  widestringmanager.Unicode2AnsiMoveProc(@c, fpc_UChar_To_AnsiStr, cp, 1);
+  widestringmanager.Unicode2AnsiMoveProc(@c, fpc_UChar_To_AnsiStr, TranslatePlaceholderCP(cp), 1);
 end;
 end;
 {$endif FPC_HAS_UCHAR_TO_ANSISTR}
 {$endif FPC_HAS_UCHAR_TO_ANSISTR}
 
 
@@ -743,16 +717,10 @@ end;
 
 
 {$ifndef FPC_HAS_WIDECHARARRAY_TO_ANSISTR}
 {$ifndef FPC_HAS_WIDECHARARRAY_TO_ANSISTR}
 {$define FPC_HAS_WIDECHARARRAY_TO_ANSISTR}
 {$define FPC_HAS_WIDECHARARRAY_TO_ANSISTR}
-Function fpc_WideCharArray_To_AnsiStr(const arr: array of widechar; {$ifdef FPC_HAS_CPSTRING}cp : TSystemCodePage;{$endif FPC_HAS_CPSTRING} zerobased: boolean = true): AnsiString; compilerproc;
+Function fpc_WideCharArray_To_AnsiStr(const arr: array of widechar; cp : TSystemCodePage; zerobased: boolean = true): AnsiString; compilerproc;
 var
 var
   i  : SizeInt;
   i  : SizeInt;
-{$ifndef FPC_HAS_CPSTRING}
-  cp : TSystemCodePage;
-{$endif FPC_HAS_CPSTRING}
 begin
 begin
-{$ifndef FPC_HAS_CPSTRING}
-  cp:=DefaultSystemCodePage;
-{$endif FPC_HAS_CPSTRING}
   if (zerobased) then
   if (zerobased) then
     begin
     begin
       i:=IndexWord(arr,high(arr)+1,0);
       i:=IndexWord(arr,high(arr)+1,0);
@@ -762,10 +730,7 @@ begin
   else
   else
     i := high(arr)+1;
     i := high(arr)+1;
   if i > 0 then
   if i > 0 then
-  begin
-    cp:=TranslatePlaceholderCP(cp);
-    widestringmanager.Wide2AnsiMoveProc (pwidechar(@arr),RawByteString(fpc_WideCharArray_To_AnsiStr),cp,i);
-  end
+    widestringmanager.Wide2AnsiMoveProc (pwidechar(@arr),RawByteString(fpc_WideCharArray_To_AnsiStr),TranslatePlaceholderCP(cp),i)
   else
   else
     fpc_WideCharArray_To_AnsiStr:='';
     fpc_WideCharArray_To_AnsiStr:='';
 end;
 end;
@@ -1394,7 +1359,7 @@ end;
 
 
 {$ifndef FPC_HAS_SETSTRING_UNICODESTR_PUNICODECHAR}
 {$ifndef FPC_HAS_SETSTRING_UNICODESTR_PUNICODECHAR}
 {$define FPC_HAS_SETSTRING_UNICODESTR_PUNICODECHAR}
 {$define FPC_HAS_SETSTRING_UNICODESTR_PUNICODECHAR}
-Procedure {$ifdef FPC_HAS_CPSTRING}fpc_setstring_unicodestr_pwidechar{$else}SetString{$endif}(Out S : UnicodeString; Buf : PUnicodeChar; Len : SizeInt); {$ifdef FPC_HAS_CPSTRING} compilerproc; {$endif FPC_HAS_CPSTRING}
+Procedure fpc_setstring_unicodestr_pwidechar(Out S : UnicodeString; Buf : PUnicodeChar; Len : SizeInt); compilerproc;
 begin
 begin
   SetLength(S,Len);
   SetLength(S,Len);
   If (Buf<>Nil) and (Len>0) then
   If (Buf<>Nil) and (Len>0) then
@@ -1405,7 +1370,7 @@ end;
 
 
 {$ifndef FPC_HAS_SETSTRING_UNICODESTR_PCHAR}
 {$ifndef FPC_HAS_SETSTRING_UNICODESTR_PCHAR}
 {$define FPC_HAS_SETSTRING_UNICODESTR_PCHAR}
 {$define FPC_HAS_SETSTRING_UNICODESTR_PCHAR}
-Procedure {$ifdef FPC_HAS_CPSTRING}fpc_setstring_unicodestr_pansichar{$else}SetString{$endif}(Out S : UnicodeString; Buf : PAnsiChar; Len : SizeInt); {$ifdef FPC_HAS_CPSTRING} compilerproc; {$endif FPC_HAS_CPSTRING}
+Procedure fpc_setstring_unicodestr_pansichar(Out S : UnicodeString; Buf : PAnsiChar; Len : SizeInt); compilerproc;
 begin
 begin
   If (Buf<>Nil) and (Len>0) then
   If (Buf<>Nil) and (Len>0) then
     widestringmanager.Ansi2UnicodeMoveProc(Buf,DefaultSystemCodePage,S,Len)
     widestringmanager.Ansi2UnicodeMoveProc(Buf,DefaultSystemCodePage,S,Len)
@@ -2298,11 +2263,9 @@ function StringRefCount(const S: UnicodeString): SizeInt; overload;
 
 
 function StringCodePage(const S: UnicodeString): TSystemCodePage; overload;
 function StringCodePage(const S: UnicodeString): TSystemCodePage; overload;
   begin
   begin
-{$ifdef FPC_HAS_CPSTRING}
     if assigned(Pointer(S)) then
     if assigned(Pointer(S)) then
       Result:=PUnicodeRec(pointer(S)-UnicodeFirstOff)^.CodePage
       Result:=PUnicodeRec(pointer(S)-UnicodeFirstOff)^.CodePage
     else
     else
-{$endif FPC_HAS_CPSTRING}
       Result:=DefaultUnicodeCodePage;
       Result:=DefaultUnicodeCodePage;
   end;
   end;
 
 

+ 2 - 2
rtl/inc/wstringh.inc

@@ -26,8 +26,8 @@ Function Pos (const c : ShortString; Const s : WideString; Offset : SizeInt = 1)
 
 
 Function UpCase(const s : WideString) : WideString;
 Function UpCase(const s : WideString) : WideString;
 
 
-Procedure {$ifdef FPC_HAS_CPSTRING}fpc_setstring_widestr_pwidechar{$else}SetString{$endif}(Out S : WideString; Buf : PWideChar; Len : SizeInt); {$ifdef FPC_HAS_CPSTRING} compilerproc; {$endif FPC_HAS_CPSTRING}
-Procedure {$ifdef FPC_HAS_CPSTRING}fpc_setstring_widestr_pansichar{$else}SetString{$endif}(Out S : WideString; Buf : PAnsiChar; Len : SizeInt); {$ifdef FPC_HAS_CPSTRING} compilerproc; {$endif FPC_HAS_CPSTRING}
+Procedure fpc_setstring_widestr_pwidechar(Out S : WideString; Buf : PWideChar; Len : SizeInt); compilerproc;
+Procedure fpc_setstring_widestr_pansichar(Out S : WideString; Buf : PAnsiChar; Len : SizeInt); compilerproc;
 
 
 procedure DefaultAnsi2WideMove(source:PAnsiChar;cp : TSystemCodePage;var dest:widestring;len:SizeInt);
 procedure DefaultAnsi2WideMove(source:PAnsiChar;cp : TSystemCodePage;var dest:widestring;len:SizeInt);
 
 

+ 6 - 16
rtl/inc/wstrings.inc

@@ -35,12 +35,11 @@ Type
   PWideRec = ^TWideRec;
   PWideRec = ^TWideRec;
   TWideRec = Packed Record
   TWideRec = Packed Record
     Len   : DWord;
     Len   : DWord;
-    First : WideChar;
   end;
   end;
 
 
 Const
 Const
   WideRecLen = SizeOf(TWideRec);
   WideRecLen = SizeOf(TWideRec);
-  WideFirstOff = SizeOf(TWideRec)-sizeof(WideChar);
+  WideFirstOff = SizeOf(TWideRec);
 
 
 {
 {
   Default WideChar <-> AnsiChar conversion is to only convert the
   Default WideChar <-> AnsiChar conversion is to only convert the
@@ -95,8 +94,8 @@ begin
       If P<>Nil then
       If P<>Nil then
         begin
         begin
          PWideRec(P)^.Len:=Len*2;     { Initial length }
          PWideRec(P)^.Len:=Len*2;     { Initial length }
-         PWideRec(P)^.First:=#0;      { Terminating #0 }
          inc(p,WideFirstOff);         { Points to widestring now }
          inc(p,WideFirstOff);         { Points to widestring now }
+         PWideChar(P)^:=#0;           { Terminating #0 }
         end
         end
       else
       else
         WideStringError;
         WideStringError;
@@ -176,26 +175,17 @@ begin
 end;
 end;
 
 
 
 
-Function fpc_WideStr_To_AnsiStr (const S2 : WideString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}): AnsiString; compilerproc;
+Function fpc_WideStr_To_AnsiStr (const S2 : WideString;cp : TSystemCodePage): AnsiString; compilerproc;
 {
 {
   Converts a WideString to an AnsiString
   Converts a WideString to an AnsiString
 }
 }
 Var
 Var
   Size : SizeInt;
   Size : SizeInt;
-{$ifndef FPC_HAS_CPSTRING}
-  cp : TSystemCodePage;
-{$endif FPC_HAS_CPSTRING}
 begin
 begin
-{$ifndef FPC_HAS_CPSTRING}
-  cp:=DefaultSystemCodePage;
-{$endif FPC_HAS_CPSTRING}
   result:='';
   result:='';
   Size:=Length(S2);
   Size:=Length(S2);
   if Size>0 then
   if Size>0 then
-  begin
-    cp:=TranslatePlaceholderCP(cp);
-    widestringmanager.Wide2AnsiMoveProc(PWideChar(Pointer(S2)),result,cp,Size);
-  end;
+    widestringmanager.Wide2AnsiMoveProc(PWideChar(Pointer(S2)),result,TranslatePlaceholderCP(cp),Size);
 end;
 end;
 
 
 
 
@@ -743,7 +733,7 @@ begin
 end;
 end;
 
 
 
 
-Procedure {$ifdef FPC_HAS_CPSTRING}fpc_setstring_widestr_pwidechar{$else}SetString{$endif}(Out S : WideString; Buf : PWideChar; Len : SizeInt); {$ifdef FPC_HAS_CPSTRING} compilerproc; {$endif FPC_HAS_CPSTRING}
+Procedure fpc_setstring_widestr_pwidechar(Out S : WideString; Buf : PWideChar; Len : SizeInt); compilerproc;
 begin
 begin
   SetLength(S,Len);
   SetLength(S,Len);
   If (Buf<>Nil) and (Len>0) then
   If (Buf<>Nil) and (Len>0) then
@@ -751,7 +741,7 @@ begin
 end;
 end;
 
 
 
 
-Procedure {$ifdef FPC_HAS_CPSTRING}fpc_setstring_widestr_pansichar{$else}SetString{$endif}(Out S : WideString; Buf : PAnsiChar; Len : SizeInt); {$ifdef FPC_HAS_CPSTRING} compilerproc; {$endif FPC_HAS_CPSTRING}
+Procedure fpc_setstring_widestr_pansichar(Out S : WideString; Buf : PAnsiChar; Len : SizeInt); compilerproc;
 begin
 begin
   If (Buf<>Nil) and (Len>0) then
   If (Buf<>Nil) and (Len>0) then
     widestringmanager.Ansi2WideMoveProc(Buf,DefaultSystemCodePage,S,Len)
     widestringmanager.Ansi2WideMoveProc(Buf,DefaultSystemCodePage,S,Len)

+ 12 - 32
rtl/java/jastrings.inc

@@ -246,7 +246,7 @@ end;
 
 
 {$ifndef FPC_HAS_PCHAR_ANSISTR_INTERN_CHARMOVE}
 {$ifndef FPC_HAS_PCHAR_ANSISTR_INTERN_CHARMOVE}
 {$define FPC_HAS_PCHAR_ANSISTR_INTERN_CHARMOVE}
 {$define FPC_HAS_PCHAR_ANSISTR_INTERN_CHARMOVE}
-procedure fpc_pchar_ansistr_intern_charmove(const src: PAnsiChar; const srcindex: sizeint; var dst: rawbytestring; const dstindex, len: sizeint); {$ifdef FPC_HAS_CPSTRING}rtlproc;{$endif} {$ifdef SYSTEMINLINE}inline;{$endif}
+procedure fpc_pchar_ansistr_intern_charmove(const src: PAnsiChar; const srcindex: sizeint; var dst: rawbytestring; const dstindex, len: sizeint); rtlproc; {$ifdef SYSTEMINLINE}inline;{$endif}
 begin
 begin
   JLSystem.arraycopy(JLObject(src),srcindex,JLObject(AnsistringClass(dst).fdata),dstindex,len);
   JLSystem.arraycopy(JLObject(src),srcindex,JLObject(AnsistringClass(dst).fdata),dstindex,len);
 end;
 end;
@@ -255,7 +255,7 @@ end;
 
 
 {$ifndef FPC_HAS_PCHAR_PCHAR_INTERN_CHARMOVE}
 {$ifndef FPC_HAS_PCHAR_PCHAR_INTERN_CHARMOVE}
 {$define FPC_HAS_PCHAR_PCHAR_INTERN_CHARMOVE}
 {$define FPC_HAS_PCHAR_PCHAR_INTERN_CHARMOVE}
-procedure fpc_pchar_pchar_intern_charmove(const src: PAnsiChar; const srcindex: sizeint; const dst: PAnsiChar; const dstindex, len: sizeint); {$ifdef FPC_HAS_CPSTRING}rtlproc;{$endif} {$ifdef SYSTEMINLINE}inline;{$endif}
+procedure fpc_pchar_pchar_intern_charmove(const src: PAnsiChar; const srcindex: sizeint; const dst: PAnsiChar; const dstindex, len: sizeint); rtlproc; {$ifdef SYSTEMINLINE}inline;{$endif}
 begin
 begin
   JLSystem.arraycopy(JLObject(src),srcindex,JLObject(dst),dstindex,len);
   JLSystem.arraycopy(JLObject(src),srcindex,JLObject(dst),dstindex,len);
 end;
 end;
@@ -264,7 +264,7 @@ end;
 
 
 {$ifndef FPC_HAS_SHORTSTR_ANSISTR_INTERN_CHARMOVE}
 {$ifndef FPC_HAS_SHORTSTR_ANSISTR_INTERN_CHARMOVE}
 {$define FPC_HAS_SHORTSTR_ANSISTR_INTERN_CHARMOVE}
 {$define FPC_HAS_SHORTSTR_ANSISTR_INTERN_CHARMOVE}
-procedure fpc_shortstr_ansistr_intern_charmove(const src: shortstring; const srcindex: sizeint; var dst: rawbytestring; const dstindex, len: sizeint); {$ifdef FPC_HAS_CPSTRING}rtlproc;{$endif} {$ifdef SYSTEMINLINE}inline;{$endif}
+procedure fpc_shortstr_ansistr_intern_charmove(const src: shortstring; const srcindex: sizeint; var dst: rawbytestring; const dstindex, len: sizeint); rtlproc; {$ifdef SYSTEMINLINE}inline;{$endif}
 begin
 begin
   JLSystem.arraycopy(JLObject(ShortStringClass(@src).fdata),srcindex-1,JLObject(AnsistringClass(dst).fdata),dstindex,len);
   JLSystem.arraycopy(JLObject(ShortStringClass(@src).fdata),srcindex-1,JLObject(AnsistringClass(dst).fdata),dstindex,len);
 end;
 end;
@@ -302,19 +302,15 @@ end;
 
 
 {$ifndef FPC_HAS_ANSISTR_CONCAT}
 {$ifndef FPC_HAS_ANSISTR_CONCAT}
 {$define FPC_HAS_ANSISTR_CONCAT}
 {$define FPC_HAS_ANSISTR_CONCAT}
-procedure fpc_AnsiStr_Concat (var DestS:RawByteString;const S1,S2 : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc;
+procedure fpc_AnsiStr_Concat (var DestS:RawByteString;const S1,S2 : RawByteString;cp : TSystemCodePage); compilerproc;
 Var
 Var
   S1Len, S2Len: SizeInt;
   S1Len, S2Len: SizeInt;
   same : boolean;
   same : boolean;
   S1CP, S2CP, DestCP: TSystemCodePage;
   S1CP, S2CP, DestCP: TSystemCodePage;
 begin
 begin
-{$ifdef FPC_HAS_CPSTRING}
   DestCP:=cp;
   DestCP:=cp;
   if DestCp=CP_NONE then
   if DestCp=CP_NONE then
     DestCP:=DefaultSystemCodePage;
     DestCP:=DefaultSystemCodePage;
-{$else FPC_HAS_CPSTRING}
-  DestCP:=StringCodePage(DestS);
-{$endif FPC_HAS_CPSTRING}
   DestCP:=TranslatePlaceholderCP(DestCP);
   DestCP:=TranslatePlaceholderCP(DestCP);
   { if codepages are different then concat using unicodestring,
   { if codepages are different then concat using unicodestring,
     but avoid conversions if either addend is empty (StringCodePage will return
     but avoid conversions if either addend is empty (StringCodePage will return
@@ -329,7 +325,6 @@ begin
   else
   else
     S2CP:=StringCodePage(S2);
     S2CP:=StringCodePage(S2);
   S2CP:=TranslatePlaceholderCP(S2CP);
   S2CP:=TranslatePlaceholderCP(S2CP);
-{$ifdef FPC_HAS_CPSTRING}
   { if the result is rawbytestring and both strings have the same code page,
   { if the result is rawbytestring and both strings have the same code page,
     keep that code page or keep the code page if the other string is empty }
     keep that code page or keep the code page if the other string is empty }
   if cp=CP_NONE then
   if cp=CP_NONE then
@@ -339,7 +334,6 @@ begin
      else if Length(S1)=0 then
      else if Length(S1)=0 then
        DestCP:=S2CP;
        DestCP:=S2CP;
     end;
     end;
-{$endif FPC_HAS_CPSTRING}
   if ((S1CP<>DestCP) and (Length(s1)>0)) or ((S2CP<>DestCP) and (Length(s2)>0)) then
   if ((S1CP<>DestCP) and (Length(s1)>0)) or ((S2CP<>DestCP) and (Length(s2)>0)) then
     begin
     begin
       ansistr_concat_complex(DestS,S1,S2,DestCP);
       ansistr_concat_complex(DestS,S1,S2,DestCP);
@@ -417,7 +411,7 @@ end;
 Function fpc_AnsiStr_To_AnsiStr (const S : RawByteString;cp : TSystemCodePage): RawByteString; [external name 'fpc_ansistr_to_ansistr'];
 Function fpc_AnsiStr_To_AnsiStr (const S : RawByteString;cp : TSystemCodePage): RawByteString; [external name 'fpc_ansistr_to_ansistr'];
 
 
 {$define FPC_HAS_ANSISTR_CONCAT_MULTI}
 {$define FPC_HAS_ANSISTR_CONCAT_MULTI}
-procedure fpc_AnsiStr_Concat_multi (var DestS:RawByteString;const sarr:array of RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc;
+procedure fpc_AnsiStr_Concat_multi (var DestS:RawByteString;const sarr:array of RawByteString;cp : TSystemCodePage); compilerproc;
 Var
 Var
   lowstart,
   lowstart,
   nonemptystart,
   nonemptystart,
@@ -436,13 +430,9 @@ begin
       DestS:='';
       DestS:='';
       exit;
       exit;
     end;
     end;
-{$ifdef FPC_HAS_CPSTRING}
   DestCP:=cp;
   DestCP:=cp;
   if DestCp=CP_NONE then
   if DestCp=CP_NONE then
     DestCP:=DefaultSystemCodePage;
     DestCP:=DefaultSystemCodePage;
-{$else FPC_HAS_CPSTRING}
-  DestCP:=StringCodePage(DestS);
-{$endif FPC_HAS_CPSTRING}
   lowstart:=low(sarr);
   lowstart:=low(sarr);
   { skip empty strings }
   { skip empty strings }
   while (lowstart<=high(sarr)) and
   while (lowstart<=high(sarr)) and
@@ -478,12 +468,10 @@ begin
       widestringmanager.Unicode2AnsiMoveProc(PUnicodeChar(JLString(U).toCharArray),DestS,DestCP,Length(U));
       widestringmanager.Unicode2AnsiMoveProc(PUnicodeChar(JLString(U).toCharArray),DestS,DestCP,Length(U));
       exit;
       exit;
     end;
     end;
-  {$ifdef FPC_HAS_CPSTRING}
-    { if the result is rawbytestring and all strings have the same code page,
-      keep that code page }
-    if cp=CP_NONE then
-      DestCP:=tmpCP;
-  {$endif FPC_HAS_CPSTRING}
+  { if the result is rawbytestring and all strings have the same code page,
+    keep that code page }
+  if cp=CP_NONE then
+    DestCP:=tmpCP;
 
 
   nonemptystart:=lowstart;
   nonemptystart:=lowstart;
   { Check for another reuse, then we can't use
   { Check for another reuse, then we can't use
@@ -560,12 +548,9 @@ end;
 
 
 
 
 {$define FPC_HAS_PCHAR_TO_ANSISTR}
 {$define FPC_HAS_PCHAR_TO_ANSISTR}
-Function fpc_PChar_To_AnsiStr(const p : PAnsiChar{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}): RawByteString; compilerproc;
+Function fpc_PChar_To_AnsiStr(const p : PAnsiChar;cp : TSystemCodePage): RawByteString; compilerproc;
 Var
 Var
   L : SizeInt;
   L : SizeInt;
-{$ifndef FPC_HAS_CPSTRING}
-  cp : TSystemCodePage;
-{$endif FPC_HAS_CPSTRING}
 begin
 begin
   if (not assigned(p)) or (p[0]=#0) Then
   if (not assigned(p)) or (p[0]=#0) Then
     L := 0
     L := 0
@@ -574,13 +559,8 @@ begin
   SetLength(fpc_PChar_To_AnsiStr,L);
   SetLength(fpc_PChar_To_AnsiStr,L);
   if L > 0 then
   if L > 0 then
     begin
     begin
-{$ifdef FPC_HAS_CPSTRING}
-      cp:=TranslatePlaceholderCP(cp);
-{$else FPC_HAS_CPSTRING}
-      cp:=DefaultSystemCodePage;
-{$endif FPC_HAS_CPSTRING}
       fpc_pchar_ansistr_intern_charmove(p,0,fpc_PChar_To_AnsiStr,0,L);
       fpc_pchar_ansistr_intern_charmove(p,0,fpc_PChar_To_AnsiStr,0,L);
-      SetCodePage(fpc_PChar_To_AnsiStr,cp,False);
+      SetCodePage(fpc_PChar_To_AnsiStr,TranslatePlaceholderCP(cp),False);
     end;
     end;
 end;
 end;
 
 
@@ -723,7 +703,7 @@ end;
 
 
 
 
 {$define FPC_HAS_ANSISTR_SETLENGTH}
 {$define FPC_HAS_ANSISTR_SETLENGTH}
-Procedure fpc_AnsiStr_SetLength (Var S : RawByteString; l : SizeInt{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING});[Public,Alias : 'FPC_ANSISTR_SETLENGTH'];  compilerproc;
+Procedure fpc_AnsiStr_SetLength (Var S : RawByteString; l : SizeInt;cp : TSystemCodePage);[Public,Alias : 'FPC_ANSISTR_SETLENGTH'];  compilerproc;
 {
 {
   Sets The length of string S to L.
   Sets The length of string S to L.
   Makes sure S is unique, and contains enough room.
   Makes sure S is unique, and contains enough room.

+ 25 - 25
rtl/java/jcompproc.inc

@@ -97,16 +97,16 @@ procedure fpc_ShortStr_Currency({$ifdef cpujvm}constref{$endif} c : currency; le
 procedure fpc_chararray_sint(v : valsint;len : SizeInt;out a : array of AnsiChar); compilerproc;
 procedure fpc_chararray_sint(v : valsint;len : SizeInt;out a : array of AnsiChar); compilerproc;
 procedure fpc_chararray_uint(v : valuint;len : SizeInt;out a : array of AnsiChar); compilerproc;
 procedure fpc_chararray_uint(v : valuint;len : SizeInt;out a : array of AnsiChar); compilerproc;
 {$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
 {$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
-procedure fpc_AnsiStr_sint(v : valsint; Len : SizeInt; out S : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc; inline;
-procedure fpc_AnsiStr_uint(v : valuint;Len : SizeInt; out S : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc; inline;
+procedure fpc_AnsiStr_sint(v : valsint; Len : SizeInt; out S : RawByteString;cp : TSystemCodePage); compilerproc; inline;
+procedure fpc_AnsiStr_uint(v : valuint;Len : SizeInt; out S : RawByteString;cp : TSystemCodePage); compilerproc; inline;
 {$ifndef FPUNONE}
 {$ifndef FPUNONE}
-procedure fpc_AnsiStr_Float(d : ValReal;len,fr,rt : SizeInt;out s : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc; inline;
+procedure fpc_AnsiStr_Float(d : ValReal;len,fr,rt : SizeInt;out s : RawByteString;cp : TSystemCodePage); compilerproc; inline;
 {$endif}
 {$endif}
 {$ifndef FPC_STR_ENUM_INTERN}
 {$ifndef FPC_STR_ENUM_INTERN}
-procedure fpc_ansistr_enum(ordinal,len:sizeint;typinfo,ord2strindex:pointer;out s:RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc; inline;
+procedure fpc_ansistr_enum(ordinal,len:sizeint;typinfo,ord2strindex:pointer;out s:RawByteString;cp : TSystemCodePage); compilerproc; inline;
 {$endif FPC_STR_ENUM_INTERN}
 {$endif FPC_STR_ENUM_INTERN}
-procedure fpc_ansistr_bool(b : boolean;len:sizeint;out s:RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc; inline;
-procedure fpc_AnsiStr_Currency(c : currency;len,fr : SizeInt;out s : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc; inline;
+procedure fpc_ansistr_bool(b : boolean;len:sizeint;out s:RawByteString;cp : TSystemCodePage); compilerproc; inline;
+procedure fpc_AnsiStr_Currency(c : currency;len,fr : SizeInt;out s : RawByteString;cp : TSystemCodePage); compilerproc; inline;
 {$endif FPC_HAS_FEATURE_ANSISTRINGS}
 {$endif FPC_HAS_FEATURE_ANSISTRINGS}
 
 
 {$ifdef FPC_HAS_FEATURE_WIDESTRINGS}
 {$ifdef FPC_HAS_FEATURE_WIDESTRINGS}
@@ -123,8 +123,8 @@ procedure fpc_AnsiStr_Currency(c : currency;len,fr : SizeInt;out s : RawByteStri
   procedure fpc_chararray_qword(v : qword;len : SizeInt;out a : array of AnsiChar); compilerproc;
   procedure fpc_chararray_qword(v : qword;len : SizeInt;out a : array of AnsiChar); compilerproc;
   procedure fpc_chararray_int64(v : int64;len : SizeInt;out a : array of AnsiChar); compilerproc;
   procedure fpc_chararray_int64(v : int64;len : SizeInt;out a : array of AnsiChar); compilerproc;
   {$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
   {$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
-  procedure fpc_ansistr_qword(v : qword;len : SizeInt;out s : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc; inline;
-  procedure fpc_ansistr_int64(v : int64;len : SizeInt;out s : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc; inline;
+  procedure fpc_ansistr_qword(v : qword;len : SizeInt;out s : RawByteString;cp : TSystemCodePage); compilerproc; inline;
+  procedure fpc_ansistr_int64(v : int64;len : SizeInt;out s : RawByteString;cp : TSystemCodePage); compilerproc; inline;
   {$endif FPC_HAS_FEATURE_ANSISTRINGS}
   {$endif FPC_HAS_FEATURE_ANSISTRINGS}
 
 
   {$ifdef FPC_HAS_FEATURE_WIDESTRINGS}
   {$ifdef FPC_HAS_FEATURE_WIDESTRINGS}
@@ -142,8 +142,8 @@ procedure fpc_AnsiStr_Currency(c : currency;len,fr : SizeInt;out s : RawByteStri
   procedure fpc_chararray_longword(v : longword;len : SizeInt;out a : array of AnsiChar); compilerproc;
   procedure fpc_chararray_longword(v : longword;len : SizeInt;out a : array of AnsiChar); compilerproc;
   procedure fpc_chararray_longint(v : longint;len : SizeInt;out a : array of AnsiChar); compilerproc;
   procedure fpc_chararray_longint(v : longint;len : SizeInt;out a : array of AnsiChar); compilerproc;
   {$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
   {$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
-  procedure fpc_ansistr_longword(v : longword;len : SizeInt;out s : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc;
-  procedure fpc_ansistr_longint(v : longint;len : SizeInt;out s : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc;
+  procedure fpc_ansistr_longword(v : longword;len : SizeInt;out s : RawByteString;cp : TSystemCodePage); compilerproc;
+  procedure fpc_ansistr_longint(v : longint;len : SizeInt;out s : RawByteString;cp : TSystemCodePage); compilerproc;
   {$endif FPC_HAS_FEATURE_ANSISTRINGS}
   {$endif FPC_HAS_FEATURE_ANSISTRINGS}
 
 
   {$ifdef FPC_HAS_FEATURE_WIDESTRINGS}
   {$ifdef FPC_HAS_FEATURE_WIDESTRINGS}
@@ -160,8 +160,8 @@ procedure fpc_AnsiStr_Currency(c : currency;len,fr : SizeInt;out s : RawByteStri
   procedure fpc_chararray_word(v : word;len : SizeInt;out a : array of AnsiChar); compilerproc;
   procedure fpc_chararray_word(v : word;len : SizeInt;out a : array of AnsiChar); compilerproc;
   procedure fpc_chararray_smallint(v : smallint;len : SizeInt;out a : array of AnsiChar); compilerproc;
   procedure fpc_chararray_smallint(v : smallint;len : SizeInt;out a : array of AnsiChar); compilerproc;
   {$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
   {$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
-  procedure fpc_ansistr_word(v : word;len : SizeInt;out s : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc;
-  procedure fpc_ansistr_smallint(v : smallint;len : SizeInt;out s : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc;
+  procedure fpc_ansistr_word(v : word;len : SizeInt;out s : RawByteString;cp : TSystemCodePage); compilerproc;
+  procedure fpc_ansistr_smallint(v : smallint;len : SizeInt;out s : RawByteString;cp : TSystemCodePage); compilerproc;
   {$endif FPC_HAS_FEATURE_ANSISTRINGS}
   {$endif FPC_HAS_FEATURE_ANSISTRINGS}
 
 
   {$ifdef FPC_HAS_FEATURE_WIDESTRINGS}
   {$ifdef FPC_HAS_FEATURE_WIDESTRINGS}
@@ -307,15 +307,15 @@ Procedure fpc_ansistr_decr_ref (Var S : Pointer); compilerproc;
 Procedure fpc_ansistr_incr_ref (S : Pointer); compilerproc;
 Procedure fpc_ansistr_incr_ref (S : Pointer); compilerproc;
 *)
 *)
 //Procedure fpc_AnsiStr_Assign (Var DestS : Pointer;S2 : Pointer); compilerproc;
 //Procedure fpc_AnsiStr_Assign (Var DestS : Pointer;S2 : Pointer); compilerproc;
-procedure fpc_AnsiStr_Concat (Var DestS : RawByteString;const S1,S2 : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc;
-procedure fpc_AnsiStr_Concat_multi (Var DestS : RawByteString;const sarr:array of RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc;
+procedure fpc_AnsiStr_Concat (Var DestS : RawByteString;const S1,S2 : RawByteString;cp : TSystemCodePage); compilerproc;
+procedure fpc_AnsiStr_Concat_multi (Var DestS : RawByteString;const sarr:array of RawByteString;cp : TSystemCodePage); compilerproc;
 Function fpc_AnsiStr_To_AnsiStr (const S : RawByteString;cp : TSystemCodePage): RawByteString; compilerproc;
 Function fpc_AnsiStr_To_AnsiStr (const S : RawByteString;cp : TSystemCodePage): RawByteString; compilerproc;
 procedure fpc_AnsiStr_To_ShortStr (out res: shortstring; const S2 : RawByteString); compilerproc;
 procedure fpc_AnsiStr_To_ShortStr (out res: shortstring; const S2 : RawByteString); compilerproc;
-Function fpc_ShortStr_To_AnsiStr (Const S2 : ShortString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}): RawByteString; compilerproc;
-Function fpc_Char_To_AnsiStr(const c : AnsiChar{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}): RawByteString; compilerproc;
+Function fpc_ShortStr_To_AnsiStr (Const S2 : ShortString;cp : TSystemCodePage): RawByteString; compilerproc;
+Function fpc_Char_To_AnsiStr(const c : AnsiChar;cp : TSystemCodePage): RawByteString; compilerproc;
 
 
-Function fpc_PChar_To_AnsiStr(const p : PAnsiChar{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}): RawByteString; compilerproc;
-Function fpc_CharArray_To_AnsiStr(const arr: array of AnsiChar; {$ifdef FPC_HAS_CPSTRING}cp : TSystemCodePage;{$endif FPC_HAS_CPSTRING}zerobased: boolean = true): RawByteString; compilerproc;
+Function fpc_PChar_To_AnsiStr(const p : PAnsiChar;cp : TSystemCodePage): RawByteString; compilerproc;
+Function fpc_CharArray_To_AnsiStr(const arr: array of AnsiChar; cp : TSystemCodePage;zerobased: boolean = true): RawByteString; compilerproc;
 procedure fpc_ansistr_to_chararray(out res: array of AnsiChar; const src: RawByteString); compilerproc;
 procedure fpc_ansistr_to_chararray(out res: array of AnsiChar; const src: RawByteString); compilerproc;
 function fpc_ansistr_setchar(const s: RawByteString; const index: longint; const ch: ansichar): RawByteString; compilerproc;
 function fpc_ansistr_setchar(const s: RawByteString; const index: longint; const ch: ansichar): RawByteString; compilerproc;
 Function fpc_AnsiStr_Compare(const S1,S2 : RawByteString): SizeInt; compilerproc;
 Function fpc_AnsiStr_Compare(const S1,S2 : RawByteString): SizeInt; compilerproc;
@@ -323,7 +323,7 @@ Function fpc_AnsiStr_Compare_equal(const S1,S2 : RawByteString): SizeInt; compil
 //Procedure fpc_AnsiStr_RangeCheck(p : Pointer; index : SizeInt); compilerproc;
 //Procedure fpc_AnsiStr_RangeCheck(p : Pointer; index : SizeInt); compilerproc;
 
 
 { special declaration for the JVM }
 { special declaration for the JVM }
-Procedure fpc_AnsiStr_SetLength (Var S : RawByteString; l : SizeInt{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc;
+Procedure fpc_AnsiStr_SetLength (Var S : RawByteString; l : SizeInt;cp : TSystemCodePage); compilerproc;
 Function  fpc_ansistr_Copy (Const S : RawByteString; Index,Size : SizeInt): RawByteString;compilerproc;
 Function  fpc_ansistr_Copy (Const S : RawByteString; Index,Size : SizeInt): RawByteString;compilerproc;
 Procedure fpc_ansistr_insert (const Source : RawByteString; var S : RawByteString; Index : SizeInt); compilerproc:fpc_in_insert_x_y_z; rtlproc;
 Procedure fpc_ansistr_insert (const Source : RawByteString; var S : RawByteString; Index : SizeInt); compilerproc:fpc_in_insert_x_y_z; rtlproc;
 Procedure fpc_ansistr_delete (var S : RawByteString; Index,Size: SizeInt); compilerproc:fpc_in_delete_x_y_z; rtlproc;
 Procedure fpc_ansistr_delete (var S : RawByteString; Index,Size: SizeInt); compilerproc:fpc_in_delete_x_y_z; rtlproc;
@@ -346,7 +346,7 @@ Procedure fpc_WideStr_Decr_Ref (Var S : Pointer); compilerproc;
 Procedure fpc_WideStr_Incr_Ref (Var S : Pointer); compilerproc;
 Procedure fpc_WideStr_Incr_Ref (Var S : Pointer); compilerproc;
 procedure fpc_WideStr_To_ShortStr (out res: ShortString;const S2 : WideString); compilerproc;
 procedure fpc_WideStr_To_ShortStr (out res: ShortString;const S2 : WideString); compilerproc;
 Function fpc_ShortStr_To_WideStr (Const S2 : ShortString): WideString; compilerproc;
 Function fpc_ShortStr_To_WideStr (Const S2 : ShortString): WideString; compilerproc;
-Function fpc_WideStr_To_AnsiStr (const S2 : WideString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}): AnsiString; compilerproc;
+Function fpc_WideStr_To_AnsiStr (const S2 : WideString;cp : TSystemCodePage): AnsiString; compilerproc;
 Function fpc_AnsiStr_To_WideStr (Const S2 : RawByteString): WideString; compilerproc;
 Function fpc_AnsiStr_To_WideStr (Const S2 : RawByteString): WideString; compilerproc;
 Procedure fpc_WideStr_Assign (Var S1 : Pointer;S2 : Pointer); compilerproc;
 Procedure fpc_WideStr_Assign (Var S1 : Pointer;S2 : Pointer); compilerproc;
 Procedure fpc_WideStr_Concat (Var DestS : Widestring;const S1,S2 : WideString); compilerproc;
 Procedure fpc_WideStr_Concat (Var DestS : Widestring;const S1,S2 : WideString); compilerproc;
@@ -382,7 +382,7 @@ Function fpc_PWideChar_To_WideStr(const p : pwidechar): widestring; compilerproc
 //Procedure fpc_UnicodeStr_Incr_Ref (S : Pointer); compilerproc;
 //Procedure fpc_UnicodeStr_Incr_Ref (S : Pointer); compilerproc;
 procedure fpc_UnicodeStr_To_ShortStr (out res: ShortString;const S2 : UnicodeString); compilerproc;
 procedure fpc_UnicodeStr_To_ShortStr (out res: ShortString;const S2 : UnicodeString); compilerproc;
 Function fpc_ShortStr_To_UnicodeStr (Const S2 : ShortString): UnicodeString; compilerproc;
 Function fpc_ShortStr_To_UnicodeStr (Const S2 : ShortString): UnicodeString; compilerproc;
-Function fpc_UnicodeStr_To_AnsiStr (const S2 : UnicodeString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}): AnsiString; compilerproc;
+Function fpc_UnicodeStr_To_AnsiStr (const S2 : UnicodeString;cp : TSystemCodePage): AnsiString; compilerproc;
 Function fpc_AnsiStr_To_UnicodeStr (Const S2 : RawByteString): UnicodeString; compilerproc;
 Function fpc_AnsiStr_To_UnicodeStr (Const S2 : RawByteString): UnicodeString; compilerproc;
 Function fpc_UnicodeStr_To_WideStr (const S2 : UnicodeString): WideString; compilerproc;
 Function fpc_UnicodeStr_To_WideStr (const S2 : UnicodeString): WideString; compilerproc;
 Function fpc_WideStr_To_UnicodeStr (Const S2 : WideString): UnicodeString; compilerproc;
 Function fpc_WideStr_To_UnicodeStr (Const S2 : WideString): UnicodeString; compilerproc;
@@ -401,7 +401,7 @@ procedure fpc_unicodestr_to_chararray(out res: array of AnsiChar; const src: Uni
 function fpc_unicodestr_setchar(const s: UnicodeString; const index: longint; const ch: unicodechar): UnicodeString; compilerproc;
 function fpc_unicodestr_setchar(const s: UnicodeString; const index: longint; const ch: unicodechar): UnicodeString; compilerproc;
 
 
 procedure fpc_WideCharArray_To_ShortStr(out res : shortstring;const arr: array of widechar; zerobased: boolean = true); compilerproc;
 procedure fpc_WideCharArray_To_ShortStr(out res : shortstring;const arr: array of widechar; zerobased: boolean = true); compilerproc;
-Function fpc_WideCharArray_To_AnsiStr(const arr: array of widechar; {$ifdef FPC_HAS_CPSTRING}cp : TSystemCodePage;{$endif FPC_HAS_CPSTRING} zerobased: boolean = true): AnsiString; compilerproc;
+Function fpc_WideCharArray_To_AnsiStr(const arr: array of widechar; cp : TSystemCodePage; zerobased: boolean = true): AnsiString; compilerproc;
 {$ifndef FPC_WIDESTRING_EQUAL_UNICODESTRING}
 {$ifndef FPC_WIDESTRING_EQUAL_UNICODESTRING}
 Function fpc_WideCharArray_To_WideStr(const arr: array of widechar; zerobased: boolean = true): WideString; compilerproc;
 Function fpc_WideCharArray_To_WideStr(const arr: array of widechar; zerobased: boolean = true): WideString; compilerproc;
 {$endif}
 {$endif}
@@ -421,12 +421,12 @@ Procedure fpc_unicodestr_delete (Var S : UnicodeString; Index,Size: SizeInt); co
 Function fpc_Char_To_UChar(const c : AnsiChar): UnicodeChar; compilerproc;
 Function fpc_Char_To_UChar(const c : AnsiChar): UnicodeChar; compilerproc;
 Function fpc_UChar_To_Char(const c : UnicodeChar): AnsiChar; compilerproc;
 Function fpc_UChar_To_Char(const c : UnicodeChar): AnsiChar; compilerproc;
 Function fpc_UChar_To_UnicodeStr(const c : UnicodeChar): UnicodeString; compilerproc;
 Function fpc_UChar_To_UnicodeStr(const c : UnicodeChar): UnicodeString; compilerproc;
-Function fpc_UChar_To_AnsiStr(const c : UnicodeChar{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}): AnsiString; compilerproc;
+Function fpc_UChar_To_AnsiStr(const c : UnicodeChar;cp : TSystemCodePage): AnsiString; compilerproc;
 function fpc_UChar_To_ShortStr(const c : WideChar): shortstring; compilerproc;
 function fpc_UChar_To_ShortStr(const c : WideChar): shortstring; compilerproc;
 
 
 Function fpc_PWideChar_To_UnicodeStr(const p : pwidechar): unicodestring; compilerproc;
 Function fpc_PWideChar_To_UnicodeStr(const p : pwidechar): unicodestring; compilerproc;
 {$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
 {$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
-Function fpc_PWideChar_To_AnsiStr(const p : pwidechar{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}): ansistring; compilerproc;
+Function fpc_PWideChar_To_AnsiStr(const p : pwidechar;cp : TSystemCodePage): ansistring; compilerproc;
 {$endif FPC_HAS_FEATURE_ANSISTRINGS}
 {$endif FPC_HAS_FEATURE_ANSISTRINGS}
 procedure fpc_PWideChar_To_ShortStr(out res : shortstring;const p : pwidechar); compilerproc;
 procedure fpc_PWideChar_To_ShortStr(out res : shortstring;const p : pwidechar); compilerproc;
 {$endif FPC_HAS_FEATURE_WIDESTRINGS}
 {$endif FPC_HAS_FEATURE_WIDESTRINGS}
@@ -541,7 +541,7 @@ Procedure fpc_Read_Text_ShortStr(var f : Text;out s : ShortString); compilerproc
 Procedure fpc_Read_Text_PChar_As_Pointer(var f : Text; const s : PAnsiChar); compilerproc;
 Procedure fpc_Read_Text_PChar_As_Pointer(var f : Text; const s : PAnsiChar); compilerproc;
 Procedure fpc_Read_Text_PChar_As_Array(var f : Text;out s : array of AnsiChar; zerobased: boolean = false); compilerproc;
 Procedure fpc_Read_Text_PChar_As_Array(var f : Text;out s : array of AnsiChar; zerobased: boolean = false); compilerproc;
 {$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
 {$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
-Procedure fpc_Read_Text_AnsiStr(var f : Text;out s : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc;
+Procedure fpc_Read_Text_AnsiStr(var f : Text;out s : RawByteString;cp : TSystemCodePage); compilerproc;
 {$endif FPC_HAS_FEATURE_ANSISTRINGS}
 {$endif FPC_HAS_FEATURE_ANSISTRINGS}
 {$ifdef FPC_HAS_FEATURE_WIDESTRINGS}
 {$ifdef FPC_HAS_FEATURE_WIDESTRINGS}
 Procedure fpc_Read_Text_UnicodeStr(var f : Text;out us : UnicodeString); compilerproc;
 Procedure fpc_Read_Text_UnicodeStr(var f : Text;out us : UnicodeString); compilerproc;

+ 3 - 9
rtl/java/jsystemh.inc

@@ -498,16 +498,10 @@ Function  Pos(const substr:shortstring;const s:shortstring; Offset: Sizeint = 1)
 Function  Pos(C:AnsiChar;const s:shortstring; Offset: Sizeint = 1):SizeInt;
 Function  Pos(C:AnsiChar;const s:shortstring; Offset: Sizeint = 1):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; Offset: Sizeint = 1) : SizeInt;
-
-{$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;
 Procedure fpc_setstring_ansistr_pwidechar(out S : RawByteString; Buf : PWideChar; Len : SizeInt; cp: TSystemCodePage); rtlproc; compilerproc;
 Procedure fpc_setstring_ansistr_pwidechar(out S : RawByteString; Buf : PWideChar; Len : SizeInt; cp: TSystemCodePage); rtlproc; compilerproc;
-{$else}
-Procedure SetString(out S : AnsiString; Buf : PAnsiChar; Len : SizeInt);
-Procedure SetString(out S : AnsiString; Buf : PWideChar; Len : SizeInt);
-{$endif}
 {$endif FPC_HAS_FEATURE_ANSISTRINGS}
 {$endif FPC_HAS_FEATURE_ANSISTRINGS}
-Procedure {$ifdef FPC_HAS_CPSTRING}fpc_setstring_shortstr{$else}SetString{$endif}(out S : Shortstring; Buf : PAnsiChar; Len : SizeInt); {$ifdef FPC_HAS_CPSTRING} compilerproc; {$endif FPC_HAS_CPSTRING}
+Procedure fpc_setstring_shortstr(out S : Shortstring; Buf : PAnsiChar; Len : SizeInt); compilerproc;
 function  ShortCompareText(const S1, S2: shortstring): SizeInt;
 function  ShortCompareText(const S1, S2: shortstring): SizeInt;
 Function  upCase(const s:shortstring):shortstring;
 Function  upCase(const s:shortstring):shortstring;
 Function  lowerCase(const s:shortstring):shortstring; overload;
 Function  lowerCase(const s:shortstring):shortstring; overload;
@@ -543,7 +537,7 @@ function  pos(const substr : shortstring;c:AnsiChar; Offset : Sizeint=1): SizeIn
 ****************************************************************************}
 ****************************************************************************}
 
 
 {$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
 {$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
-Procedure UniqueString(var S : RawByteString);{$ifdef FPC_HAS_CPSTRING}rtlproc;{$endif FPC_HAS_CPSTRING}{$ifdef SYSTEMINLINE}inline;{$endif}
+Procedure UniqueString(var S : RawByteString);rtlproc;{$ifdef SYSTEMINLINE}inline;{$endif}
 Function  Pos (const Substr : RawByteString; const Source : RawByteString; Offset: Sizeint = 1) : SizeInt;
 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 (c : AnsiChar; const s : RawByteString; Offset: Sizeint = 1) : SizeInt;
 Function  StringOfChar(c : Ansichar;l : SizeInt) : AnsiString;
 Function  StringOfChar(c : Ansichar;l : SizeInt) : AnsiString;
@@ -689,7 +683,7 @@ Procedure chdir(const s:rawbytestring); overload;
 Procedure mkdir(const s:rawbytestring); overload;
 Procedure mkdir(const s:rawbytestring); overload;
 Procedure rmdir(const s:rawbytestring); overload;
 Procedure rmdir(const s:rawbytestring); overload;
 // defaultrtlfilesystemcodepage is returned here
 // defaultrtlfilesystemcodepage is returned here
-Procedure getdir(drivenr:byte;var dir: rawbytestring);overload;{$ifdef FPC_HAS_CPSTRING}rtlproc;{$endif FPC_HAS_CPSTRING}
+Procedure getdir(drivenr:byte;var dir: rawbytestring);overload;rtlproc;
 {$endif FPC_HAS_FEATURE_ANSISTRINGS}
 {$endif FPC_HAS_FEATURE_ANSISTRINGS}
 {$ifdef FPC_HAS_FEATURE_WIDESTRINGS}
 {$ifdef FPC_HAS_FEATURE_WIDESTRINGS}
 Procedure chdir(const s:unicodestring); overload;
 Procedure chdir(const s:unicodestring); overload;

+ 0 - 9
rtl/java/jsystemh_types.inc

@@ -419,18 +419,9 @@ Type
   PUCS4CharArray      = ^TUCS4CharArray;
   PUCS4CharArray      = ^TUCS4CharArray;
   UCS4String          = array of UCS4Char;
   UCS4String          = array of UCS4Char;
 
 
-{$ifdef FPC_HAS_CPSTRING}
   UTF8String          = type AnsiString(CP_UTF8);
   UTF8String          = type AnsiString(CP_UTF8);
-{$else FPC_HAS_CPSTRING}
-  UTF8String          = type ansistring;
-{$endif FPC_HAS_CPSTRING}
   PUTF8String         = ^UTF8String;
   PUTF8String         = ^UTF8String;
-
-{$ifdef FPC_HAS_CPSTRING}
   RawByteString       = type AnsiString(CP_NONE);
   RawByteString       = type AnsiString(CP_NONE);
-{$else FPC_HAS_CPSTRING}
-  RawByteString       = ansistring;
-{$endif FPC_HAS_CPSTRING}
 
 
   HRESULT             = type Longint;
   HRESULT             = type Longint;
 {$ifndef FPUNONE}
 {$ifndef FPUNONE}

+ 5 - 12
rtl/java/justrings.inc

@@ -119,7 +119,7 @@ end;
 
 
 
 
 {$define FPC_HAS_UNICODESTR_TO_ANSISTR}
 {$define FPC_HAS_UNICODESTR_TO_ANSISTR}
-Function fpc_UnicodeStr_To_AnsiStr (const S2 : UnicodeString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}): AnsiString; compilerproc;
+Function fpc_UnicodeStr_To_AnsiStr (const S2 : UnicodeString;cp : TSystemCodePage): AnsiString; compilerproc;
 {
 {
   Converts a UnicodeString to an AnsiString
   Converts a UnicodeString to an AnsiString
 }
 }
@@ -197,7 +197,7 @@ end;
 {$define FPC_HAS_PUNICODECHAR_TO_SHORTSTR}
 {$define FPC_HAS_PUNICODECHAR_TO_SHORTSTR}
 
 
 {$define FPC_HAS_PWIDECHAR_TO_ANSISTR}
 {$define FPC_HAS_PWIDECHAR_TO_ANSISTR}
-Function fpc_PWideChar_To_AnsiStr(const p : pwidechar{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}): ansistring; compilerproc;
+Function fpc_PWideChar_To_AnsiStr(const p : pwidechar;cp : TSystemCodePage): ansistring; compilerproc;
 begin
 begin
   result:='';
   result:='';
   if (p=nil) or
   if (p=nil) or
@@ -325,7 +325,7 @@ end;
 
 
 
 
 {$define FPC_HAS_UCHAR_TO_ANSISTR}
 {$define FPC_HAS_UCHAR_TO_ANSISTR}
-Function fpc_UChar_To_AnsiStr(const c : UnicodeChar{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}): AnsiString; compilerproc;
+Function fpc_UChar_To_AnsiStr(const c : UnicodeChar;cp : TSystemCodePage): AnsiString; compilerproc;
 {
 {
   Converts a UnicodeChar to a AnsiString;
   Converts a UnicodeChar to a AnsiString;
 }
 }
@@ -354,22 +354,15 @@ end;
 
 
 {$ifndef FPC_HAS_UCHAR_TO_ANSISTR}
 {$ifndef FPC_HAS_UCHAR_TO_ANSISTR}
 {$define FPC_HAS_UCHAR_TO_ANSISTR}
 {$define FPC_HAS_UCHAR_TO_ANSISTR}
-Function fpc_UChar_To_AnsiStr(const c : UnicodeChar{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}): AnsiString; compilerproc;
+Function fpc_UChar_To_AnsiStr(const c : UnicodeChar;cp : TSystemCodePage): AnsiString; compilerproc;
 {
 {
   Converts a UnicodeChar to a AnsiString;
   Converts a UnicodeChar to a AnsiString;
 }
 }
 var
 var
   arr: array[0..0] of unicodechar;
   arr: array[0..0] of unicodechar;
-{$ifndef FPC_HAS_CPSTRING}
-  cp : TSystemCodePage;
-{$endif FPC_HAS_CPSTRING}
 begin
 begin
-{$ifndef FPC_HAS_CPSTRING}
-  cp:=DefaultSystemCodePage;
-{$endif FPC_HAS_CPSTRING}
-  cp:=TranslatePlaceholderCP(cp);
   arr[0]:=c;
   arr[0]:=c;
-  widestringmanager.Unicode2AnsiMoveProc(punicodechar(@arr[0]), fpc_UChar_To_AnsiStr, cp, 1);
+  widestringmanager.Unicode2AnsiMoveProc(punicodechar(@arr[0]), fpc_UChar_To_AnsiStr, TranslatePlaceholderCP(cp), 1);
 end;
 end;
 {$endif FPC_HAS_UCHAR_TO_ANSISTR}
 {$endif FPC_HAS_UCHAR_TO_ANSISTR}
 
 

+ 2 - 2
rtl/objpas/sysutils/fina.inc

@@ -384,7 +384,7 @@ begin
   Result:=Result+ExtractFileName(DestName);
   Result:=Result+ExtractFileName(DestName);
 end;
 end;
 
 
-Procedure DoDirSeparators (Var FileName : PathStr); {$ifdef FPC_HAS_CPSTRING}rtlproc;{$endif}
+Procedure DoDirSeparators (Var FileName : PathStr); rtlproc;
 
 
 Var I : longint;
 Var I : longint;
 
 
@@ -409,7 +409,7 @@ end;
   if none were found.
   if none were found.
 }
 }
 
 
-Function GetDirs (Var DirName : PathStr; Var Dirs : Array of PathPChar) : Longint; {$ifdef FPC_HAS_CPSTRING}rtlproc;{$endif}
+Function GetDirs (Var DirName : PathStr; Var Dirs : Array of PathPChar) : Longint; rtlproc;
 
 
 Var I : Longint;
 Var I : Longint;
 
 

+ 2 - 2
rtl/objpas/sysutils/finah.inc

@@ -40,8 +40,8 @@ function ExcludeTrailingPathDelimiter(Const Path: PathStr): PathStr;
 function IncludeLeadingPathDelimiter(Const Path : PathStr) : PathStr;
 function IncludeLeadingPathDelimiter(Const Path : PathStr) : PathStr;
 function ExcludeLeadingPathDelimiter(Const Path: PathStr): PathStr;
 function ExcludeLeadingPathDelimiter(Const Path: PathStr): PathStr;
 function IsPathDelimiter(Const Path: PathStr; Index: Integer): Boolean;
 function IsPathDelimiter(Const Path: PathStr; Index: Integer): Boolean;
-Procedure DoDirSeparators (Var FileName : PathStr); {$ifdef FPC_HAS_CPSTRING}rtlproc;{$endif}
+Procedure DoDirSeparators (Var FileName : PathStr); rtlproc;
 Function SetDirSeparators (Const FileName : PathStr) : PathStr;
 Function SetDirSeparators (Const FileName : PathStr) : PathStr;
-Function GetDirs (Var DirName : PathStr; Var Dirs : Array of PathPChar) : Longint; {$ifdef FPC_HAS_CPSTRING}rtlproc;{$endif}
+Function GetDirs (Var DirName : PathStr; Var Dirs : Array of PathPChar) : Longint; rtlproc;
 function ConcatPaths(const Paths: array of PathStr): PathStr;
 function ConcatPaths(const Paths: array of PathStr): PathStr;
 
 

+ 0 - 5
rtl/unix/cwstring.pp

@@ -1120,8 +1120,6 @@ begin
     Result:={$IFDEF FPC_DOTTEDUNITS}UnixApi.CP{$ELSE}unixcp{$ENDIF}.GetSystemCodepage;
     Result:={$IFDEF FPC_DOTTEDUNITS}UnixApi.CP{$ELSE}unixcp{$ENDIF}.GetSystemCodepage;
 end;
 end;
 
 
-{$ifdef FPC_HAS_CPSTRING}
-
 procedure SetStdIOCodePage(var T: Text); inline;
 procedure SetStdIOCodePage(var T: Text); inline;
 begin
 begin
   case TextRec(T).Mode of
   case TextRec(T).Mode of
@@ -1138,7 +1136,6 @@ begin
   SetStdIOCodePage(StdOut);
   SetStdIOCodePage(StdOut);
   SetStdIOCodePage(StdErr);
   SetStdIOCodePage(StdErr);
 end;
 end;
-{$endif FPC_HAS_CPSTRING}
 
 
 var
 var
   OrgWideStringManager: TUnicodeStringManager;
   OrgWideStringManager: TUnicodeStringManager;
@@ -1210,9 +1207,7 @@ initialization
   DefaultFileSystemCodePage:=GetStandardCodePage(scpFileSystemSingleByte);
   DefaultFileSystemCodePage:=GetStandardCodePage(scpFileSystemSingleByte);
   DefaultRTLFileSystemCodePage:=DefaultFileSystemCodePage;
   DefaultRTLFileSystemCodePage:=DefaultFileSystemCodePage;
 
 
-  {$ifdef FPC_HAS_CPSTRING}
   SetStdIOCodePages;
   SetStdIOCodePages;
-  {$endif FPC_HAS_CPSTRING}
 
 
   { init conversion tables for main program }
   { init conversion tables for main program }
   InitThread;
   InitThread;