mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-23 01:19:37 +02:00
LazUtils: Remove tests for FPC versions 2.x.
git-svn-id: trunk@64122 -
This commit is contained in:
parent
a10a039a84
commit
f47a2a5fd6
@ -113,13 +113,9 @@ function UTF8Pos(const SearchForText, SearchInText: string; StartPos: SizeInt =
|
||||
function UTF8PosP(SearchForText: PChar; SearchForTextLen: SizeInt;
|
||||
SearchInText: PChar; SearchInTextLen: SizeInt): PChar;
|
||||
function UTF8Copy(const s: string; StartCharIndex, CharCount: PtrInt): string;
|
||||
{$IFnDEF NO_CP_RTL}
|
||||
procedure UTF8Delete(var s: Utf8String; StartCharIndex, CharCount: PtrInt);
|
||||
{$ENDIF}
|
||||
procedure UTF8Delete(var s: String; StartCharIndex, CharCount: PtrInt);
|
||||
{$IFnDEF NO_CP_RTL}
|
||||
procedure UTF8Insert(const source: Utf8String; var s: Utf8String; StartCharIndex: PtrInt);
|
||||
{$ENDIF}
|
||||
procedure UTF8Insert(const source: String; var s: String; StartCharIndex: PtrInt);
|
||||
function UTF8StringReplace(const S, OldPattern, NewPattern: String;
|
||||
Flags: TReplaceFlags; ALanguage: string=''): String; inline;
|
||||
@ -1098,7 +1094,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
{$IFnDEF NO_CP_RTL}
|
||||
procedure UTF8Delete(var s: Utf8String; StartCharIndex, CharCount: PtrInt);
|
||||
var
|
||||
tmp: String;
|
||||
@ -1116,7 +1111,6 @@ begin
|
||||
tmp := '';
|
||||
SetCodePage(RawByteString(s), CP_UTF8, False);
|
||||
end;
|
||||
{$ENDIF NO_ACP_RTL}
|
||||
|
||||
procedure UTF8Delete(var s: String; StartCharIndex, CharCount: PtrInt);
|
||||
var
|
||||
@ -1136,7 +1130,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
{$IFnDEF NO_CP_RTL}
|
||||
{It's simper to copy the code from the variant with String parameters than writing a wrapper}
|
||||
procedure UTF8Insert(const source: UTF8String; var s: UTF8string;
|
||||
StartCharIndex: PtrInt);
|
||||
@ -1147,7 +1140,6 @@ begin
|
||||
if StartBytePos <> nil then
|
||||
Insert(source, s, StartBytePos-PChar(s)+1);
|
||||
end;
|
||||
{$ENDIF NO_CP_RTL}
|
||||
|
||||
procedure UTF8Insert(const source: String; var s: String; StartCharIndex: PtrInt);
|
||||
var
|
||||
|
@ -3,16 +3,11 @@
|
||||
|
||||
{$undef UTF8_RTL} // FPC >= 2.7.1 with codepages and default string = CP_UTF8
|
||||
{$undef ACP_RTL} // FPC >= 2.7.1 with codepages and default string = CP_ACP
|
||||
{$undef NO_CP_RTL} // FPC < 2.7.1 before string codepages
|
||||
|
||||
|
||||
{$ifdef FPC_HAS_CPSTRING}
|
||||
{$ifndef DisableUTF8RTL}
|
||||
{$define UTF8_RTL}
|
||||
{$else DisableUTF8RTL}
|
||||
{$define ACP_RTL}
|
||||
{$endif DisableUTF8RTL}
|
||||
{$else FPC_HAS_CPSTRING}
|
||||
{$define NO_CP_RTL}
|
||||
{$undef DisableUTF8RTL}
|
||||
{$endif FPC_HAS_CPSTRING}
|
||||
{$ifndef DisableUTF8RTL}
|
||||
{$define UTF8_RTL}
|
||||
{$else DisableUTF8RTL}
|
||||
{$define ACP_RTL}
|
||||
{$endif DisableUTF8RTL}
|
||||
|
||||
|
@ -20,14 +20,12 @@ unit PasWString;
|
||||
// non utf-8 ansistring is rare in UNIXes and lconvencoding makes the executable big
|
||||
|
||||
// sanity checks for defines
|
||||
{$IFnDEF NO_CP_RTL}
|
||||
{$IFDEF UTF8_RTL}
|
||||
{$IFDEF PASWSTRING_SUPPORT_NONUTF8_ANSISTRING}
|
||||
{$error UTF8 or not UTF8}
|
||||
{$ENDIF}
|
||||
{$IFDEF UTF8_RTL}
|
||||
{$IFDEF PASWSTRING_SUPPORT_NONUTF8_ANSISTRING}
|
||||
{$error UTF8 or not UTF8}
|
||||
{$ENDIF}
|
||||
{$DEFINE DisablePasWString}
|
||||
{$ENDIF}
|
||||
{$DEFINE DisablePasWString}
|
||||
|
||||
interface
|
||||
|
||||
|
@ -323,18 +323,12 @@ function UTF8ToConsole(const s: string): string; // converts UTF8 to console str
|
||||
var
|
||||
Dst: PChar;
|
||||
begin
|
||||
{$ifndef NO_CP_RTL}
|
||||
Result := UTF8ToWinCP(s);
|
||||
{$else NO_CP_RTL}
|
||||
Result := UTF8ToSys(s); // Kept for compatibility
|
||||
{$endif NO_CP_RTL}
|
||||
Dst := AllocMem((Length(Result) + 1) * SizeOf(Char));
|
||||
if CharToOEM(PChar(Result), Dst) then
|
||||
Result := StrPas(Dst);
|
||||
FreeMem(Dst);
|
||||
{$ifndef NO_CP_RTL}
|
||||
SetCodePage(RawByteString(Result), CP_OEMCP, False);
|
||||
{$endif NO_CP_RTL}
|
||||
end;
|
||||
{$endif not WinCE}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user