Browse Source

* patch from #8480 committed. #0#0 also copied.

git-svn-id: trunk@6782 -
marco 18 years ago
parent
commit
77d82e5b0a
1 changed files with 4 additions and 3 deletions
  1. 4 3
      rtl/inc/wstrings.inc

+ 4 - 3
rtl/inc/wstrings.inc

@@ -238,12 +238,13 @@ Procedure fpc_WideStr_Incr_Ref(Var S : Pointer);[Public,Alias:'FPC_WIDESTR_INCR_
       exit;
 {$ifdef FPC_WINLIKEWIDESTRING}
     p:=NewWidestring(length(WideString(S)));
-    move(s^,p^,length(WideString(s))*sizeof(widechar));
+    move(s^,p^,length(WideString(s)+1)*sizeof(widechar)); // double nul also
     s:=p;
 {$else FPC_WINLIKEWIDESTRING}
     { Let's be paranoid : Constant string ??}
-    If PWideRec(S-WideFirstOff)^.Ref<0 then exit;
-      inclocked(PWideRec(S-WideFirstOff)^.Ref);
+    If PWideRec(S-WideFirstOff)^.Ref<0 then 
+      exit;
+    inclocked(PWideRec(S-WideFirstOff)^.Ref);
 {$endif FPC_WINLIKEWIDESTRING}
   end;