From c3b106fde35ec55cfce94a513f7bb1d1f8791151 Mon Sep 17 00:00:00 2001 From: sergei Date: Sun, 5 Feb 2012 18:43:20 +0000 Subject: [PATCH] * 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 - --- rtl/win/sysos.inc | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/rtl/win/sysos.inc b/rtl/win/sysos.inc index ee7a2566a3..7dd3d305bb 100644 --- a/rtl/win/sysos.inc +++ b/rtl/win/sysos.inc @@ -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; +