mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-09 02:28:14 +02:00
* PChar -> PAnsiChar
This commit is contained in:
parent
92df6c234b
commit
657b16d13f
@ -53,7 +53,7 @@ function CFStringToStr(AString: CFStringRef): UTF8String;
|
||||
// Try the quick way first
|
||||
Str:=CFStringGetCStringPtr(AString, kCFStringEncodingUTF8);
|
||||
if Str<>nil then
|
||||
Result:=PChar(Str)
|
||||
Result:=PAnsiChar(Str)
|
||||
else
|
||||
begin
|
||||
// if that doesn't work this will
|
||||
@ -222,7 +222,7 @@ procedure GetMacFormatSettings(var ASettings: TFormatSettings);
|
||||
Result:=ADefault;
|
||||
end;
|
||||
|
||||
function _GetSeparator(dateStyle: CFDateFormatterStyle; timeStyle: CFDateFormatterStyle; DefSep: char): char;
|
||||
function _GetSeparator(dateStyle: CFDateFormatterStyle; timeStyle: CFDateFormatterStyle; DefSep: AnsiChar): AnsiChar;
|
||||
var
|
||||
fmt: CFDateFormatterRef;
|
||||
s: utf8string;
|
||||
@ -264,7 +264,7 @@ procedure GetMacFormatSettings(var ASettings: TFormatSettings);
|
||||
if Length(s)=1 then
|
||||
ThousandSeparator:=s[1]
|
||||
else
|
||||
ThousandSeparator:=' '; // Unicode char has been returned. Probably it is a whitespace
|
||||
ThousandSeparator:=' '; // Unicode AnsiChar has been returned. Probably it is a whitespace
|
||||
CurrencyString:=CFStringToStr(CFLocaleGetValue(loc, kCFLocaleCurrencySymbol));
|
||||
|
||||
DateSeparator:=_GetSeparator(kCFDateFormatterShortStyle, kCFDateFormatterNoStyle, DateSeparator);
|
||||
|
@ -103,7 +103,7 @@ implementation
|
||||
end;
|
||||
|
||||
|
||||
function CFStringCreateFromAnsiData(data: pchar; len: SizeInt; cp: TSystemCodePage): CFStringRef;
|
||||
function CFStringCreateFromAnsiData(data: PAnsiChar; len: SizeInt; cp: TSystemCodePage): CFStringRef;
|
||||
var
|
||||
strlen,encodedlen: CFIndex;
|
||||
range: CFRange;
|
||||
@ -120,7 +120,7 @@ implementation
|
||||
end;
|
||||
|
||||
|
||||
function CFStringCreateFromAnsiDataOptionallyViaUnicodeString(data: pchar; len: SizeInt; cp: TSystemCodePage; out wtemp: UnicodeString): CFStringRef;
|
||||
function CFStringCreateFromAnsiDataOptionallyViaUnicodeString(data: PAnsiChar; len: SizeInt; cp: TSystemCodePage; out wtemp: UnicodeString): CFStringRef;
|
||||
begin
|
||||
result:=CFStringCreateFromAnsiData(data,len,cp);
|
||||
{ failed -> translate via libiconv and then create using the unicodestring
|
||||
@ -188,7 +188,7 @@ implementation
|
||||
end;
|
||||
|
||||
|
||||
procedure Ansi2WideMove(source:pchar; cp:TSystemCodePage; var dest:widestring; len:SizeInt);
|
||||
procedure Ansi2WideMove(source:PAnsiChar; cp:TSystemCodePage; var dest:widestring; len:SizeInt);
|
||||
var
|
||||
str: CFStringRef;
|
||||
strlen,encodedlen: CFIndex;
|
||||
@ -296,7 +296,7 @@ implementation
|
||||
result:='';
|
||||
exit
|
||||
end;
|
||||
str:=CFStringCreateFromAnsiDataOptionallyViaUnicodeString(pchar(s),length(s),StringCodePage(s),wtemp);
|
||||
str:=CFStringCreateFromAnsiDataOptionallyViaUnicodeString(PAnsiChar(s),length(s),StringCodePage(s),wtemp);
|
||||
{ unsupported encoding for either CF or iconv -> return original string }
|
||||
if not assigned(str) then
|
||||
begin
|
||||
@ -369,7 +369,7 @@ implementation
|
||||
CFRelease(cfstr2);
|
||||
end;
|
||||
|
||||
function InternalCodePointLength(const Str: PChar; cfcp: CFStringEncoding; maxlookahead: ptrint): PtrInt;
|
||||
function InternalCodePointLength(const Str: PAnsiChar; cfcp: CFStringEncoding; maxlookahead: ptrint): PtrInt;
|
||||
var
|
||||
cfstr: CFStringRef;
|
||||
begin
|
||||
@ -391,11 +391,11 @@ implementation
|
||||
end;
|
||||
|
||||
|
||||
function CharLengthPChar(const Str: PChar): PtrInt;
|
||||
function CharLengthPChar(const Str: PAnsiChar): PtrInt;
|
||||
var
|
||||
cfstr: CFStringRef;
|
||||
cfcp: CFStringEncoding;
|
||||
s: PChar;
|
||||
s: PAnsiChar;
|
||||
tmplen: PtrInt;
|
||||
begin
|
||||
result:=0;
|
||||
@ -420,7 +420,7 @@ implementation
|
||||
end;
|
||||
|
||||
|
||||
function CodePointLength(const Str: PChar; maxlookahead: ptrint): PtrInt;
|
||||
function CodePointLength(const Str: PAnsiChar; maxlookahead: ptrint): PtrInt;
|
||||
var
|
||||
cfstr: CFStringRef;
|
||||
cfcp: CFStringEncoding;
|
||||
@ -445,15 +445,15 @@ implementation
|
||||
cfstr1, cfstr2: CFStringRef;
|
||||
wtemp1, wtemp2: UnicodeString;
|
||||
begin
|
||||
cfstr1:=CFStringCreateFromAnsiDataOptionallyViaUnicodeString(pchar(s1),length(s1),StringCodePage(s1),wtemp1);
|
||||
cfstr2:=CFStringCreateFromAnsiDataOptionallyViaUnicodeString(pchar(s2),length(s2),StringCodePage(s2),wtemp2);
|
||||
cfstr1:=CFStringCreateFromAnsiDataOptionallyViaUnicodeString(PAnsiChar(s1),length(s1),StringCodePage(s1),wtemp1);
|
||||
cfstr2:=CFStringCreateFromAnsiDataOptionallyViaUnicodeString(PAnsiChar(s2),length(s2),StringCodePage(s2),wtemp2);
|
||||
result:=CompareCFStrings(cfstr1,cfstr2,false);
|
||||
CFRelease(cfstr1);
|
||||
CFRelease(cfstr2);
|
||||
end;
|
||||
|
||||
|
||||
function StrCompAnsi(s1,s2 : PChar): PtrInt;
|
||||
function StrCompAnsi(s1,s2 : PAnsiChar): PtrInt;
|
||||
var
|
||||
cfstr1, cfstr2: CFStringRef;
|
||||
wtemp1, wtemp2: UnicodeString;
|
||||
@ -471,15 +471,15 @@ implementation
|
||||
cfstr1, cfstr2: CFStringRef;
|
||||
wtemp1, wtemp2: UnicodeString;
|
||||
begin
|
||||
cfstr1:=CFStringCreateFromAnsiDataOptionallyViaUnicodeString(pchar(s1),length(s1),DefaultSystemCodePage,wtemp1);
|
||||
cfstr2:=CFStringCreateFromAnsiDataOptionallyViaUnicodeString(pchar(s2),length(s2),DefaultSystemCodePage,wtemp2);
|
||||
cfstr1:=CFStringCreateFromAnsiDataOptionallyViaUnicodeString(PAnsiChar(s1),length(s1),DefaultSystemCodePage,wtemp1);
|
||||
cfstr2:=CFStringCreateFromAnsiDataOptionallyViaUnicodeString(PAnsiChar(s2),length(s2),DefaultSystemCodePage,wtemp2);
|
||||
result:=CompareCFStrings(cfstr1,cfstr2,true);
|
||||
CFRelease(cfstr1);
|
||||
CFRelease(cfstr2);
|
||||
end;
|
||||
|
||||
|
||||
function AnsiStrIComp(S1, S2: PChar): PtrInt;
|
||||
function AnsiStrIComp(S1, S2: PAnsiChar): PtrInt;
|
||||
var
|
||||
cfstr1, cfstr2: CFStringRef;
|
||||
wtemp1, wtemp2: UnicodeString;
|
||||
@ -492,7 +492,7 @@ implementation
|
||||
end;
|
||||
|
||||
|
||||
function AnsiStrLComp(S1, S2: PChar; MaxLen: PtrUInt): PtrInt;
|
||||
function AnsiStrLComp(S1, S2: PAnsiChar; MaxLen: PtrUInt): PtrInt;
|
||||
var
|
||||
cfstr1, cfstr2: CFStringRef;
|
||||
wtemp1, wtemp2: UnicodeString;
|
||||
@ -505,7 +505,7 @@ implementation
|
||||
end;
|
||||
|
||||
|
||||
function AnsiStrLIComp(S1, S2: PChar; MaxLen: PtrUInt): PtrInt;
|
||||
function AnsiStrLIComp(S1, S2: PAnsiChar; MaxLen: PtrUInt): PtrInt;
|
||||
var
|
||||
cfstr1, cfstr2: CFStringRef;
|
||||
wtemp1, wtemp2: UnicodeString;
|
||||
@ -518,7 +518,7 @@ implementation
|
||||
end;
|
||||
|
||||
|
||||
procedure ansi2pchar(const s: ansistring; const orgp: pchar; out p: pchar);
|
||||
procedure ansi2pchar(const s: ansistring; const orgp: PAnsiChar; out p: PAnsiChar);
|
||||
var
|
||||
newlen: sizeint;
|
||||
begin
|
||||
@ -532,7 +532,7 @@ implementation
|
||||
end;
|
||||
|
||||
|
||||
function AnsiStrLower(Str: PChar): PChar;
|
||||
function AnsiStrLower(Str: PAnsiChar): PAnsiChar;
|
||||
var
|
||||
temp: ansistring;
|
||||
begin
|
||||
@ -541,7 +541,7 @@ implementation
|
||||
end;
|
||||
|
||||
|
||||
function AnsiStrUpper(Str: PChar): PChar;
|
||||
function AnsiStrUpper(Str: PAnsiChar): PAnsiChar;
|
||||
var
|
||||
temp: ansistring;
|
||||
begin
|
||||
@ -552,7 +552,7 @@ implementation
|
||||
|
||||
function GetStandardCodePage(const stdcp: TStandardCodePageEnum): TSystemCodePage;
|
||||
var
|
||||
langinfo: pchar;
|
||||
langinfo: PAnsiChar;
|
||||
begin
|
||||
{ don't use CFStringGetSystemEncoding, that one returns MacRoman on e.g.
|
||||
an English system, which is definitely not what we want. Since there are
|
||||
|
Loading…
Reference in New Issue
Block a user