Browse Source

* 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 -
sergei 13 years ago
parent
commit
c3b106fde3
1 changed files with 4 additions and 18 deletions
  1. 4 18
      rtl/win/sysos.inc

+ 4 - 18
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;
+