mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 00:59:08 +02:00
* StringToOleStr(UnicodeString), reduced to single SetString call, this way it does not depend on private functions and does not require $ifdef's.
git-svn-id: trunk@20263 -
This commit is contained in:
parent
f07d02b427
commit
c3b106fde3
@ -362,24 +362,10 @@ threadvar
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
{$ifdef FPC_WIDESTRING_EQUAL_UNICODESTRING}
|
|
||||||
Function NewUnicodeString(Len : SizeInt) : Pointer;forward;
|
|
||||||
{$else}
|
|
||||||
Function NewWideString(Len : SizeInt) : Pointer;forward;
|
|
||||||
{$endif FPC_WIDESTRING_EQUAL_UNICODESTRING}
|
|
||||||
|
|
||||||
|
|
||||||
function StringToOleStr(const source : UnicodeString) : PWideChar;inline;
|
function StringToOleStr(const source : UnicodeString) : PWideChar;inline;
|
||||||
begin
|
begin
|
||||||
if source<>'' then
|
result:=nil;
|
||||||
begin
|
{ will call UnicodeString overload if FPC_WIDESTRING_EQUAL_UNICODESTRING is set }
|
||||||
{$ifdef FPC_WIDESTRING_EQUAL_UNICODESTRING}
|
SetString(widestring(pointer(result)),PWideChar(source),length(source));
|
||||||
result:=NewUnicodeString(Length(source));
|
|
||||||
{$else}
|
|
||||||
result:=NewWideString(Length(source));
|
|
||||||
{$endif FPC_WIDESTRING_EQUAL_UNICODESTRING}
|
|
||||||
move(source[1],result^,Length(source));
|
|
||||||
end
|
|
||||||
else
|
|
||||||
result:=nil;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user