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