Browse Source

--- Merging r17138 into '.':
U rtl/inc/astrings.inc
U rtl/inc/systemh.inc

# revisions: 17138
------------------------------------------------------------------------
r17138 | sergei | 2011-03-15 15:09:05 +0100 (Tue, 15 Mar 2011) | 1 line
Changed paths:
M /trunk/rtl/inc/astrings.inc
M /trunk/rtl/inc/systemh.inc

+ added procedure SetString(AnsiString, PWideChar, SizeInt)
------------------------------------------------------------------------

git-svn-id: branches/fixes_2_4@17676 -

marco 14 years ago
parent
commit
1ed7459393
2 changed files with 8 additions and 0 deletions
  1. 7 0
      rtl/inc/astrings.inc
  2. 1 0
      rtl/inc/systemh.inc

+ 7 - 0
rtl/inc/astrings.inc

@@ -1050,6 +1050,13 @@ begin
     Move (Buf^,Pointer(S)^,Len);
 end;
 
+Procedure SetString (Out S : AnsiString; Buf : PWideChar; Len : SizeInt);
+begin
+  if (Buf<>nil) and (Len>0) then
+    widestringmanager.Wide2AnsiMoveProc(Buf,S,Len)
+  else
+    SetLength(S, Len);
+end;
 
 function upcase(const s : ansistring) : ansistring;
 var

+ 1 - 0
rtl/inc/systemh.inc

@@ -744,6 +744,7 @@ Function  Pos(C:Char;const s:shortstring):SizeInt;
 {$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
 Function  Pos (const Substr : ShortString; const Source : AnsiString) : SizeInt;
 Procedure SetString (out S : AnsiString; Buf : PChar; Len : SizeInt);
+Procedure SetString (out S : AnsiString; Buf : PWideChar; Len : SizeInt);
 {$endif FPC_HAS_FEATURE_ANSISTRINGS}
 Procedure SetString (out S : Shortstring; Buf : PChar; Len : SizeInt);
 function  ShortCompareText(const S1, S2: shortstring): SizeInt;