Browse Source

* fixed hopyfully setlength on windows needs still be optimized using SysReallocStringLen

git-svn-id: trunk@3477 -
florian 19 years ago
parent
commit
631e84dcb4
1 changed files with 3 additions and 4 deletions
  1. 3 4
      rtl/inc/wstrings.inc

+ 3 - 4
rtl/inc/wstrings.inc

@@ -680,15 +680,14 @@ begin
               not winwidestringalloc and
 {$endif MSWINDOWS}
               (PWideRec(Pointer(S)-WideFirstOff)^.Ref = 1) then
-{$endif FPC_WINLIKEWIDESTRING}
         begin
           Dec(Pointer(S),WideFirstOff);
           if L*sizeof(WideChar)+WideRecLen>MemSize(Pointer(S)) then
               reallocmem(pointer(S), L*sizeof(WideChar)+WideRecLen);
           Inc(Pointer(S), WideFirstOff);
         end
-{$ifndef FPC_WINLIKEWIDESTRING}
       else
+{$endif FPC_WINLIKEWIDESTRING}
         begin
           { Reallocation is needed... }
           Temp:=Pointer(NewWideString(L));
@@ -697,13 +696,13 @@ begin
               if l < succ(length(s)) then
                 movelen := l
               { also move terminating null }
-              else movelen := succ(length(s));
+              else
+                movelen := succ(length(s));
               Move(Pointer(S)^,Temp^,movelen * Sizeof(WideChar));
             end;
           fpc_widestr_decr_ref(Pointer(S));
           Pointer(S):=Temp;
         end
-{$endif FPC_WINLIKEWIDESTRING}
         ;
       { Force nil termination in case it gets shorter }
       PWord(Pointer(S)+l*sizeof(WideChar))^:=0;