* 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:
sergei 2012-02-05 18:43:20 +00:00
parent f07d02b427
commit c3b106fde3

View File

@ -362,24 +362,10 @@ threadvar
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;
begin
if source<>'' then
begin
{$ifdef FPC_WIDESTRING_EQUAL_UNICODESTRING}
result:=NewUnicodeString(Length(source));
{$else}
result:=NewWideString(Length(source));
{$endif FPC_WIDESTRING_EQUAL_UNICODESTRING}
move(source[1],result^,Length(source));
end
else
result:=nil;
result:=nil;
{ will call UnicodeString overload if FPC_WIDESTRING_EQUAL_UNICODESTRING is set }
SetString(widestring(pointer(result)),PWideChar(source),length(source));
end;